Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jul 2011 03:40:49 +0000 (UTC)
From:      "Justin T. Gibbs" <gibbs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r224172 - in projects/zfsd/head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common lib/libarchive lib/libarchive/libarchive_fe lib/libarchive/test sbin/fdisk...
Message-ID:  <201107180340.p6I3enCU004268@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gibbs
Date: Mon Jul 18 03:40:49 2011
New Revision: 224172
URL: http://svn.freebsd.org/changeset/base/224172

Log:
  Integrate from head into ZFSD feature branch as of revision 224171.

Added:
  projects/zfsd/head/lib/libarchive/archive_read_support_compression_rpm.c
     - copied unchanged from r224171, head/lib/libarchive/archive_read_support_compression_rpm.c
  projects/zfsd/head/lib/libarchive/archive_read_support_format_xar.c
     - copied unchanged from r224171, head/lib/libarchive/archive_read_support_format_xar.c
  projects/zfsd/head/lib/libarchive/libarchive_fe/
     - copied from r224171, head/lib/libarchive/libarchive_fe/
  projects/zfsd/head/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
     - copied unchanged from r224171, head/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
  projects/zfsd/head/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu
     - copied unchanged from r224171, head/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu
  projects/zfsd/head/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
     - copied unchanged from r224171, head/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
  projects/zfsd/head/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu
     - copied unchanged from r224171, head/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu
  projects/zfsd/head/lib/libarchive/test/test_read_format_xar.c
     - copied unchanged from r224171, head/lib/libarchive/test/test_read_format_xar.c
  projects/zfsd/head/usr.bin/cpio/test/test_cmdline.c
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_cmdline.c
  projects/zfsd/head/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.bin.uu
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.bin.uu
  projects/zfsd/head/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.crc.uu
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.crc.uu
  projects/zfsd/head/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.newc.uu
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.newc.uu
  projects/zfsd/head/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu
  projects/zfsd/head/usr.bin/cpio/test/test_option_B_upper.c
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_option_B_upper.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_C_upper.c
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_option_C_upper.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_J_upper.c
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_option_J_upper.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_L_upper.c
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_option_L_upper.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_Z_upper.c
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_option_Z_upper.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_l.c
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_option_l.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_lzma.c
     - copied unchanged from r224171, head/usr.bin/cpio/test/test_option_lzma.c
  projects/zfsd/head/usr.bin/tar/test/test_empty_mtree.c
     - copied unchanged from r224171, head/usr.bin/tar/test/test_empty_mtree.c
  projects/zfsd/head/usr.bin/tar/test/test_option_T_upper.c
     - copied unchanged from r224171, head/usr.bin/tar/test/test_option_T_upper.c
  projects/zfsd/head/usr.bin/tar/test/test_option_r.c
     - copied unchanged from r224171, head/usr.bin/tar/test/test_option_r.c
Deleted:
  projects/zfsd/head/usr.bin/cpio/err.c
  projects/zfsd/head/usr.bin/cpio/err.h
  projects/zfsd/head/usr.bin/cpio/line_reader.c
  projects/zfsd/head/usr.bin/cpio/line_reader.h
  projects/zfsd/head/usr.bin/cpio/matching.c
  projects/zfsd/head/usr.bin/cpio/matching.h
  projects/zfsd/head/usr.bin/cpio/pathmatch.c
  projects/zfsd/head/usr.bin/cpio/pathmatch.h
  projects/zfsd/head/usr.bin/cpio/test/test_option_B.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_L.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_ell.c
  projects/zfsd/head/usr.bin/tar/err.c
  projects/zfsd/head/usr.bin/tar/err.h
  projects/zfsd/head/usr.bin/tar/line_reader.c
  projects/zfsd/head/usr.bin/tar/line_reader.h
  projects/zfsd/head/usr.bin/tar/matching.c
  projects/zfsd/head/usr.bin/tar/matching.h
  projects/zfsd/head/usr.bin/tar/pathmatch.c
  projects/zfsd/head/usr.bin/tar/pathmatch.h
  projects/zfsd/head/usr.bin/tar/test/test_option_T.c
Modified:
  projects/zfsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
  projects/zfsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  projects/zfsd/head/lib/libarchive/Makefile
  projects/zfsd/head/lib/libarchive/README
  projects/zfsd/head/lib/libarchive/archive.h
  projects/zfsd/head/lib/libarchive/archive_hash.h
  projects/zfsd/head/lib/libarchive/archive_read.3
  projects/zfsd/head/lib/libarchive/archive_read_disk_entry_from_file.c
  projects/zfsd/head/lib/libarchive/archive_read_disk_set_standard_lookup.c
  projects/zfsd/head/lib/libarchive/archive_read_support_compression_all.c
  projects/zfsd/head/lib/libarchive/archive_read_support_compression_bzip2.c
  projects/zfsd/head/lib/libarchive/archive_read_support_compression_uu.c
  projects/zfsd/head/lib/libarchive/archive_read_support_format_all.c
  projects/zfsd/head/lib/libarchive/archive_read_support_format_mtree.c
  projects/zfsd/head/lib/libarchive/archive_write_disk.c
  projects/zfsd/head/lib/libarchive/archive_write_disk_set_standard_lookup.c
  projects/zfsd/head/lib/libarchive/archive_write_set_compression_bzip2.c
  projects/zfsd/head/lib/libarchive/config_freebsd.h
  projects/zfsd/head/lib/libarchive/filter_fork.c
  projects/zfsd/head/lib/libarchive/test/Makefile
  projects/zfsd/head/lib/libarchive/test/main.c
  projects/zfsd/head/lib/libarchive/test/read_open_memory.c
  projects/zfsd/head/lib/libarchive/test/test.h
  projects/zfsd/head/lib/libarchive/test/test_entry.c
  projects/zfsd/head/lib/libarchive/test/test_fuzz.c
  projects/zfsd/head/lib/libarchive/test/test_pax_filename_encoding.c
  projects/zfsd/head/lib/libarchive/test/test_read_data_large.c
  projects/zfsd/head/lib/libarchive/test/test_read_large.c
  projects/zfsd/head/lib/libarchive/test/test_read_truncated.c
  projects/zfsd/head/lib/libarchive/test/test_ustar_filenames.c
  projects/zfsd/head/lib/libarchive/test/test_write_format_cpio.c
  projects/zfsd/head/sbin/fdisk/fdisk.c
  projects/zfsd/head/sys/dev/gem/if_gem.c
  projects/zfsd/head/sys/kern/kern_exec.c
  projects/zfsd/head/sys/kern/kern_linker.c
  projects/zfsd/head/sys/kern/kern_mib.c
  projects/zfsd/head/sys/kern/kern_sysctl.c
  projects/zfsd/head/sys/kern/posix4_mib.c
  projects/zfsd/head/sys/kern/subr_smp.c
  projects/zfsd/head/sys/net/if_var.h
  projects/zfsd/head/sys/net/radix.h
  projects/zfsd/head/sys/netinet/in_pcb.h
  projects/zfsd/head/sys/netinet/tcp_syncache.h
  projects/zfsd/head/sys/netinet/tcp_var.h
  projects/zfsd/head/sys/sys/sysctl.h
  projects/zfsd/head/usr.bin/cpio/Makefile
  projects/zfsd/head/usr.bin/cpio/cmdline.c
  projects/zfsd/head/usr.bin/cpio/config_freebsd.h
  projects/zfsd/head/usr.bin/cpio/cpio.c
  projects/zfsd/head/usr.bin/cpio/cpio.h
  projects/zfsd/head/usr.bin/cpio/test/Makefile
  projects/zfsd/head/usr.bin/cpio/test/main.c
  projects/zfsd/head/usr.bin/cpio/test/test.h
  projects/zfsd/head/usr.bin/cpio/test/test_0.c
  projects/zfsd/head/usr.bin/cpio/test/test_basic.c
  projects/zfsd/head/usr.bin/cpio/test/test_format_newc.c
  projects/zfsd/head/usr.bin/cpio/test/test_gcpio_compat.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_a.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_c.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_d.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_f.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_help.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_m.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_t.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_u.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_version.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_y.c
  projects/zfsd/head/usr.bin/cpio/test/test_option_z.c
  projects/zfsd/head/usr.bin/cpio/test/test_owner_parse.c
  projects/zfsd/head/usr.bin/cpio/test/test_passthrough_dotdot.c
  projects/zfsd/head/usr.bin/cpio/test/test_passthrough_reverse.c
  projects/zfsd/head/usr.bin/cpio/test/test_pathmatch.c
  projects/zfsd/head/usr.bin/tar/Makefile
  projects/zfsd/head/usr.bin/tar/bsdtar.1
  projects/zfsd/head/usr.bin/tar/bsdtar.c
  projects/zfsd/head/usr.bin/tar/cmdline.c
  projects/zfsd/head/usr.bin/tar/config_freebsd.h
  projects/zfsd/head/usr.bin/tar/read.c
  projects/zfsd/head/usr.bin/tar/subst.c
  projects/zfsd/head/usr.bin/tar/test/Makefile
  projects/zfsd/head/usr.bin/tar/test/main.c
  projects/zfsd/head/usr.bin/tar/test/test.h
  projects/zfsd/head/usr.bin/tar/test/test_0.c
  projects/zfsd/head/usr.bin/tar/test/test_basic.c
  projects/zfsd/head/usr.bin/tar/test/test_copy.c
  projects/zfsd/head/usr.bin/tar/test/test_help.c
  projects/zfsd/head/usr.bin/tar/test/test_option_q.c
  projects/zfsd/head/usr.bin/tar/test/test_option_s.c
  projects/zfsd/head/usr.bin/tar/test/test_patterns.c
  projects/zfsd/head/usr.bin/tar/test/test_patterns_2.tar.uu
  projects/zfsd/head/usr.bin/tar/test/test_patterns_3.tar.uu
  projects/zfsd/head/usr.bin/tar/test/test_patterns_4.tar.uu
  projects/zfsd/head/usr.bin/tar/test/test_stdio.c
  projects/zfsd/head/usr.bin/tar/test/test_strip_components.c
  projects/zfsd/head/usr.bin/tar/test/test_symlink_dir.c
  projects/zfsd/head/usr.bin/tar/test/test_version.c
  projects/zfsd/head/usr.bin/tar/util.c
  projects/zfsd/head/usr.bin/tar/write.c
  projects/zfsd/head/usr.sbin/rtadvctl/rtadvctl.8
Directory Properties:
  projects/zfsd/head/   (props changed)
  projects/zfsd/head/cddl/contrib/opensolaris/   (props changed)
  projects/zfsd/head/contrib/ee/   (props changed)
  projects/zfsd/head/contrib/expat/   (props changed)
  projects/zfsd/head/contrib/file/   (props changed)
  projects/zfsd/head/contrib/gdb/   (props changed)
  projects/zfsd/head/contrib/gnu-sort/   (props changed)
  projects/zfsd/head/contrib/groff/   (props changed)
  projects/zfsd/head/contrib/less/   (props changed)
  projects/zfsd/head/contrib/libpcap/   (props changed)
  projects/zfsd/head/contrib/ncurses/   (props changed)
  projects/zfsd/head/contrib/one-true-awk/   (props changed)
  projects/zfsd/head/contrib/openbsm/   (props changed)
  projects/zfsd/head/contrib/openpam/   (props changed)
  projects/zfsd/head/contrib/pf/   (props changed)
  projects/zfsd/head/contrib/tcpdump/   (props changed)
  projects/zfsd/head/contrib/tcsh/   (props changed)
  projects/zfsd/head/contrib/tnftp/   (props changed)
  projects/zfsd/head/contrib/tzcode/stdtime/   (props changed)
  projects/zfsd/head/contrib/tzcode/zic/   (props changed)
  projects/zfsd/head/contrib/tzdata/   (props changed)
  projects/zfsd/head/contrib/wpa/   (props changed)
  projects/zfsd/head/lib/libutil/   (props changed)
  projects/zfsd/head/lib/libz/   (props changed)
  projects/zfsd/head/sbin/   (props changed)
  projects/zfsd/head/sbin/ipfw/   (props changed)
  projects/zfsd/head/share/mk/bsd.arch.inc.mk   (props changed)
  projects/zfsd/head/sys/contrib/dev/acpica/   (props changed)
  projects/zfsd/head/usr.bin/csup/   (props changed)
  projects/zfsd/head/usr.bin/procstat/   (props changed)
  projects/zfsd/head/usr.sbin/rtadvctl/   (props changed)
  projects/zfsd/head/usr.sbin/rtadvd/   (props changed)

Modified: projects/zfsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==============================================================================
--- projects/zfsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool.8	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool.8	Mon Jul 18 03:40:49 2011	(r224172)
@@ -82,6 +82,11 @@ zpool \- configures ZFS storage pools
 
 .LP
 .nf
+\fBzpool labelclear\fR [\fB-f\fR] \fIdevice\fR
+.fi
+
+.LP
+.nf
 \fBzpool list\fR [\fB-H\fR] [\fB-o\fR \fIproperty\fR[,...]] [\fIpool\fR] ...
 .fi
 
@@ -1205,6 +1210,28 @@ Verbose statistics. Reports usage statis
 .ne 2
 .mk
 .na
+\fB\fBzpool labelclear\fR [\fB-f\fR] \fIdevice\fR
+.ad
+.sp .6
+.RS 4n
+Removes ZFS label information from the specified device. The device must not be part of an active pool configuration.
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-f\fR\fR
+.ad
+.RS 12n
+.rt  
+Treat exported or foreign devices as inactive.
+.RE
+
+.RE
+
+.sp
+.ne 2
+.mk
+.na
 \fB\fBzpool list\fR [\fB-H\fR] [\fB-o\fR \fIprops\fR[,...]] [\fIpool\fR] ...\fR
 .ad
 .sp .6

Modified: projects/zfsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- projects/zfsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Mon Jul 18 03:40:49 2011	(r224172)
@@ -57,6 +57,7 @@ static int zpool_do_destroy(int, char **
 
 static int zpool_do_add(int, char **);
 static int zpool_do_remove(int, char **);
+static int zpool_do_labelclear(int, char **);
 
 static int zpool_do_list(int, char **);
 static int zpool_do_iostat(int, char **);
@@ -113,6 +114,7 @@ typedef enum {
 	HELP_HISTORY,
 	HELP_IMPORT,
 	HELP_IOSTAT,
+	HELP_LABELCLEAR,
 	HELP_LIST,
 	HELP_OFFLINE,
 	HELP_ONLINE,
@@ -149,6 +151,8 @@ static zpool_command_t command_table[] =
 	{ "add",	zpool_do_add,		HELP_ADD		},
 	{ "remove",	zpool_do_remove,	HELP_REMOVE		},
 	{ NULL },
+	{ "labelclear",	zpool_do_labelclear,	HELP_LABELCLEAR		},
+	{ NULL },
 	{ "list",	zpool_do_list,		HELP_LIST		},
 	{ "iostat",	zpool_do_iostat,	HELP_IOSTAT		},
 	{ "status",	zpool_do_status,	HELP_STATUS		},
@@ -215,6 +219,8 @@ get_usage(zpool_help_t idx) {
 	case HELP_IOSTAT:
 		return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval "
 		    "[count]]\n"));
+	case HELP_LABELCLEAR:
+		return (gettext("\tlabelclear [-f] <vdev>\n"));
 	case HELP_LIST:
 		return (gettext("\tlist [-H] [-o property[,...]] "
 		    "[-T d|u] [pool] ... [interval [count]]\n"));
@@ -561,6 +567,125 @@ zpool_do_remove(int argc, char **argv)
 }
 
 /*
+ * zpool labelclear <vdev>
+ *
+ * Verifies that the vdev is not active and zeros out the label information
+ * on the device.
+ */
+int
+zpool_do_labelclear(int argc, char **argv)
+{
+	char *vdev, *name;
+	int c, fd = -1, ret = 0;
+	pool_state_t state;
+	boolean_t inuse = B_FALSE;
+	boolean_t force = B_FALSE;
+
+	/* check options */
+	while ((c = getopt(argc, argv, "f")) != -1) {
+		switch (c) {
+		case 'f':
+			force = B_TRUE;
+			break;
+		default:
+			(void) fprintf(stderr, gettext("invalid option '%c'\n"),
+			    optopt);
+			usage(B_FALSE);
+		}
+	}
+
+	argc -= optind;
+	argv += optind;
+
+	/* get vdev name */
+	if (argc < 1) {
+		(void) fprintf(stderr, gettext("missing vdev device name\n"));
+		usage(B_FALSE);
+	}
+
+	vdev = argv[0];
+	if ((fd = open(vdev, O_RDWR)) < 0) {
+		(void) fprintf(stderr, gettext("Unable to open %s\n"), vdev);
+		return (B_FALSE);
+	}
+
+	name = NULL;
+	if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0) {
+		if (force)
+			goto wipe_label;
+		
+		(void) fprintf(stderr,
+		    gettext("Unable to determine pool state for %s\n"
+		    "Use -f to force the clearing any label data\n"), vdev);
+
+		return (1);
+	}
+
+	if (inuse) {
+		switch (state) {
+		default:
+		case POOL_STATE_ACTIVE:
+		case POOL_STATE_SPARE:
+		case POOL_STATE_L2CACHE:
+			(void) fprintf(stderr,
+gettext("labelclear operation failed.\n"
+	"\tVdev %s is a member (%s), of pool \"%s\".\n"
+	"\tTo remove label information from this device, export or destroy\n"
+	"\tthe pool, or remove %s from the configuration of this pool\n"
+	"\tand retry the labelclear operation\n"),
+			    vdev, zpool_pool_state_to_name(state), name, vdev);
+			ret = 1;
+			goto errout;
+
+		case POOL_STATE_EXPORTED:
+			if (force)
+				break;
+
+			(void) fprintf(stderr,
+gettext("labelclear operation failed.\n"
+	"\tVdev %s is a member of the exported pool \"%s\".\n"
+	"\tUse \"zpool labelclear -f %s\" to force the removal of label\n"
+	"\tinformation.\n"),
+			    vdev, name, vdev);
+			ret = 1;
+			goto errout;
+
+		case POOL_STATE_POTENTIALLY_ACTIVE:
+			if (force)
+				break;
+
+			(void) fprintf(stderr,
+gettext("labelclear operation failed.\n"
+	"\tVdev %s is a member of the pool \"%s\".\n"
+	"\tThis pool is unknown to this system, but may be active on\n"
+	"\tanother system. Use \'zpool labelclear -f %s\' to force the\n"
+	"\tremoval of label information.\n"),
+			    vdev, name, vdev);
+			ret = 1;
+			goto errout;
+
+		case POOL_STATE_DESTROYED:
+			/* inuse should never be set for a destoryed pool... */
+			break;
+		}
+	}
+
+wipe_label:
+	if (zpool_clear_label(fd) != 0) {
+		(void) fprintf(stderr,
+		    gettext("Label clear failed on vdev %s\n"), vdev);
+		ret = 1;
+	}
+
+errout:
+	close(fd);
+	if (name != NULL)
+		free(name);
+
+	return (ret);
+}
+
+/*
  * zpool create [-fn] [-o property=value] ...
  *		[-O file-system-property=value] ...
  *		[-R root] [-m mountpoint] <pool> <dev> ...
@@ -1052,7 +1177,7 @@ print_status_config(zpool_handle_t *zhp,
 	char *vname;
 	uint64_t notpresent;
 	spare_cbdata_t cb;
-	char *state;
+	const char *state;
 
 	if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
 	    &child, &children) != 0)
@@ -1084,10 +1209,11 @@ print_status_config(zpool_handle_t *zhp,
 	}
 
 	if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT,
-	    &notpresent) == 0) {
+	    &notpresent) == 0 ||
+	    vs->vs_state <= VDEV_STATE_CANT_OPEN) {
 		char *path;
-		verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0);
-		(void) printf("  was %s", path);
+		if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0)
+			(void) printf("  was %s", path);
 	} else if (vs->vs_aux != 0) {
 		(void) printf("  ");
 

Modified: projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==============================================================================
--- projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	Mon Jul 18 03:40:49 2011	(r224172)
@@ -200,7 +200,8 @@ extern zpool_handle_t *zpool_open_canfai
 extern void zpool_close(zpool_handle_t *);
 extern const char *zpool_get_name(zpool_handle_t *);
 extern int zpool_get_state(zpool_handle_t *);
-extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
+extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
+extern const char *zpool_pool_state_to_name(pool_state_t);
 extern void zpool_free_handles(libzfs_handle_t *);
 
 /*
@@ -249,7 +250,7 @@ extern nvlist_t *zpool_find_vdev(zpool_h
     boolean_t *, boolean_t *);
 extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *,
     boolean_t *, boolean_t *, boolean_t *);
-extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *);
+extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *);
 
 /*
  * Functions to manage pool properties

Modified: projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
==============================================================================
--- projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c	Mon Jul 18 03:40:49 2011	(r224172)
@@ -1084,8 +1084,8 @@ zpool_open_func(void *arg)
 
 /*
  * Given a file descriptor, clear (zero) the label information.  This function
- * is currently only used in the appliance stack as part of the ZFS sysevent
- * module.
+ * is used in the appliance stack as part of the ZFS sysevent module and
+ * to implement the "zpool labelclear" command.
  */
 int
 zpool_clear_label(int fd)

Modified: projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==============================================================================
--- projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c	Mon Jul 18 03:40:49 2011	(r224172)
@@ -174,7 +174,7 @@ zpool_get_prop_int(zpool_handle_t *zhp, 
 /*
  * Map VDEV STATE to printed strings.
  */
-char *
+const char *
 zpool_state_to_name(vdev_state_t state, vdev_aux_t aux)
 {
 	switch (state) {
@@ -202,6 +202,34 @@ zpool_state_to_name(vdev_state_t state, 
 }
 
 /*
+ * Map POOL STATE to printed strings.
+ */
+const char *
+zpool_pool_state_to_name(pool_state_t state)
+{
+	switch (state) {
+	case POOL_STATE_ACTIVE:
+		return (gettext("ACTIVE"));
+	case POOL_STATE_EXPORTED:
+		return (gettext("EXPORTED"));
+	case POOL_STATE_DESTROYED:
+		return (gettext("DESTROYED"));
+	case POOL_STATE_SPARE:
+		return (gettext("SPARE"));
+	case POOL_STATE_L2CACHE:
+		return (gettext("L2CACHE"));
+	case POOL_STATE_UNINITIALIZED:
+		return (gettext("UNINITIALIZED"));
+	case POOL_STATE_UNAVAIL:
+		return (gettext("UNAVAIL"));
+	case POOL_STATE_POTENTIALLY_ACTIVE:
+		return (gettext("POTENTIALLY_ACTIVE"));
+	}
+
+	return (gettext("UNKNOWN"));
+}
+
+/*
  * Get a zpool property value for 'prop' and return the value in
  * a pre-allocated buffer.
  */
@@ -3082,15 +3110,25 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp
 	char buf[64];
 	vdev_stat_t *vs;
 	uint_t vsc;
+	int have_stats;
+	int have_path;
 
-	if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT,
-	    &value) == 0) {
+	have_stats = nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
+	    (uint64_t **)&vs, &vsc) == 0;
+	have_path = nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0;
+
+	/*
+	 * If the device is not currently present, assume it will not
+	 * come back at the same device path.  Display the device by GUID.
+	 */
+	if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, &value) == 0 ||
+	    have_path && have_stats && vs->vs_state <= VDEV_STATE_CANT_OPEN) {
 		verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID,
 		    &value) == 0);
 		(void) snprintf(buf, sizeof (buf), "%llu",
 		    (u_longlong_t)value);
 		path = buf;
-	} else if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) {
+	} else if (have_path) {
 
 		/*
 		 * If the device is dead (faulted, offline, etc) then don't
@@ -3098,8 +3136,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp
 		 * open a misbehaving device, which can have undesirable
 		 * effects.
 		 */
-		if ((nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
-		    (uint64_t **)&vs, &vsc) != 0 ||
+		if ((have_stats == 0 ||
 		    vs->vs_state >= VDEV_STATE_DEGRADED) &&
 		    zhp != NULL &&
 		    nvlist_lookup_string(nv, ZPOOL_CONFIG_DEVID, &devid) == 0) {
@@ -3605,7 +3642,7 @@ find_start_block(nvlist_t *config)
  * stripped of any leading /dev path.
  */
 int
-zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name)
+zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name)
 {
 #ifdef sun
 	char path[MAXPATHLEN];

Modified: projects/zfsd/head/lib/libarchive/Makefile
==============================================================================
--- projects/zfsd/head/lib/libarchive/Makefile	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/Makefile	Mon Jul 18 03:40:49 2011	(r224172)
@@ -13,6 +13,9 @@ DPADD+= ${LIBLZMA}
 LDADD+= -llzma
 CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
 
+DPADD+= ${LIBBSDXML}
+LDADD+= -lbsdxml
+
 # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system.
 # It has no real relation to the libarchive version number.
 SHLIB_MAJOR= 5
@@ -56,6 +59,7 @@ SRCS=	archive_check_magic.c				\
 	archive_read_support_compression_gzip.c		\
 	archive_read_support_compression_none.c		\
 	archive_read_support_compression_program.c	\
+	archive_read_support_compression_rpm.c		\
 	archive_read_support_compression_uu.c		\
 	archive_read_support_compression_xz.c		\
 	archive_read_support_format_all.c		\
@@ -66,6 +70,7 @@ SRCS=	archive_check_magic.c				\
 	archive_read_support_format_mtree.c		\
 	archive_read_support_format_raw.c		\
 	archive_read_support_format_tar.c		\
+	archive_read_support_format_xar.c		\
 	archive_read_support_format_zip.c		\
 	archive_string.c				\
 	archive_string_sprintf.c			\

Modified: projects/zfsd/head/lib/libarchive/README
==============================================================================
--- projects/zfsd/head/lib/libarchive/README	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/README	Mon Jul 18 03:40:49 2011	(r224172)
@@ -21,6 +21,7 @@ Currently, the library automatically det
   * gzip compression
   * bzip2 compression
   * compress/LZW compression
+  * lzma and xz compression
   * GNU tar format (including GNU long filenames, long link names, and
     sparse files)
   * Solaris 9 extended tar format (including ACLs)
@@ -30,18 +31,26 @@ Currently, the library automatically det
   * POSIX octet-oriented cpio
   * SVR4 ASCII cpio
   * Binary cpio (big-endian or little-endian)
-  * ISO9660 CD-ROM images (with optional Rockridge extensions)
+  * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
   * ZIP archives (with uncompressed or "deflate" compressed entries)
+  * GNU and BSD 'ar' archives
+  * 'mtree' format
 
 The library can write:
   * gzip compression
   * bzip2 compression
+  * compress/LZW compression
+  * lzma and xz compression
   * POSIX ustar
   * POSIX pax interchange format
   * "restricted" pax format, which will create ustar archives except for
     entries that require pax extensions (for long filenames, ACLs, etc).
   * POSIX octet-oriented cpio
+  * SVR4 "newc" cpio
   * shar archives
+  * ZIP archives (with uncompressed or "deflate" compressed entries)
+  * GNU and BSD 'ar' archives
+  * 'mtree' format
 
 Notes:
  * This is a heavily stream-oriented system.  There is no direct

Modified: projects/zfsd/head/lib/libarchive/archive.h
==============================================================================
--- projects/zfsd/head/lib/libarchive/archive.h	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/archive.h	Mon Jul 18 03:40:49 2011	(r224172)
@@ -52,7 +52,9 @@
 /* These should match the types used in 'struct stat' */
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #define	__LA_INT64_T	__int64
-# if	defined(_WIN64)
+# if defined(_SSIZE_T_DEFINED)
+#  define	__LA_SSIZE_T	ssize_t
+# elif defined(_WIN64)
 #  define	__LA_SSIZE_T	__int64
 # else
 #  define	__LA_SSIZE_T	long
@@ -127,13 +129,13 @@ extern "C" {
  *             (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
  * #endif
  */
-#define	ARCHIVE_VERSION_NUMBER 2007901
+#define	ARCHIVE_VERSION_NUMBER 2008004
 __LA_DECL int		archive_version_number(void);
 
 /*
  * Textual name/version of the library, useful for version displays.
  */
-#define	ARCHIVE_VERSION_STRING "libarchive 2.7.901a"
+#define	ARCHIVE_VERSION_STRING "libarchive 2.8.4"
 __LA_DECL const char *	archive_version_string(void);
 
 #if ARCHIVE_VERSION_NUMBER < 3000000
@@ -319,6 +321,7 @@ __LA_DECL int		 archive_read_support_com
 				(struct archive *, const char *,
 				    const void * /* match */, size_t);
 
+__LA_DECL int		 archive_read_support_compression_rpm(struct archive *);
 __LA_DECL int		 archive_read_support_compression_uu(struct archive *);
 __LA_DECL int		 archive_read_support_compression_xz(struct archive *);
 
@@ -331,6 +334,7 @@ __LA_DECL int		 archive_read_support_for
 __LA_DECL int		 archive_read_support_format_mtree(struct archive *);
 __LA_DECL int		 archive_read_support_format_raw(struct archive *);
 __LA_DECL int		 archive_read_support_format_tar(struct archive *);
+__LA_DECL int		 archive_read_support_format_xar(struct archive *);
 __LA_DECL int		 archive_read_support_format_zip(struct archive *);
 
 

Modified: projects/zfsd/head/lib/libarchive/archive_hash.h
==============================================================================
--- projects/zfsd/head/lib/libarchive/archive_hash.h	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/archive_hash.h	Mon Jul 18 03:40:49 2011	(r224172)
@@ -29,6 +29,10 @@
 #error This header is only to be used internally to libarchive.
 #endif
 
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
 /*
  * Hash function support in various Operating Systems:
  *
@@ -41,43 +45,71 @@
  * - OpenBSD 4.4 and earlier have SHA2 in libc with _ after algorithm name
  *
  * DragonFly and FreeBSD (XXX not used yet):
- * - MD5 in libmd: without _ after algorithm name
- * - SHA{1,256,512} in libmd: with _ after algorithm name (conflicts w/OpenSSL!)
+ * - MD5 and SHA1 in libmd: without _ after algorithm name
+ * - SHA256: with _ after algorithm name
+ *
+ * Mac OS X (10.4 and later):
+ * - MD5, SHA1 and SHA2 in libSystem: with CC_ prefix and _ after algorithm name
  *
  * OpenSSL:
- * - MD5, SHA1, SHA2, SHA{256,384,512} in libcrypto: with _ after algorithm name
+ * - MD5, SHA1 and SHA2 in libcrypto: with _ after algorithm name
+ *
+ * Windows:
+ * - MD5, SHA1 and SHA2 in archive_windows.c: without algorithm name
+ *   and with __la_ prefix.
  */
+#if defined(ARCHIVE_HASH_MD5_WIN)    ||\
+      defined(ARCHIVE_HASH_SHA1_WIN)   || defined(ARCHIVE_HASH_SHA256_WIN) ||\
+      defined(ARCHIVE_HASH_SHA384_WIN) || defined(ARCHIVE_HASH_SHA512_WIN)
+#include <wincrypt.h>
+typedef struct {
+	int		valid;
+	HCRYPTPROV	cryptProv;
+	HCRYPTHASH	hash;
+} Digest_CTX;
+extern void __la_hash_Init(Digest_CTX *, ALG_ID);
+extern void __la_hash_Final(unsigned char *, size_t, Digest_CTX *);
+extern void __la_hash_Update(Digest_CTX *, const unsigned char *, size_t);
+#endif
 
-#if defined(HAVE_MD5_H) && defined(HAVE_MD5INIT)
+#if defined(ARCHIVE_HASH_MD5_LIBC)
 #  include <md5.h>
 #  define ARCHIVE_HAS_MD5
 typedef MD5_CTX archive_md5_ctx;
 #  define archive_md5_init(ctx)			MD5Init(ctx)
 #  define archive_md5_final(ctx, buf)		MD5Final(buf, ctx)
 #  define archive_md5_update(ctx, buf, n)	MD5Update(ctx, buf, n)
-#elif defined(HAVE_OPENSSL_MD5_H)
+#elif defined(ARCHIVE_HASH_MD5_LIBSYSTEM)
+#  include <CommonCrypto/CommonDigest.h>
+#  define ARCHIVE_HAS_MD5
+typedef CC_MD5_CTX archive_md5_ctx;
+#  define archive_md5_init(ctx)			CC_MD5_Init(ctx)
+#  define archive_md5_final(ctx, buf)		CC_MD5_Final(buf, ctx)
+#  define archive_md5_update(ctx, buf, n)	CC_MD5_Update(ctx, buf, n)
+#elif defined(ARCHIVE_HASH_MD5_OPENSSL)
 #  include <openssl/md5.h>
 #  define ARCHIVE_HAS_MD5
 typedef MD5_CTX archive_md5_ctx;
 #  define archive_md5_init(ctx)			MD5_Init(ctx)
 #  define archive_md5_final(ctx, buf)		MD5_Final(buf, ctx)
 #  define archive_md5_update(ctx, buf, n)	MD5_Update(ctx, buf, n)
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_MD5)
+#elif defined(ARCHIVE_HASH_MD5_WIN)
 #  define ARCHIVE_HAS_MD5
-typedef MD5_CTX archive_md5_ctx;
-#  define archive_md5_init(ctx)			MD5_Init(ctx)
-#  define archive_md5_final(ctx, buf)		MD5_Final(buf, ctx)
-#  define archive_md5_update(ctx, buf, n)	MD5_Update(ctx, buf, n)
+#  define MD5_DIGEST_LENGTH	16
+typedef Digest_CTX archive_md5_ctx;
+#  define archive_md5_init(ctx)			__la_hash_Init(ctx, CALG_MD5)
+#  define archive_md5_final(ctx, buf)		__la_hash_Final(buf, MD5_DIGEST_LENGTH, ctx)
+#  define archive_md5_update(ctx, buf, n)	__la_hash_Update(ctx, buf, n)
 #endif
 
-#if defined(HAVE_RMD160_H) && defined(HAVE_RMD160INIT)
+#if defined(ARCHIVE_HASH_RMD160_LIBC)
 #  include <rmd160.h>
 #  define ARCHIVE_HAS_RMD160
 typedef RMD160_CTX archive_rmd160_ctx;
 #  define archive_rmd160_init(ctx)		RMD160Init(ctx)
 #  define archive_rmd160_final(ctx, buf)	RMD160Final(buf, ctx)
 #  define archive_rmd160_update(ctx, buf, n)	RMD160Update(ctx, buf, n)
-#elif defined(HAVE_OPENSSL_RIPEMD_H)
+#elif defined(ARCHIVE_HASH_RMD160_OPENSSL)
 #  include <openssl/ripemd.h>
 #  define ARCHIVE_HAS_RMD160
 typedef RIPEMD160_CTX archive_rmd160_ctx;
@@ -86,111 +118,164 @@ typedef RIPEMD160_CTX archive_rmd160_ctx
 #  define archive_rmd160_update(ctx, buf, n)	RIPEMD160_Update(ctx, buf, n)
 #endif
 
-#if defined(HAVE_SHA1_H) && defined(HAVE_SHA1INIT)
+#if defined(ARCHIVE_HASH_SHA1_LIBC)
 #  include <sha1.h>
 #  define ARCHIVE_HAS_SHA1
 typedef SHA1_CTX archive_sha1_ctx;
 #  define archive_sha1_init(ctx)		SHA1Init(ctx)
 #  define archive_sha1_final(ctx, buf)		SHA1Final(buf, ctx)
 #  define archive_sha1_update(ctx, buf, n)	SHA1Update(ctx, buf, n)
-#elif defined(HAVE_OPENSSL_SHA_H)
+#elif defined(ARCHIVE_HASH_SHA1_LIBSYSTEM)
+#  include <CommonCrypto/CommonDigest.h>
+#  define ARCHIVE_HAS_SHA1
+typedef CC_SHA1_CTX archive_sha1_ctx;
+#  define archive_sha1_init(ctx)		CC_SHA1_Init(ctx)
+#  define archive_sha1_final(ctx, buf)		CC_SHA1_Final(buf, ctx)
+#  define archive_sha1_update(ctx, buf, n)	CC_SHA1_Update(ctx, buf, n)
+#elif defined(ARCHIVE_HASH_SHA1_OPENSSL)
 #  include <openssl/sha.h>
 #  define ARCHIVE_HAS_SHA1
 typedef SHA_CTX archive_sha1_ctx;
 #  define archive_sha1_init(ctx)		SHA1_Init(ctx)
 #  define archive_sha1_final(ctx, buf)		SHA1_Final(buf, ctx)
 #  define archive_sha1_update(ctx, buf, n)	SHA1_Update(ctx, buf, n)
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_SHA1)
+#elif defined(ARCHIVE_HASH_SHA1_WIN)
 #  define ARCHIVE_HAS_SHA1
-typedef SHA1_CTX archive_sha1_ctx;
-#  define archive_sha1_init(ctx)		SHA1_Init(ctx)
-#  define archive_sha1_final(ctx, buf)		SHA1_Final(buf, ctx)
-#  define archive_sha1_update(ctx, buf, n)	SHA1_Update(ctx, buf, n)
+#  define SHA1_DIGEST_LENGTH	20
+typedef Digest_CTX archive_sha1_ctx;
+#  define archive_sha1_init(ctx)		__la_hash_Init(ctx, CALG_SHA1)
+#  define archive_sha1_final(ctx, buf)		__la_hash_Final(buf, SHA1_DIGEST_LENGTH, ctx)
+#  define archive_sha1_update(ctx, buf, n)	__la_hash_Update(ctx, buf, n)
 #endif
 
-#if defined(HAVE_SHA2_H) && defined(HAVE_SHA256_INIT)
+#if defined(ARCHIVE_HASH_SHA256_LIBC)
 #  include <sha2.h>
 #  define ARCHIVE_HAS_SHA256
 typedef SHA256_CTX archive_sha256_ctx;
 #  define archive_sha256_init(ctx)		SHA256_Init(ctx)
 #  define archive_sha256_final(ctx, buf)	SHA256_Final(buf, ctx)
 #  define archive_sha256_update(ctx, buf, n)	SHA256_Update(ctx, buf, n)
-#elif defined(HAVE_SHA2_H) && defined(HAVE_SHA256INIT)
+#elif defined(ARCHIVE_HASH_SHA256_LIBC2)
 #  include <sha2.h>
 #  define ARCHIVE_HAS_SHA256
 typedef SHA256_CTX archive_sha256_ctx;
 #  define archive_sha256_init(ctx)		SHA256Init(ctx)
 #  define archive_sha256_final(ctx, buf)	SHA256Final(buf, ctx)
 #  define archive_sha256_update(ctx, buf, n)	SHA256Update(ctx, buf, n)
-#elif defined(HAVE_OPENSSL_SHA_H) && defined(HAVE_OPENSSL_SHA256_INIT)
+#elif defined(ARCHIVE_HASH_SHA256_LIBC3)
+#  include <sha2.h>
+#  define ARCHIVE_HAS_SHA256
+typedef SHA2_CTX archive_sha256_ctx;
+#  define archive_sha256_init(ctx)		SHA256Init(ctx)
+#  define archive_sha256_final(ctx, buf)	SHA256Final(buf, ctx)
+#  define archive_sha256_update(ctx, buf, n)	SHA256Update(ctx, buf, n)
+#elif defined(ARCHIVE_HASH_SHA256_LIBSYSTEM)
+#  include <CommonCrypto/CommonDigest.h>
+#  define ARCHIVE_HAS_SHA256
+typedef CC_SHA256_CTX archive_shs256_ctx;
+#  define archive_shs256_init(ctx)		CC_SHA256_Init(ctx)
+#  define archive_shs256_final(ctx, buf)	CC_SHA256_Final(buf, ctx)
+#  define archive_shs256_update(ctx, buf, n)	CC_SHA256_Update(ctx, buf, n)
+#elif defined(ARCHIVE_HASH_SHA256_OPENSSL)
 #  include <openssl/sha.h>
 #  define ARCHIVE_HAS_SHA256
 typedef SHA256_CTX archive_sha256_ctx;
 #  define archive_sha256_init(ctx)		SHA256_Init(ctx)
 #  define archive_sha256_final(ctx, buf)	SHA256_Final(buf, ctx)
 #  define archive_sha256_update(ctx, buf, n)	SHA256_Update(ctx, buf, n)
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_SHA_256)
+#elif defined(ARCHIVE_HASH_SHA256_WIN)
 #  define ARCHIVE_HAS_SHA256
-typedef SHA256_CTX archive_sha256_ctx;
-#  define archive_sha256_init(ctx)		SHA256_Init(ctx)
-#  define archive_sha256_final(ctx, buf)	SHA256_Final(buf, ctx)
-#  define archive_sha256_update(ctx, buf, n)	SHA256_Update(ctx, buf, n)
+#  define SHA256_DIGEST_LENGTH	32
+typedef Digest_CTX archive_sha256_ctx;
+#  define archive_sha256_init(ctx)		__la_hash_Init(ctx, CALG_SHA_256)
+#  define archive_sha256_final(ctx, buf)	__la_hash_Final(buf, SHA256_DIGEST_LENGTH, ctx)
+#  define archive_sha256_update(ctx, buf, n)	__la_hash_Update(ctx, buf, n)
 #endif
 
-#if defined(HAVE_SHA2_H) && defined(HAVE_SHA384_INIT)
+#if defined(ARCHIVE_HASH_SHA384_LIBC)
 #  include <sha2.h>
 #  define ARCHIVE_HAS_SHA384
 typedef SHA384_CTX archive_sha384_ctx;
 #  define archive_sha384_init(ctx)		SHA384_Init(ctx)
 #  define archive_sha384_final(ctx, buf)	SHA384_Final(buf, ctx)
 #  define archive_sha384_update(ctx, buf, n)	SHA384_Update(ctx, buf, n)
-#elif defined(HAVE_SHA2_H) && defined(HAVE_SHA384INIT)
+#elif defined(ARCHIVE_HASH_SHA384_LIBC2)
 #  include <sha2.h>
 #  define ARCHIVE_HAS_SHA384
 typedef SHA384_CTX archive_sha384_ctx;
 #  define archive_sha384_init(ctx)		SHA384Init(ctx)
 #  define archive_sha384_final(ctx, buf)	SHA384Final(buf, ctx)
 #  define archive_sha384_update(ctx, buf, n)	SHA384Update(ctx, buf, n)
-#elif defined(HAVE_OPENSSL_SHA_H) && defined(HAVE_OPENSSL_SHA384_INIT)
+#elif defined(ARCHIVE_HASH_SHA384_LIBC3)
+#  include <sha2.h>
+#  define ARCHIVE_HAS_SHA384
+typedef SHA2_CTX archive_sha384_ctx;
+#  define archive_sha384_init(ctx)		SHA384Init(ctx)
+#  define archive_sha384_final(ctx, buf)	SHA384Final(buf, ctx)
+#  define archive_sha384_update(ctx, buf, n)	SHA384Update(ctx, buf, n)
+#elif defined(ARCHIVE_HASH_SHA384_LIBSYSTEM)
+#  include <CommonCrypto/CommonDigest.h>
+#  define ARCHIVE_HAS_SHA384
+typedef CC_SHA512_CTX archive_shs384_ctx;
+#  define archive_shs384_init(ctx)		CC_SHA384_Init(ctx)
+#  define archive_shs384_final(ctx, buf)	CC_SHA384_Final(buf, ctx)
+#  define archive_shs384_update(ctx, buf, n)	CC_SHA384_Update(ctx, buf, n)
+#elif defined(ARCHIVE_HASH_SHA384_OPENSSL)
 #  include <openssl/sha.h>
 #  define ARCHIVE_HAS_SHA384
 typedef SHA512_CTX archive_sha384_ctx;
 #  define archive_sha384_init(ctx)		SHA384_Init(ctx)
 #  define archive_sha384_final(ctx, buf)	SHA384_Final(buf, ctx)
 #  define archive_sha384_update(ctx, buf, n)	SHA384_Update(ctx, buf, n)
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_SHA_384)
+#elif defined(ARCHIVE_HASH_SHA384_WIN)
 #  define ARCHIVE_HAS_SHA384
-typedef SHA512_CTX archive_sha384_ctx;
-#  define archive_sha384_init(ctx)		SHA384_Init(ctx)
-#  define archive_sha384_final(ctx, buf)	SHA384_Final(buf, ctx)
-#  define archive_sha384_update(ctx, buf, n)	SHA384_Update(ctx, buf, n)
+#  define SHA384_DIGEST_LENGTH	48
+typedef Digest_CTX archive_sha384_ctx;
+#  define archive_sha384_init(ctx)		__la_hash_Init(ctx, CALG_SHA_384)
+#  define archive_sha384_final(ctx, buf)	__la_hash_Final(buf, SHA384_DIGEST_LENGTH, ctx)
+#  define archive_sha384_update(ctx, buf, n)	__la_hash_Update(ctx, buf, n)
 #endif
 
-#if defined(HAVE_SHA2_H) && defined(HAVE_SHA512_INIT)
+#if defined(ARCHIVE_HASH_SHA512_LIBC)
 #  include <sha2.h>
 #  define ARCHIVE_HAS_SHA512
 typedef SHA512_CTX archive_sha512_ctx;
 #  define archive_sha512_init(ctx)		SHA512_Init(ctx)
 #  define archive_sha512_final(ctx, buf)	SHA512_Final(buf, ctx)
 #  define archive_sha512_update(ctx, buf, n)	SHA512_Update(ctx, buf, n)
-#elif defined(HAVE_SHA2_H) && defined(HAVE_SHA512INIT)
+#elif defined(ARCHIVE_HASH_SHA512_LIBC2)
 #  include <sha2.h>
 #  define ARCHIVE_HAS_SHA512
 typedef SHA512_CTX archive_sha512_ctx;
 #  define archive_sha512_init(ctx)		SHA512Init(ctx)
 #  define archive_sha512_final(ctx, buf)	SHA512Final(buf, ctx)
 #  define archive_sha512_update(ctx, buf, n)	SHA512Update(ctx, buf, n)
-#elif defined(HAVE_OPENSSL_SHA_H) && defined(HAVE_OPENSSL_SHA512_INIT)
+#elif defined(ARCHIVE_HASH_SHA512_LIBC3)
+#  include <sha2.h>
+#  define ARCHIVE_HAS_SHA512
+typedef SHA2_CTX archive_sha512_ctx;
+#  define archive_sha512_init(ctx)		SHA512Init(ctx)
+#  define archive_sha512_final(ctx, buf)	SHA512Final(buf, ctx)
+#  define archive_sha512_update(ctx, buf, n)	SHA512Update(ctx, buf, n)
+#elif defined(ARCHIVE_HASH_SHA512_LIBSYSTEM)
+#  include <CommonCrypto/CommonDigest.h>
+#  define ARCHIVE_HAS_SHA512
+typedef CC_SHA512_CTX archive_shs512_ctx;
+#  define archive_shs512_init(ctx)		CC_SHA512_Init(ctx)
+#  define archive_shs512_final(ctx, buf)	CC_SHA512_Final(buf, ctx)
+#  define archive_shs512_update(ctx, buf, n)	CC_SHA512_Update(ctx, buf, n)
+#elif defined(ARCHIVE_HASH_SHA512_OPENSSL)
 #  include <openssl/sha.h>
 #  define ARCHIVE_HAS_SHA512
 typedef SHA512_CTX archive_sha512_ctx;
 #  define archive_sha512_init(ctx)		SHA512_Init(ctx)
 #  define archive_sha512_final(ctx, buf)	SHA512_Final(buf, ctx)
 #  define archive_sha512_update(ctx, buf, n)	SHA512_Update(ctx, buf, n)
-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(CALG_SHA_512)
+#elif defined(ARCHIVE_HASH_SHA512_WIN)
 #  define ARCHIVE_HAS_SHA512
-typedef SHA512_CTX archive_sha512_ctx;
-#  define archive_sha512_init(ctx)		SHA512_Init(ctx)
-#  define archive_sha512_final(ctx, buf)	SHA512_Final(buf, ctx)
-#  define archive_sha512_update(ctx, buf, n)	SHA512_Update(ctx, buf, n)
+#  define SHA512_DIGEST_LENGTH	64
+typedef Digest_CTX archive_sha512_ctx;
+#  define archive_sha512_init(ctx)		__la_hash_Init(ctx, CALG_SHA_512)
+#  define archive_sha512_final(ctx, buf)	__la_hash_Final(buf, SHA512_DIGEST_LENGTH, ctx)
+#  define archive_sha512_update(ctx, buf, n)	__la_hash_Update(ctx, buf, n)
 #endif

Modified: projects/zfsd/head/lib/libarchive/archive_read.3
==============================================================================
--- projects/zfsd/head/lib/libarchive/archive_read.3	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/archive_read.3	Mon Jul 18 03:40:49 2011	(r224172)
@@ -597,7 +597,7 @@ list_archive(const char *name)
   archive_read_support_format_all(a);
   archive_read_open(a, mydata, myopen, myread, myclose);
   while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
-    printf("%s\\n",archive_entry_pathname(entry));
+    printf("%s\en",archive_entry_pathname(entry));
     archive_read_data_skip(a);
   }
   archive_read_free(a);

Modified: projects/zfsd/head/lib/libarchive/archive_read_disk_entry_from_file.c
==============================================================================
--- projects/zfsd/head/lib/libarchive/archive_read_disk_entry_from_file.c	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/archive_read_disk_entry_from_file.c	Mon Jul 18 03:40:49 2011	(r224172)
@@ -208,6 +208,12 @@ setup_acls_posix1e(struct archive_read_d
 #if HAVE_ACL_GET_LINK_NP
 	else if (!a->follow_symlinks)
 		acl = acl_get_link_np(accpath, ACL_TYPE_ACCESS);
+#else
+	else if ((!a->follow_symlinks)
+	    && (archive_entry_filetype(entry) == AE_IFLNK))
+		/* We can't get the ACL of a symlink, so we assume it can't
+		   have one. */
+		acl = NULL;
 #endif
 	else
 		acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
@@ -419,7 +425,8 @@ setup_xattrs(struct archive_read_disk *a
 	return (ARCHIVE_OK);
 }
 
-#elif HAVE_EXTATTR_GET_FILE && HAVE_EXTATTR_LIST_FILE
+#elif HAVE_EXTATTR_GET_FILE && HAVE_EXTATTR_LIST_FILE && \
+    HAVE_DECL_EXTATTR_NAMESPACE_USER
 
 /*
  * FreeBSD extattr interface.
@@ -430,11 +437,11 @@ setup_xattrs(struct archive_read_disk *a
  * to not include the system extattrs that hold ACLs; we handle
  * those separately.
  */
-int
+static int
 setup_xattr(struct archive_read_disk *a, struct archive_entry *entry,
     int namespace, const char *name, const char *fullname, int fd);
 
-int
+static int
 setup_xattr(struct archive_read_disk *a, struct archive_entry *entry,
     int namespace, const char *name, const char *fullname, int fd)
 {

Modified: projects/zfsd/head/lib/libarchive/archive_read_disk_set_standard_lookup.c
==============================================================================
--- projects/zfsd/head/lib/libarchive/archive_read_disk_set_standard_lookup.c	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/archive_read_disk_set_standard_lookup.c	Mon Jul 18 03:40:49 2011	(r224172)
@@ -182,6 +182,7 @@ lookup_uname(void *data, uid_t uid)
 		    &lookup_uname_helper, (id_t)uid));
 }
 
+#if HAVE_GETPWUID_R
 static const char *
 lookup_uname_helper(struct name_cache *cache, id_t id)
 {
@@ -222,6 +223,20 @@ lookup_uname_helper(struct name_cache *c
 
 	return strdup(result->pw_name);
 }
+#else
+static const char *
+lookup_uname_helper(struct name_cache *cache, id_t id)
+{
+	struct passwd	*result;
+
+	result = getpwuid((uid_t)id);
+
+	if (result == NULL)
+		return (NULL);
+
+	return strdup(result->pw_name);
+}
+#endif
 
 static const char *
 lookup_gname(void *data, gid_t gid)
@@ -231,6 +246,7 @@ lookup_gname(void *data, gid_t gid)
 		    &lookup_gname_helper, (id_t)gid));
 }
 
+#if HAVE_GETGRGID_R
 static const char *
 lookup_gname_helper(struct name_cache *cache, id_t id)
 {
@@ -269,4 +285,19 @@ lookup_gname_helper(struct name_cache *c
 
 	return strdup(result->gr_name);
 }
+#else
+static const char *
+lookup_gname_helper(struct name_cache *cache, id_t id)
+{
+	struct group	*result;
+
+	result = getgrgid((gid_t)id);
+
+	if (result == NULL)
+		return (NULL);
+
+	return strdup(result->gr_name);
+}
+#endif
+
 #endif /* ! (_WIN32 && !__CYGWIN__) */

Modified: projects/zfsd/head/lib/libarchive/archive_read_support_compression_all.c
==============================================================================
--- projects/zfsd/head/lib/libarchive/archive_read_support_compression_all.c	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/archive_read_support_compression_all.c	Mon Jul 18 03:40:49 2011	(r224172)
@@ -46,6 +46,8 @@ archive_read_support_compression_all(str
 	archive_read_support_compression_xz(a);
 	/* The decode code doesn't use an outside library. */
 	archive_read_support_compression_uu(a);
+	/* The decode code doesn't use an outside library. */
+	archive_read_support_compression_rpm(a);
 
 	/* Note: We always return ARCHIVE_OK here, even if some of the
 	 * above return ARCHIVE_WARN.  The intent here is to enable

Modified: projects/zfsd/head/lib/libarchive/archive_read_support_compression_bzip2.c
==============================================================================
--- projects/zfsd/head/lib/libarchive/archive_read_support_compression_bzip2.c	Mon Jul 18 03:18:06 2011	(r224171)
+++ projects/zfsd/head/lib/libarchive/archive_read_support_compression_bzip2.c	Mon Jul 18 03:40:49 2011	(r224172)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
 #include "archive_private.h"
 #include "archive_read_private.h"
 
-#if HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
 struct private_data {
 	bz_stream	 stream;
 	char		*out_block;
@@ -86,7 +86,7 @@ archive_read_support_compression_bzip2(s
 	reader->init = bzip2_reader_init;
 	reader->options = NULL;
 	reader->free = bzip2_reader_free;
-#if HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
 	return (ARCHIVE_OK);
 #else
 	archive_set_error(_a, ARCHIVE_ERRNO_MISC,
@@ -146,7 +146,7 @@ bzip2_reader_bid(struct archive_read_fil
 	return (bits_checked);
 }
 
-#ifndef HAVE_BZLIB_H
+#if !defined(HAVE_BZLIB_H) || !defined(BZ_CONFIG_ERROR)
 
 /*
  * If we don't have the library on this system, we can't actually do the

Copied: projects/zfsd/head/lib/libarchive/archive_read_support_compression_rpm.c (from r224171, head/lib/libarchive/archive_read_support_compression_rpm.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/lib/libarchive/archive_read_support_compression_rpm.c	Mon Jul 18 03:40:49 2011	(r224172, copy of r224171, head/lib/libarchive/archive_read_support_compression_rpm.c)
@@ -0,0 +1,288 @@
+/*-
+ * Copyright (c) 2009 Michihiro NAKAJIMA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD$");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include "archive.h"
+#include "archive_endian.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+struct rpm {
+	int64_t		 total_in;
+	size_t		 hpos;
+	size_t		 hlen;
+	unsigned char	 header[16];
+	enum {
+		ST_LEAD,	/* Skipping 'Lead' section. */
+		ST_HEADER,	/* Reading 'Header' section;
+				 * first 16 bytes. */
+		ST_HEADER_DATA,	/* Skipping 'Header' section. */
+		ST_PADDING,	/* Skipping padding data after the
+				 * 'Header' section. */
+		ST_ARCHIVE	/* Reading 'Archive' section. */
+	}		 state;
+	int		 first_header;
+};
+#define RPM_LEAD_SIZE	96	/* Size of 'Lead' section. */
+
+static int	rpm_bidder_bid(struct archive_read_filter_bidder *,
+		    struct archive_read_filter *);
+static int	rpm_bidder_init(struct archive_read_filter *);
+
+static ssize_t	rpm_filter_read(struct archive_read_filter *,
+		    const void **);
+static int	rpm_filter_close(struct archive_read_filter *);
+
+int
+archive_read_support_compression_rpm(struct archive *_a)
+{
+	struct archive_read *a = (struct archive_read *)_a;
+	struct archive_read_filter_bidder *bidder;
+
+	bidder = __archive_read_get_bidder(a);
+	archive_clear_error(_a);
+	if (bidder == NULL)
+		return (ARCHIVE_FATAL);
+
+	bidder->data = NULL;
+	bidder->bid = rpm_bidder_bid;
+	bidder->init = rpm_bidder_init;
+	bidder->options = NULL;
+	bidder->free = NULL;
+	return (ARCHIVE_OK);
+}
+
+static int
+rpm_bidder_bid(struct archive_read_filter_bidder *self,

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107180340.p6I3enCU004268>