MFC r273635, r273793, r274797: Add basic iSNS client to the iSCSI target.

This makes ctld(8) register its iSCSI targets and portals on configured
iSNS servers to allow initiators find them without active discovery.

Fetching of allowed initiators from iSNS is not implemented now, so target
ACLs still should be configured manually.

Relnotes:	Yes
Sponsored by:	iXsystems, Inc.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@274939 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274407

  Fix incorrect reading of 32-bit modinfo by 64-bit loaders.

  The various structures in the mod_metadata set of a FreeBSD kernel and
  modules contain pointers. The FreeBSD loader correctly deals with a
  mismatch in loader and kernel pointer size (e.g. 32-bit i386/ppc
  loader, loading 64-bit amd64/ppc64 kernels), but wasn't dealing with
  the inverse case where a 64-bit loader was loading a 32-bit kernel.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@274942 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273760:
Fix prototypes.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@274943 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 273583:

Tidy up the login code; no functional changes.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@274947 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273584:

Make the initiator-name and initiator-portal checks a little nicer.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@274949 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273467:

Comment out parts about iSER; it's not implemented.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@274950 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273470:

Fix ctl.conf example to use proper paths to ZVOLs.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@274951 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273585:

Improve ctld.conf example.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@274952 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274846:

Fix the following -Werror warning from clang 3.5.0, while building
usr.bin/cpio on amd64 (or any arch with 64-bit time_t):

contrib/libarchive/cpio/cpio.c:1143:6: error: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
	if (abs(mtime - now) > (365/2)*86400)
	    ^
contrib/libarchive/cpio/cpio.c:1143:6: note: use function 'labs' instead
	if (abs(mtime - now) > (365/2)*86400)
	    ^~~
	    labs
1 error generated.

This is because time_t is a long on amd64. To avoid the warning, just
copy the equivalent test from a few lines before, which is used in the
Windows case, and which is type safe.

Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D1198


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275031 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274847:

Fix the following -Werror warnings from clang 3.5.0, while building
usr.bin/locate:

usr.bin/locate/locate/util.c:249:29: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                            MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
                                                 ^
usr.bin/locate/locate/util.c:249:29: note: remove the call to 'abs' since unsigned values cannot be negative
                            MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
                                                 ^~~
usr.bin/locate/locate/util.c:274:32: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                            MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
                                                    ^
usr.bin/locate/locate/util.c:274:32: note: remove the call to 'abs' since unsigned values cannot be negative
                            MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
                                                    ^~~

The problem is that ntohl() always returns an unsigned quantity.  In
this case, it's expected to be cast back to a signed integer, but to
stop complaints about abs() we just store it into an integer, and don't
call ntohl() again.

Reviewed by:	ngie
Differential Revision: https://reviews.freebsd.org/D1196


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275034 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274856:

Avoid undefined behaviour in gas's rotate_left() macro for n == 0.
Otherwise, clang can effectively remove the first iteration of the for
loops where this macro is invoked, and as a result, "cmp r0, #99" fails
to assemble.

Obtained from:	joerg at netbsd


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275036 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274898:

Fix the following -Werror warnings from clang 3.5.0, while building
usr.sbin/rtadvd:

usr.sbin/rtadvd/rtadvd.c:1291:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1291:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^~~
usr.sbin/rtadvd/rtadvd.c:1324:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1324:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^~~
2 errors generated.

These warnings occur because both preferred_time and pfx_pltimeexpire
are uint32_t's, so the subtraction expression is also unsigned, and
calling abs() is a no-op.

However, the intention was to look at the absolute difference between
the two unsigned quantities.  Introduce a small static function to
clarify what we're doing, and call that instead.

Reviewed by:	hrs
Differential Revision: https://reviews.freebsd.org/D1197


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275038 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274900:

Fix the following -Werror warnings from clang 3.5.0, while building
bsnmpd's snmp_hostres module:

usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
        str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
                          ^
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: note: use function 'labs' instead
        str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
                          ^~~
                          labs
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
        str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
                            ^
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: note: use function 'labs' instead
        str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
                            ^~~
                            labs

Since tm::tm_gmtoff is a long, use labs(3) instead.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275039 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274116:

Add new libraries/utilities for data throughput visualization.
dpv(3): dialog progress view library
dpv(1): stream data from stdin or multiple paths with dialog progress view
figpar(3): configuration file parsing library

MFC r274120, r274121, r274123, r274124, r274144, r274146, r274159, r274192,
r274203, r274209, r274226, r274270, and r274851: Fixes following r274116

Reviews:        D714
Relnotes:       New libdpv/libfigpar and dpv(1) utility
Reviewed by:    jelischer, shurd
Discussed at:   MeetBSD California 2014 Vendor/Dev Summit
Discussed on:   -current
Thanks to:      ngie, ian, jelischer, shurd, bapt


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275040 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274724:
cxgbe(4): figure out the max payload size and save it for later.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275092 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273774:
Make some infiniband example utilities easily buildable:
- Add new Makefiles.
- Add more include directories when building.
- Fixed a printf() formatting string.

Sponsored by:	Mellanox Technologies


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275107 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r274750:
  Use geom attribute "PART::type" to determine partition type and choose
  relevant fsck_xxx utility.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275179 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273690:

Mention VAAI and ODX in ctl(4).

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275185 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273768:

Remove the distinction between strings and numbers from ctld(8) yacc parser.
This fixes problems with passing strings that look like numbers to clauses
that expect strings; previously it caused syntax errors and had to be worked
by user, using quotes.  The workaround introduced in r267833 is no longer
neccessary.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275186 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r273770:

Fix build after previous commit.  While here, improve error messages.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@275187 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f