PERFORCE change 117668 for review

Matt Jacob mjacob at FreeBSD.org
Sun Apr 8 17:21:42 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=117668

Change 117668 by mjacob at mjexp on 2007/04/08 17:20:36

	IFC

Affected files ...

.. //depot/projects/mjexp/cddl/lib/Makefile#2 integrate
.. //depot/projects/mjexp/cddl/lib/libzpool/Makefile#2 integrate
.. //depot/projects/mjexp/cddl/usr.bin/Makefile#2 integrate
.. //depot/projects/mjexp/cddl/usr.sbin/Makefile#2 integrate
.. //depot/projects/mjexp/contrib/openpam/lib/openpam_readline.c#2 integrate
.. //depot/projects/mjexp/contrib/opensolaris/cmd/zpool/zpool_main.c#2 integrate
.. //depot/projects/mjexp/contrib/opensolaris/cmd/ztest/ztest.c#2 integrate
.. //depot/projects/mjexp/contrib/opensolaris/lib/libzfs/common/libzfs.h#2 integrate
.. //depot/projects/mjexp/contrib/opensolaris/lib/libzfs/common/libzfs_import.c#2 integrate
.. //depot/projects/mjexp/contrib/opensolaris/lib/libzfs/common/libzfs_status.c#2 integrate
.. //depot/projects/mjexp/contrib/opensolaris/lib/libzfs/common/libzfs_util.c#2 integrate
.. //depot/projects/mjexp/contrib/opensolaris/lib/libzpool/common/kernel.c#2 integrate
.. //depot/projects/mjexp/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h#2 integrate
.. //depot/projects/mjexp/etc/devd.conf#4 integrate
.. //depot/projects/mjexp/include/stdio.h#3 integrate
.. //depot/projects/mjexp/lib/libarchive/Makefile#7 integrate
.. //depot/projects/mjexp/lib/libarchive/archive_read.3#8 integrate
.. //depot/projects/mjexp/lib/libarchive/archive_read_extract.c#7 integrate
.. //depot/projects/mjexp/lib/libarchive/archive_read_support_format_all.c#4 integrate
.. //depot/projects/mjexp/lib/libarchive/archive_write_disk.c#4 integrate
.. //depot/projects/mjexp/lib/libarchive/test/Makefile#3 integrate
.. //depot/projects/mjexp/lib/libc/sys/ptrace.2#3 integrate
.. //depot/projects/mjexp/libexec/rtld-elf/i386/Symbol.map#2 integrate
.. //depot/projects/mjexp/libexec/rtld-elf/rtld.c#4 integrate
.. //depot/projects/mjexp/release/doc/en_US.ISO8859-1/relnotes/article.sgml#10 integrate
.. //depot/projects/mjexp/share/man/man4/mpt.4#2 integrate
.. //depot/projects/mjexp/share/man/man4/pci.4#2 integrate
.. //depot/projects/mjexp/share/misc/committers-ports.dot#3 integrate
.. //depot/projects/mjexp/sys/boot/pc98/boot0.5/Makefile#2 integrate
.. //depot/projects/mjexp/sys/boot/pc98/boot0.5/boot0.5.s#3 integrate
.. //depot/projects/mjexp/sys/boot/pc98/boot0.5/ldscript#1 branch
.. //depot/projects/mjexp/sys/boot/pc98/boot0.5/putssjis.s#1 branch
.. //depot/projects/mjexp/sys/boot/pc98/boot0.5/selector.s#2 integrate
.. //depot/projects/mjexp/sys/boot/pc98/boot0.5/start.s#2 integrate
.. //depot/projects/mjexp/sys/cam/scsi/scsi_sg.c#1 branch
.. //depot/projects/mjexp/sys/cam/scsi/scsi_sg.h#1 branch
.. //depot/projects/mjexp/sys/compat/linux/linux_ioctl.c#2 integrate
.. //depot/projects/mjexp/sys/compat/linux/linux_ioctl.h#2 integrate
.. //depot/projects/mjexp/sys/compat/opensolaris/kern/opensolaris_misc.c#1 branch
.. //depot/projects/mjexp/sys/compat/opensolaris/sys/misc.h#1 branch
.. //depot/projects/mjexp/sys/conf/NOTES#17 integrate
.. //depot/projects/mjexp/sys/conf/files#18 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/common/atomic/amd64/atomic.S#1 branch
.. //depot/projects/mjexp/sys/contrib/opensolaris/common/atomic/i386/atomic.S#1 branch
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/arch/amd64/atomic.S#2 delete
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/arch/i386/atomic.S#2 delete
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/arc.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/spa.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/spa_config.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/os/taskq.c#2 integrate
.. //depot/projects/mjexp/sys/contrib/opensolaris/uts/common/sys/fs/zfs.h#2 integrate
.. //depot/projects/mjexp/sys/dev/ata/ata-dma.c#4 integrate
.. //depot/projects/mjexp/sys/dev/cxgb/cxgb_adapter.h#3 integrate
.. //depot/projects/mjexp/sys/dev/cxgb/cxgb_lro.c#2 integrate
.. //depot/projects/mjexp/sys/dev/cxgb/cxgb_osdep.h#2 integrate
.. //depot/projects/mjexp/sys/dev/cxgb/cxgb_sge.c#3 integrate
.. //depot/projects/mjexp/sys/dev/cxgb/sys/mvec.h#1 branch
.. //depot/projects/mjexp/sys/dev/cxgb/sys/uipc_mvec.c#1 branch
.. //depot/projects/mjexp/sys/dev/mpt/mpt_cam.c#15 integrate
.. //depot/projects/mjexp/sys/dev/sound/pci/cmi.c#5 integrate
.. //depot/projects/mjexp/sys/kern/kern_jail.c#9 integrate
.. //depot/projects/mjexp/sys/modules/Makefile#9 integrate
.. //depot/projects/mjexp/sys/modules/cam/Makefile#2 integrate
.. //depot/projects/mjexp/sys/modules/cxgb/Makefile#2 integrate
.. //depot/projects/mjexp/sys/modules/zfs/Makefile#2 integrate
.. //depot/projects/mjexp/sys/netinet/libalias/alias_db.c#3 integrate
.. //depot/projects/mjexp/sys/netinet/libalias/alias_skinny.c#2 integrate
.. //depot/projects/mjexp/sys/sys/unistd.h#3 integrate
.. //depot/projects/mjexp/tools/regression/netinet/ipblock/Makefile#1 branch
.. //depot/projects/mjexp/tools/regression/netinet/ipblock/ipblock.c#1 branch
.. //depot/projects/mjexp/usr.bin/tar/read.c#4 integrate
.. //depot/projects/mjexp/usr.sbin/sa/pdb.c#2 integrate

Differences ...

==== //depot/projects/mjexp/cddl/lib/Makefile#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/cddl/lib/Makefile,v 1.1 2007/04/06 01:08:56 pjd Exp $
+# $FreeBSD: src/cddl/lib/Makefile,v 1.2 2007/04/07 19:12:09 des Exp $
 
 .include <bsd.own.mk>
 
@@ -11,10 +11,8 @@
 SUBDIR+=${_libzpool}
 .endif
 
-.if ${MACHINE_ARCH} == "i386"
-.if ${MACHINE} == "i386"
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
 _libzpool=	libzpool
 .endif
-.endif
 
 .include <bsd.subdir.mk>

==== //depot/projects/mjexp/cddl/lib/libzpool/Makefile#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/cddl/lib/libzpool/Makefile,v 1.1 2007/04/06 01:08:57 pjd Exp $
+# $FreeBSD: src/cddl/lib/libzpool/Makefile,v 1.2 2007/04/07 23:54:53 pjd Exp $
 
 .include "${.CURDIR}/../../../sys/contrib/opensolaris/uts/common/Makefile.files"
 
@@ -11,7 +11,7 @@
 # LIST_SRCS
 .PATH:	${.CURDIR}/../../../sys/contrib/opensolaris/uts/common/os
 # ATOMIC_SRCS
-.PATH:	${.CURDIR}/../../../sys/contrib/opensolaris/uts/common/arch/${MACHINE_ARCH}
+.PATH:	${.CURDIR}/../../../sys/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
 
 LIB=	zpool
 SHLIB_MAJOR?=1

==== //depot/projects/mjexp/cddl/usr.bin/Makefile#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/cddl/usr.bin/Makefile,v 1.1 2007/04/06 01:08:58 pjd Exp $
+# $FreeBSD: src/cddl/usr.bin/Makefile,v 1.2 2007/04/07 19:12:09 des Exp $
 
 .include <bsd.own.mk>
 
@@ -6,10 +6,8 @@
 SUBDIR=	${_ztest}
 .endif
 
-.if ${MACHINE_ARCH} == "i386"
-.if ${MACHINE} == "i386"
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
 _ztest=	ztest
 .endif
-.endif
 
 .include <bsd.subdir.mk>

==== //depot/projects/mjexp/cddl/usr.sbin/Makefile#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/cddl/usr.sbin/Makefile,v 1.1 2007/04/06 01:08:58 pjd Exp $
+# $FreeBSD: src/cddl/usr.sbin/Makefile,v 1.2 2007/04/07 19:12:09 des Exp $
 
 .include <bsd.own.mk>
 
@@ -7,10 +7,8 @@
 SUBDIR+=${_zdb}
 .endif
 
-.if ${MACHINE_ARCH} == "i386"
-.if ${MACHINE} == "i386"
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
 _zdb=	zdb
 .endif
-.endif
 
 .include <bsd.subdir.mk>

==== //depot/projects/mjexp/contrib/openpam/lib/openpam_readline.c#2 (text) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/openpam/lib/openpam_readline.c#3 $
+ * $Id: openpam_readline.c 380 2006-03-14 14:42:09Z des $
  */
 
 #include <ctype.h>
@@ -52,7 +52,7 @@
 char *
 openpam_readline(FILE *f, int *lineno, size_t *lenp)
 {
-	unsigned char *line;
+	char *line;
 	size_t len, size;
 	int ch;
 
@@ -63,7 +63,7 @@
 
 #define line_putch(ch) do { \
 	if (len >= size - 1) { \
-		unsigned char *tmp = realloc(line, size *= 2); \
+		char *tmp = realloc(line, size *= 2); \
 		if (tmp == NULL) \
 			goto fail; \
 		line = tmp; \
@@ -83,7 +83,7 @@
 		/* eof */
 		if (ch == EOF) {
 			/* remove trailing whitespace */
-			while (len > 0 && isspace(line[len - 1]))
+			while (len > 0 && isspace((int)line[len - 1]))
 				--len;
 			line[len] = '\0';
 			if (len == 0)
@@ -96,7 +96,7 @@
 				++*lineno;
 
 			/* remove trailing whitespace */
-			while (len > 0 && isspace(line[len - 1]))
+			while (len > 0 && isspace((int)line[len - 1]))
 				--len;
 			line[len] = '\0';
 			/* skip blank lines */

==== //depot/projects/mjexp/contrib/opensolaris/cmd/zpool/zpool_main.c#2 (text+ko) ====

@@ -1082,6 +1082,10 @@
 		    "incompatible version.\n"));
 		break;
 
+	case ZPOOL_STATUS_HOSTID_MISMATCH:
+		(void) printf(gettext("status: The pool was last accessed by "
+		    "another system.\n"));
+		break;
 	default:
 		/*
 		 * No other status can be seen when importing pools.
@@ -1098,6 +1102,10 @@
 			    "imported using its name or numeric identifier, "
 			    "though\n\tsome features will not be available "
 			    "without an explicit 'zpool upgrade'.\n"));
+		else if (reason == ZPOOL_STATUS_HOSTID_MISMATCH)
+			(void) printf(gettext("action: The pool can be "
+			    "imported using its name or numeric "
+			    "identifier and\n\tthe '-f' flag.\n"));
 		else
 			(void) printf(gettext("action: The pool can be "
 			    "imported using its name or numeric "
@@ -1187,10 +1195,37 @@
 		    "is formatted using a newer ZFS version\n"), name);
 		return (1);
 	} else if (state != POOL_STATE_EXPORTED && !force) {
-		(void) fprintf(stderr, gettext("cannot import '%s': pool "
-		    "may be in use from other system\n"), name);
-		(void) fprintf(stderr, gettext("use '-f' to import anyway\n"));
-		return (1);
+		uint64_t hostid;
+
+		if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID,
+		    &hostid) == 0) {
+			if ((unsigned long)hostid != gethostid()) {
+				char *hostname;
+				uint64_t timestamp;
+				time_t t;
+
+				verify(nvlist_lookup_string(config,
+				    ZPOOL_CONFIG_HOSTNAME, &hostname) == 0);
+				verify(nvlist_lookup_uint64(config,
+				    ZPOOL_CONFIG_TIMESTAMP, &timestamp) == 0);
+				t = timestamp;
+				(void) fprintf(stderr, gettext("cannot import "
+				    "'%s': pool may be in use from other "
+				    "system, it was last accessed by %s "
+				    "(hostid: 0x%lx) on %s"), name, hostname,
+				    (unsigned long)hostid,
+				    asctime(localtime(&t)));
+				(void) fprintf(stderr, gettext("use '-f' to "
+				    "import anyway\n"));
+				return (1);
+			}
+		} else {
+			(void) fprintf(stderr, gettext("cannot import '%s': "
+			    "pool may be in use from other system\n"), name);
+			(void) fprintf(stderr, gettext("use '-f' to import "
+			    "anyway\n"));
+			return (1);
+		}
 	}
 
 	if (zpool_import(g_zfs, config, newname, altroot) != 0)

==== //depot/projects/mjexp/contrib/opensolaris/cmd/ztest/ztest.c#2 (text+ko) ====

@@ -246,6 +246,8 @@
 #define	ZTEST_DIROBJ_BLOCKSIZE	(1 << 10)
 #define	ZTEST_DIRSIZE		256
 
+static void usage(boolean_t);
+
 /*
  * These libumem hooks provide a reasonable set of defaults for the allocator's
  * debugging facilities.
@@ -303,13 +305,17 @@
 		if (toupper(buf[0]) == ends[i])
 			break;
 	}
-	if (i == strlen(ends))
-		fatal(0, "invalid bytes suffix: %s", buf);
+	if (i == strlen(ends)) {
+		(void) fprintf(stderr, "ztest: invalid bytes suffix: %s\n",
+		    buf);
+		usage(B_FALSE);
+	}
 	if (buf[1] == '\0' || (toupper(buf[1]) == 'B' && buf[2] == '\0')) {
 		return (10*i);
 	}
-	fatal(0, "invalid bytes suffix: %s", buf);
-	return (-1);
+	(void) fprintf(stderr, "ztest: invalid bytes suffix: %s\n", buf);
+	usage(B_FALSE);
+	/* NOTREACHED */
 }
 
 static uint64_t
@@ -320,32 +326,40 @@
 
 	val = strtoull(buf, &end, 0);
 	if (end == buf) {
-		fatal(0, "bad numeric value: %s", buf);
+		(void) fprintf(stderr, "ztest: bad numeric value: %s\n", buf);
+		usage(B_FALSE);
 	} else if (end[0] == '.') {
 		double fval = strtod(buf, &end);
 		fval *= pow(2, str2shift(end));
-		if (fval > UINT64_MAX)
-			fatal(0, "value too large: %s", buf);
+		if (fval > UINT64_MAX) {
+			(void) fprintf(stderr, "ztest: value too large: %s\n",
+			    buf);
+			usage(B_FALSE);
+		}
 		val = (uint64_t)fval;
 	} else {
 		int shift = str2shift(end);
-		if (shift >= 64 || (val << shift) >> shift != val)
-			fatal(0, "value too large: %s", buf);
+		if (shift >= 64 || (val << shift) >> shift != val) {
+			(void) fprintf(stderr, "ztest: value too large: %s\n",
+			    buf);
+			usage(B_FALSE);
+		}
 		val <<= shift;
 	}
 	return (val);
 }
 
 static void
-usage(void)
+usage(boolean_t requested)
 {
 	char nice_vdev_size[10];
 	char nice_gang_bang[10];
+	FILE *fp = requested ? stdout : stderr;
 
 	nicenum(zopt_vdev_size, nice_vdev_size);
 	nicenum(zio_gang_bang, nice_gang_bang);
 
-	(void) printf("Usage: %s\n"
+	(void) fprintf(fp, "Usage: %s\n"
 	    "\t[-v vdevs (default: %llu)]\n"
 	    "\t[-s size_of_each_vdev (default: %s)]\n"
 	    "\t[-a alignment_shift (default: %d) (use 0 for random)]\n"
@@ -364,6 +378,7 @@
 	    "\t[-T time] total run time (default: %llu sec)\n"
 	    "\t[-P passtime] time per pass (default: %llu sec)\n"
 	    "\t[-z zil failure rate (default: fail every 2^%llu allocs)]\n"
+	    "\t[-h] (print help)\n"
 	    "",
 	    cmdname,
 	    (u_longlong_t)zopt_vdevs,		/* -v */
@@ -382,7 +397,7 @@
 	    (u_longlong_t)zopt_time,		/* -T */
 	    (u_longlong_t)zopt_passtime,	/* -P */
 	    (u_longlong_t)zio_zil_fail_shift);	/* -z */
-	exit(1);
+	exit(requested ? 0 : 1);
 }
 
 static uint64_t
@@ -422,7 +437,7 @@
 	zio_zil_fail_shift = 5;
 
 	while ((opt = getopt(argc, argv,
-	    "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:z:")) != EOF) {
+	    "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:z:h")) != EOF) {
 		value = 0;
 		switch (opt) {
 		    case 'v':
@@ -496,9 +511,12 @@
 		    case 'z':
 			zio_zil_fail_shift = MIN(value, 16);
 			break;
+		    case 'h':
+			usage(B_TRUE);
+			break;
 		    case '?':
 		    default:
-			usage();
+			usage(B_FALSE);
 			break;
 		}
 	}

==== //depot/projects/mjexp/contrib/opensolaris/lib/libzfs/common/libzfs.h#2 (text+ko) ====

@@ -98,6 +98,7 @@
 	EZFS_POOLPROPS,		/* couldn't retrieve pool props */
 	EZFS_POOL_NOTSUP,	/* ops not supported for this type of pool */
 	EZFS_POOL_INVALARG,	/* invalid argument for this pool operation */
+	EZFS_NAMETOOLONG,	/* dataset name is too long */
 	EZFS_UNKNOWN
 };
 
@@ -192,6 +193,7 @@
 	ZPOOL_STATUS_CORRUPT_DATA,	/* data errors in user (meta)data */
 	ZPOOL_STATUS_FAILING_DEV,	/* device experiencing errors */
 	ZPOOL_STATUS_VERSION_NEWER,	/* newer on-disk version */
+	ZPOOL_STATUS_HOSTID_MISMATCH,	/* last accessed by another system */
 
 	/*
 	 * The following are not faults per se, but still an error possibly

==== //depot/projects/mjexp/contrib/opensolaris/lib/libzfs/common/libzfs_import.c#2 (text+ko) ====

@@ -379,7 +379,7 @@
 	uint_t i, nspares;
 	boolean_t config_seen;
 	uint64_t best_txg;
-	char *name;
+	char *name, *hostname;
 	zfs_cmd_t zc = { 0 };
 	uint64_t version, guid;
 	size_t len;
@@ -388,6 +388,7 @@
 	nvlist_t **child = NULL;
 	uint_t c;
 	boolean_t isactive;
+	uint64_t hostid;
 
 	if (nvlist_alloc(&ret, 0, 0) != 0)
 		goto nomem;
@@ -430,6 +431,8 @@
 				 * 	pool guid
 				 * 	name
 				 * 	pool state
+				 *	hostid (if available)
+				 *	hostname (if available)
 				 */
 				uint64_t state;
 
@@ -453,6 +456,20 @@
 				if (nvlist_add_uint64(config,
 				    ZPOOL_CONFIG_POOL_STATE, state) != 0)
 					goto nomem;
+				hostid = 0;
+				if (nvlist_lookup_uint64(tmp,
+				    ZPOOL_CONFIG_HOSTID, &hostid) == 0) {
+					if (nvlist_add_uint64(config,
+					    ZPOOL_CONFIG_HOSTID, hostid) != 0)
+						goto nomem;
+					verify(nvlist_lookup_string(tmp,
+					    ZPOOL_CONFIG_HOSTNAME,
+					    &hostname) == 0);
+					if (nvlist_add_string(config,
+					    ZPOOL_CONFIG_HOSTNAME,
+					    hostname) != 0)
+						goto nomem;
+				}
 
 				config_seen = B_TRUE;
 			}
@@ -622,6 +639,20 @@
 		}
 
 		/*
+		 * Restore the original information read from the actual label.
+		 */
+		(void) nvlist_remove(config, ZPOOL_CONFIG_HOSTID,
+		    DATA_TYPE_UINT64);
+		(void) nvlist_remove(config, ZPOOL_CONFIG_HOSTNAME,
+		    DATA_TYPE_STRING);
+		if (hostid != 0) {
+			verify(nvlist_add_uint64(config, ZPOOL_CONFIG_HOSTID,
+			    hostid) == 0);
+			verify(nvlist_add_string(config, ZPOOL_CONFIG_HOSTNAME,
+			    hostname) == 0);
+		}
+
+		/*
 		 * Add this pool to the list of configs.
 		 */
 		verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME,

==== //depot/projects/mjexp/contrib/opensolaris/lib/libzfs/common/libzfs_status.c#2 (text+ko) ====

@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -43,6 +43,7 @@
 
 #include <libzfs.h>
 #include <string.h>
+#include <unistd.h>
 #include "libzfs_impl.h"
 
 /*
@@ -50,7 +51,7 @@
  * in libzfs.h.  Note that there are some status results which go past the end
  * of this table, and hence have no associated message ID.
  */
-static char *msgid_table[] = {
+static char *zfs_msgid_table[] = {
 	"ZFS-8000-14",
 	"ZFS-8000-2Q",
 	"ZFS-8000-3C",
@@ -60,7 +61,8 @@
 	"ZFS-8000-72",
 	"ZFS-8000-8A",
 	"ZFS-8000-9P",
-	"ZFS-8000-A5"
+	"ZFS-8000-A5",
+	"ZFS-8000-EY"
 };
 
 /*
@@ -69,7 +71,7 @@
  * and the article referred to by 'zpool status' must match that indicated by
  * the syslog error message.  We override missing data as well as corrupt pool.
  */
-static char *msgid_table_active[] = {
+static char *zfs_msgid_table_active[] = {
 	"ZFS-8000-14",
 	"ZFS-8000-D3",		/* overridden */
 	"ZFS-8000-D3",		/* overridden */
@@ -82,7 +84,7 @@
 	"ZFS-8000-CS",		/* overridden */
 };
 
-#define	NMSGID	(sizeof (msgid_table) / sizeof (msgid_table[0]))
+#define	NMSGID	(sizeof (zfs_msgid_table) / sizeof (zfs_msgid_table[0]))
 
 /* ARGSUSED */
 static int
@@ -178,6 +180,8 @@
 	uint_t vsc;
 	uint64_t nerr;
 	uint64_t version;
+	uint64_t stateval;
+	uint64_t hostid = 0;
 
 	verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
 	    &version) == 0);
@@ -185,6 +189,16 @@
 	    &nvroot) == 0);
 	verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_STATS,
 	    (uint64_t **)&vs, &vsc) == 0);
+	verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
+	    &stateval) == 0);
+	(void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID, &hostid);
+
+	/*
+	 * Pool last accessed by another system.
+	 */
+	if (hostid != 0 && (unsigned long)hostid != gethostid() &&
+	    stateval == POOL_STATE_ACTIVE)
+		return (ZPOOL_STATUS_HOSTID_MISMATCH);
 
 	/*
 	 * Newer on-disk version.
@@ -270,7 +284,7 @@
 	if (ret >= NMSGID)
 		*msgid = NULL;
 	else
-		*msgid = msgid_table_active[ret];
+		*msgid = zfs_msgid_table_active[ret];
 
 	return (ret);
 }
@@ -283,7 +297,7 @@
 	if (ret >= NMSGID)
 		*msgid = NULL;
 	else
-		*msgid = msgid_table[ret];
+		*msgid = zfs_msgid_table[ret];
 
 	return (ret);
 }

==== //depot/projects/mjexp/contrib/opensolaris/lib/libzfs/common/libzfs_util.c#2 (text+ko) ====

@@ -167,6 +167,8 @@
 	case EZFS_POOL_INVALARG:
 		return (dgettext(TEXT_DOMAIN, "invalid argument for "
 		    "this pool operation"));
+	case EZFS_NAMETOOLONG:
+		return (dgettext(TEXT_DOMAIN, "dataset name is too long"));
 	case EZFS_UNKNOWN:
 		return (dgettext(TEXT_DOMAIN, "unknown error"));
 	default:
@@ -306,6 +308,11 @@
 		    "dataset is busy"));
 		zfs_verror(hdl, EZFS_BUSY, fmt, ap);
 		break;
+
+	case ENAMETOOLONG:
+		zfs_verror(hdl, EZFS_NAMETOOLONG, fmt, ap);
+		break;
+
 	default:
 		zfs_error_aux(hdl, strerror(errno));
 		zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
@@ -490,6 +497,21 @@
 	hdl->libzfs_printerr = printerr;
 }
 
+static int
+libzfs_load(void)
+{
+	int error;
+
+	if (modfind("zfs") < 0) {
+		/* Not present in kernel, try loading it. */
+		if (kldload("zfs") < 0 || modfind("zfs") < 0) {
+			if (errno != EEXIST)
+				return (error);
+		}
+	}
+	return (0);
+}
+
 libzfs_handle_t *
 libzfs_init(void)
 {
@@ -500,8 +522,12 @@
 	}
 
 	if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) {
-		free(hdl);
-		return (NULL);
+		if (libzfs_load() == 0)
+			hdl->libzfs_fd = open(ZFS_DEV, O_RDWR);
+		if (hdl->libzfs_fd < 0) {
+			free(hdl);
+			return (NULL);
+		}
 	}
 
 	if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) {

==== //depot/projects/mjexp/contrib/opensolaris/lib/libzpool/common/kernel.c#2 (text+ko) ====

@@ -37,6 +37,7 @@
 #include <sys/processor.h>
 #include <sys/zfs_context.h>
 #include <sys/zmod.h>
+#include <sys/utsname.h>
 
 /*
  * Emulation of kernel services in userland.
@@ -45,6 +46,11 @@
 int hz = 119;	/* frequency when using gethrtime() >> 23 for lbolt */
 uint64_t physmem;
 vnode_t *rootdir = (vnode_t *)0xabcd1234;
+char hw_serial[11];
+
+struct utsname utsname = {
+	"userland", "libzpool", "1", "1", "na"
+};
 
 /*
  * =========================================================================
@@ -770,6 +776,17 @@
 	return (random_get_bytes_common(ptr, len, "/dev/urandom"));
 }
 
+int
+ddi_strtoul(const char *hw_serial, char **nptr, int base, unsigned long *result)
+{
+	char *end;
+
+	*result = strtoul(hw_serial, &end, base);
+	if (*result == 0)
+		return (errno);
+	return (0);
+}
+
 /*
  * =========================================================================
  * kernel emulation setup & teardown
@@ -795,6 +812,8 @@
 	dprintf("physmem = %llu pages (%.2f GB)\n", physmem,
 	    (double)physmem * sysconf(_SC_PAGE_SIZE) / (1ULL << 30));
 
+	snprintf(hw_serial, sizeof (hw_serial), "%ld", gethostid());
+
 	spa_init(mode);
 }
 

==== //depot/projects/mjexp/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h#2 (text+ko) ====

@@ -436,6 +436,14 @@
 #define	zone_dataset_visible(x, y)	(1)
 #define	INGLOBALZONE(z)			(1)
 
+/*
+ * Hostname information
+ */
+extern struct utsname utsname;
+extern char hw_serial[];
+extern int ddi_strtoul(const char *str, char **nptr, int base,
+    unsigned long *result);
+
 #ifdef	__cplusplus
 }
 #endif

==== //depot/projects/mjexp/etc/devd.conf#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/devd.conf,v 1.35 2007/02/15 16:38:10 imp Exp $
+# $FreeBSD: src/etc/devd.conf,v 1.37 2007/04/08 16:05:23 pjd Exp $
 #
 # Refer to devd.conf(5) and devd(8) man pages for the details on how to
 # run and configure devd.
@@ -208,6 +208,37 @@
 	action "logger -p kern.emerg 'WARNING: system temperature too high, shutting down soon!'";
 };
 
+# Sample ZFS problem reports handling.
+notify 10 {
+	match "system"		"ZFS";
+	match "type"		"zpool";
+	action "logger -p kern.err 'ZFS: failed to load zpool $pool'";
+};
+
+notify 10 {
+	match "system"		"ZFS";
+	match "type"		"vdev";
+	action "logger -p kern.err 'ZFS: vdev failure, zpool=$pool type=$type'";
+};
+
+notify 10 {
+	match "system"		"ZFS";
+	match "type"		"data";
+	action "logger -p kern.warn 'ZFS: zpool I/O failure, zpool=$pool error=$zio_err'";
+};
+
+notify 10 {
+	match "system"		"ZFS";
+	match "type"		"io";
+	action "logger -p kern.warn 'ZFS: vdev I/O failure, zpool=$pool path=$vdev_path offset=$zio_offset size=$zio_size error=$zio_err'";
+};
+
+notify 10 {
+	match "system"		"ZFS";
+	match "type"		"checksum";
+	action "logger -p kern.warn 'ZFS: checksum mismatch, zpool=$pool path=$vdev_path offset=$zio_offset size=$zio_size'";
+};
+
 /* EXAMPLES TO END OF FILE
 
 # The following might be an example of something that a vendor might

==== //depot/projects/mjexp/include/stdio.h#3 (text+ko) ====

@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)stdio.h	8.5 (Berkeley) 4/29/95
- * $FreeBSD: src/include/stdio.h,v 1.59 2007/04/05 21:10:53 pjd Exp $
+ * $FreeBSD: src/include/stdio.h,v 1.60 2007/04/07 16:02:30 pjd Exp $
  */
 
 #ifndef	_STDIO_H_
@@ -200,12 +200,6 @@
 #ifndef SEEK_END
 #define	SEEK_END	2	/* set file offset to EOF plus offset */
 #endif
-#ifndef SEEK_DATA
-#define	SEEK_DATA	3	/* set file offset to next data past offset */
-#endif
-#ifndef SEEK_HOLE
-#define	SEEK_HOLE	4	/* set file offset to next hole past offset */
-#endif
 
 #define	stdin	__stdinp
 #define	stdout	__stdoutp

==== //depot/projects/mjexp/lib/libarchive/Makefile#7 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libarchive/Makefile,v 1.63 2007/04/05 15:51:19 cperciva Exp $
+# $FreeBSD: src/lib/libarchive/Makefile,v 1.64 2007/04/07 05:54:23 kientzle Exp $
 
 LIB=	archive
 DPADD=	${LIBBZ2} ${LIBZ}
@@ -9,7 +9,7 @@
 #  Major: Bumped ONLY when API/ABI breakage happens (see SHLIB_MAJOR)
 #  Minor: Bumped when significant new features are added
 #  Revision: Bumped on any notable change
-VERSION= 2.0.25
+VERSION= 2.0.27
 
 ARCHIVE_API_MAJOR!=	echo ${VERSION} | sed -e 's/[^0-9]/./g' -e 's/\..*//'
 ARCHIVE_API_MINOR!=	echo ${VERSION} | sed -e 's/[^0-9]/./g' -e 's/[0-9]*\.//' -e 's/\..*//'
@@ -58,6 +58,7 @@
 	archive_read_support_compression_gzip.c		\
 	archive_read_support_compression_none.c		\
 	archive_read_support_format_all.c		\
+	archive_read_support_format_ar.c		\
 	archive_read_support_format_cpio.c		\
 	archive_read_support_format_empty.c		\
 	archive_read_support_format_iso9660.c		\
@@ -78,6 +79,7 @@
 	archive_write_set_compression_gzip.c		\
 	archive_write_set_compression_none.c		\
 	archive_write_set_format.c			\
+	archive_write_set_format_ar.c			\
 	archive_write_set_format_by_name.c		\
 	archive_write_set_format_cpio.c			\
 	archive_write_set_format_pax.c			\

==== //depot/projects/mjexp/lib/libarchive/archive_read.3#8 (text+ko) ====

@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.32 2007/04/05 15:51:19 cperciva Exp $
+.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.33 2007/04/07 05:53:11 kientzle Exp $
 .\"
 .Dd August 19, 2006
 .Dt archive_read 3
@@ -230,7 +230,10 @@
 to skip all of the data for this archive entry.
 .\" #if ARCHIVE_API_VERSION < 3
 .It Fn archive_read_data_into_buffer
-This function is deprecated and should not be used.
+This function is deprecated and will be removed.
+Use
+.Fn archive_read_data
+instead.
 .\" #endif
 .It Fn archive_read_data_into_fd
 A convenience function that repeatedly calls

==== //depot/projects/mjexp/lib/libarchive/archive_read_extract.c#7 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.54 2007/03/11 10:29:52 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.55 2007/04/07 03:37:59 cperciva Exp $");
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -98,10 +98,6 @@
 	if (r == ARCHIVE_OK)
 		/* If there's an FD, pour data into it. */
 		r = copy_data(_a, a->extract->ad);
-	if (r != ARCHIVE_OK)
-		archive_set_error(&a->archive,
-		    archive_errno(extract->ad),
-		    "%s", archive_error_string(extract->ad));
 	r2 = archive_write_finish_entry(a->extract->ad);
 	/* Use the first message. */
 	if (r2 != ARCHIVE_OK && r == ARCHIVE_OK)
@@ -141,8 +137,11 @@
 		if (r != ARCHIVE_OK)
 			return (r);
 		r = archive_write_data_block(aw, buff, size, offset);
-		if (r != ARCHIVE_OK)
+		if (r != ARCHIVE_OK) {
+			archive_set_error(ar, archive_errno(aw),
+			    "%s", archive_error_string(aw));
 			return (r);
+		}
 	}
 }
 

==== //depot/projects/mjexp/lib/libarchive/archive_read_support_format_all.c#4 (text+ko) ====

@@ -24,13 +24,14 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_all.c,v 1.8 2007/02/01 06:18:16 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_all.c,v 1.9 2007/04/07 05:54:23 kientzle Exp $");
 
 #include "archive.h"
 
 int
 archive_read_support_format_all(struct archive *a)
 {
+	archive_read_support_format_ar(a);
 	archive_read_support_format_cpio(a);
 	archive_read_support_format_empty(a);
 	archive_read_support_format_iso9660(a);

==== //depot/projects/mjexp/lib/libarchive/archive_write_disk.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.5 2007/04/02 00:32:03 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.6 2007/04/07 19:35:02 kientzle Exp $");
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -1721,7 +1721,7 @@
 set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
     mode_t mode, unsigned long set, unsigned long clear)
 {
-	(void)ad; /* UNUSED */
+	(void)a; /* UNUSED */
 	(void)fd; /* UNUSED */
 	(void)name; /* UNUSED */
 	(void)mode; /* UNUSED */

==== //depot/projects/mjexp/lib/libarchive/test/Makefile#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.2 2007/03/08 06:09:27 kientzle Exp $
+# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.3 2007/04/07 05:54:23 kientzle Exp $
 
 TESTS= \
 	test_acl_basic.c			\
@@ -7,6 +7,7 @@
 	test_bad_fd.c				\
 	test_read_data_large.c			\
 	test_read_extract.c			\
+	test_read_format_ar.c			\
 	test_read_format_cpio_bin.c		\
 	test_read_format_cpio_bin_Z.c		\
 	test_read_format_cpio_bin_bz2.c		\
@@ -30,6 +31,7 @@
 	test_write_disk.c			\
 	test_write_disk_perms.c			\
 	test_write_disk_secure.c		\
+	test_write_format_ar.c			\
 	test_write_format_cpio_empty.c		\
 	test_write_format_shar_empty.c		\
 	test_write_format_tar.c			\
@@ -66,4 +68,4 @@
 	-chmod -R +w /tmp/libarchive_test.*
 	rm -rf /tmp/libarchive_test.*
 
-.include <bsd.prog.mk>+.include <bsd.prog.mk>

==== //depot/projects/mjexp/lib/libc/sys/ptrace.2#3 (text+ko) ====

@@ -1,4 +1,4 @@
-.\" $FreeBSD: src/lib/libc/sys/ptrace.2,v 1.38 2006/11/09 11:27:18 trhodes Exp $
+.\" $FreeBSD: src/lib/libc/sys/ptrace.2,v 1.39 2007/04/07 03:16:23 emaste Exp $
 .\"	$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\"
 .\" This file is in the public domain.
@@ -299,6 +299,15 @@
 This allows the structure to grow without affecting older programs.
 .It PT_GETLWPLIST
 This request can be used to get the current thread list.
+A pointer to an array of type
+.Vt lwpid_t
+should be passed in
+.Fa addr ,
+with the array size specified by
+.Fa data .
+The return value from
+.Fn ptrace
+is the count of array entries filled in.
 .El
 .Pp
 Additionally, machine-specific requests can exist.

==== //depot/projects/mjexp/libexec/rtld-elf/i386/Symbol.map#2 (text+ko) ====

@@ -1,12 +1,5 @@
-# $FreeBSD: src/libexec/rtld-elf/i386/Symbol.map,v 1.1 2007/04/03 19:01:06 kan Exp $
+# $FreeBSD: src/libexec/rtld-elf/i386/Symbol.map,v 1.2 2007/04/07 23:23:10 kan Exp $
 
 FBSD_1.0 {
     ___tls_get_addr;
 };
-
-# This is our private namespace.  Any global interfaces that are
-# strictly for use only by other FreeBSD applications and libraries

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list