Register correct handlers for nvlist_{dup,pack,unpack}

This change is related to commit 81eaf15 which ensured the correct
allocation handlers were installed for nvlist_alloc().  The nvlist
functions nvlist_dup(), nvlist_pack(), and nvlist_unpack() suffer
from the same issue and have been updated accordingly.

Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #1937
Properly handle updates of variably-sized SA entries.

During the update process in sa_modify_attrs(), the sizes of existing
variably-sized SA entries are obtained from sa_lengths[]. The case where
a variably-sized SA was being replaced neglected to increment the index
into sa_lengths[], so subsequent variable-length SAs would be rewritten
with the wrong length. This patch adds the missing increment operation
so all variably-sized SA entries are stored with their correct lengths.

Previously, a size-changing update of a variably-sized SA that occurred
when there were other variably-sized SAs in the bonus buffer would cause
the subsequent SAs to be corrupted.  The most common case in which this
would occur is when a mode change caused the ZPL_DACL_ACES entry to
change size when a ZPL_DXATTR (SA xattr) entry already existed.

The following sequence would have caused a failure when xattr=sa was in
force and would corrupt the bonus buffer:

	open(filename, O_WRONLY | O_CREAT, 0600);
	...
	lsetxattr(filename, ...);	/* create xattr SA */
	chmod(filename, 0650);		/* enlarges the ACL */

Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1978
This is iSCSI sharing for ZoL (shareiscsi).
* Support retrieving active iSCSI sessions:
  + Move nfs.c:foreach_nfs_shareopt() to libshare.c:foreach_shareopt()
    so that it can be (re)used in smb.c and iscsi.c.
  + Add support for options to 'shareiscsi'.
    + name/iqn	Full iSCSI Qualified Name (IQN), including identifier
		Default: Generated by iscsi_generate_target()
			 => iqn.YYYY-MM.tld.domain:dataset
    + lun	LUN (0-16384)
		Default: 0
    + type	Share mode (fileio, blockio, nullio, disk, tape)
		Default: blockio
    + iomode	IO mode (wb, wt, ro)
		Default: wt
    + blocksize	Logical block size (512, 1024, 2048, 4096)
		Default: Volume blocksize, 4096 if not usable.
  + If not called with a name= value, then force setting it.
    This so that the IQN doesn't change every month (when
    it is regenerated again).
* Support for SCST iSCSI implementation.
* Retrive active iSCSI sessions
* Enum values for iscsi_implementation.
* Try to improve performance
  + We check for iSCSI availability in the init function only
    Limits the number of times we do this - it takes time...
  + Use stat() instead of opendir()/closedir().
  + Since iscsi_targets is global, we only retreive targets if it's NULL
    in iscsi_retrieve_targets(). It should limit the number of times we
    fork() and read targets AND sessions.
* Use ZVOL_DIR (/dev) and ZVOL_DRIVER (zvol) instead of hardcoded '/dev/zvol'.
* Run cstyle.pl to fix any code style problems.