changeset 3912:f6891a60bd72

PSARC 2007/083 ZFS bootable datasets 4929890 ZFS Boot support for the x86 platform 6479807 pools need properties 6531774 reserve bits in directory entry for file type
author lling
date Wed, 28 Mar 2007 12:48:13 -0700
parents 94df594513c7
children 661924bac568
files usr/src/cmd/truss/codes.c usr/src/cmd/zdb/zdb.c usr/src/cmd/zfs/zfs_main.c usr/src/cmd/zpool/zpool_iter.c usr/src/cmd/zpool/zpool_main.c usr/src/cmd/zpool/zpool_util.h usr/src/common/zfs/zfs_prop.c usr/src/grub/grub-0.95/AUTHORS usr/src/grub/grub-0.95/configure usr/src/grub/grub-0.95/configure.ac usr/src/grub/grub-0.95/grub/Makefile.am usr/src/grub/grub-0.95/grub/Makefile.in usr/src/grub/grub-0.95/grub/Makefile.solaris usr/src/grub/grub-0.95/grub/asmstub.c usr/src/grub/grub-0.95/stage2/Makefile.am usr/src/grub/grub-0.95/stage2/Makefile.in usr/src/grub/grub-0.95/stage2/Makefile.solaris usr/src/grub/grub-0.95/stage2/boot.c usr/src/grub/grub-0.95/stage2/builtins.c usr/src/grub/grub-0.95/stage2/char_io.c usr/src/grub/grub-0.95/stage2/common.c usr/src/grub/grub-0.95/stage2/disk_io.c usr/src/grub/grub-0.95/stage2/filesys.h usr/src/grub/grub-0.95/stage2/fsys_zfs.c usr/src/grub/grub-0.95/stage2/fsys_zfs.h usr/src/grub/grub-0.95/stage2/shared.h usr/src/grub/grub-0.95/stage2/ufs.h usr/src/grub/grub-0.95/stage2/zfs-include/dmu.h usr/src/grub/grub-0.95/stage2/zfs-include/dmu_objset.h usr/src/grub/grub-0.95/stage2/zfs-include/dnode.h usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dataset.h usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dir.h usr/src/grub/grub-0.95/stage2/zfs-include/spa.h usr/src/grub/grub-0.95/stage2/zfs-include/uberblock_impl.h usr/src/grub/grub-0.95/stage2/zfs-include/vdev_impl.h usr/src/grub/grub-0.95/stage2/zfs-include/zap_impl.h usr/src/grub/grub-0.95/stage2/zfs-include/zap_leaf.h usr/src/grub/grub-0.95/stage2/zfs-include/zfs.h usr/src/grub/grub-0.95/stage2/zfs-include/zfs_acl.h usr/src/grub/grub-0.95/stage2/zfs-include/zfs_znode.h usr/src/grub/grub-0.95/stage2/zfs-include/zil.h usr/src/grub/grub-0.95/stage2/zfs-include/zio.h usr/src/grub/grub-0.95/stage2/zfs-include/zio_checksum.h usr/src/grub/grub-0.95/stage2/zfs_fletcher.c usr/src/grub/grub-0.95/stage2/zfs_lzjb.c usr/src/grub/grub-0.95/stage2/zfs_sha256.c usr/src/lib/libzfs/common/libzfs.h usr/src/lib/libzfs/common/libzfs_dataset.c usr/src/lib/libzfs/common/libzfs_impl.h usr/src/lib/libzfs/common/libzfs_pool.c usr/src/lib/libzfs/common/libzfs_util.c usr/src/lib/libzfs/common/mapfile-vers usr/src/lib/libzpool/common/kernel.c usr/src/lib/libzpool/common/sys/zfs_context.h usr/src/pkgdefs/SUNWgrub/prototype_i386 usr/src/pkgdefs/SUNWgrubS/prototype_i386 usr/src/uts/common/fs/vfs.c usr/src/uts/common/fs/zfs/dmu.c usr/src/uts/common/fs/zfs/dsl_dataset.c usr/src/uts/common/fs/zfs/spa.c usr/src/uts/common/fs/zfs/spa_config.c usr/src/uts/common/fs/zfs/spa_misc.c usr/src/uts/common/fs/zfs/sys/dmu.h usr/src/uts/common/fs/zfs/sys/dsl_dataset.h usr/src/uts/common/fs/zfs/sys/spa.h usr/src/uts/common/fs/zfs/sys/spa_impl.h usr/src/uts/common/fs/zfs/sys/zfs_znode.h usr/src/uts/common/fs/zfs/zfs_dir.c usr/src/uts/common/fs/zfs/zfs_ioctl.c usr/src/uts/common/fs/zfs/zfs_vfsops.c usr/src/uts/common/fs/zfs/zfs_vnops.c usr/src/uts/common/krtld/kobj.c usr/src/uts/common/krtld/kobj_stubs.c usr/src/uts/common/krtld/mapfile usr/src/uts/common/os/modsysfile.c usr/src/uts/common/sys/fs/zfs.h usr/src/uts/common/sys/kobj.h usr/src/uts/common/sys/sysconf.h usr/src/uts/intel/sys/bootconf.h usr/src/uts/sparc/krtld/mapfile usr/src/uts/sun/sys/bootconf.h
diffstat 81 files changed, 5399 insertions(+), 547 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/truss/codes.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/cmd/truss/codes.c	Wed Mar 28 12:48:13 2007 -0700
@@ -918,6 +918,10 @@
 		"zfs_cmd_t" },
 	{ (uint_t)ZFS_IOC_OBJ_TO_PATH,		"ZFS_IOC_OBJ_TO_PATH",
 		"zfs_cmd_t" },
+	{ (uint_t)ZFS_IOC_POOL_SET_PROPS,	"ZFS_IOC_POOL_SET_PROPS",
+		"zfs_cmd_t" },
+	{ (uint_t)ZFS_IOC_POOL_GET_PROPS,	"ZFS_IOC_POOL_GET_PROPS",
+		"zfs_cmd_t" },
 
 	/* kssl ioctls */
 	{ (uint_t)KSSL_ADD_ENTRY,		"KSSL_ADD_ENTRY",
@@ -988,7 +992,7 @@
 			    code & 0xff);
 		else if (isascii(c_lo_nm) && isprint(c_lo_nm))
 			(void) sprintf(pri->code_buf, "(('%c'<<8)|%d)",
-				c_lo_nm, code & 0xff);
+			    c_lo_nm, code & 0xff);
 		else if (code & (IOC_VOID|IOC_INOUT))
 			ioctl_ioccom(pri->code_buf, sizeof (pri->code_buf),
 			    code, c_mid, c_lo, code & 0xff);
--- a/usr/src/cmd/zdb/zdb.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/cmd/zdb/zdb.c	Wed Mar 28 12:48:13 2007 -0700
@@ -887,6 +887,7 @@
 	dump_zap,		/* persistent error log		*/
 	dump_uint8,		/* SPA history			*/
 	dump_uint64,		/* SPA history offsets		*/
+	dump_zap,		/* Pool properties		*/
 };
 
 static void
@@ -931,11 +932,11 @@
 
 	if (doi.doi_checksum != ZIO_CHECKSUM_INHERIT || verbosity >= 6)
 		(void) snprintf(aux + strlen(aux), sizeof (aux), " (K=%s)",
-		zio_checksum_table[doi.doi_checksum].ci_name);
+		    zio_checksum_table[doi.doi_checksum].ci_name);
 
 	if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6)
 		(void) snprintf(aux + strlen(aux), sizeof (aux), " (Z=%s)",
-		zio_compress_table[doi.doi_compress].ci_name);
+		    zio_compress_table[doi.doi_compress].ci_name);
 
 	(void) printf("%10lld  %3u  %5s  %5s  %5s  %5s  %s%s\n",
 	    (u_longlong_t)object, doi.doi_indirection, iblk, dblk, lsize,
@@ -1440,7 +1441,7 @@
 		    (u_longlong_t)zb->zb_objset,
 		    (u_longlong_t)zb->zb_object,
 		    (u_longlong_t)blkid2offset(bc->bc_dnode,
-			zb->zb_level, zb->zb_blkid),
+		    zb->zb_level, zb->zb_blkid),
 		    blkbuf);
 	}
 
--- a/usr/src/cmd/zfs/zfs_main.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/cmd/zfs/zfs_main.c	Wed Mar 28 12:48:13 2007 -0700
@@ -875,195 +875,6 @@
  *  Prints properties for the given datasets.  The user can control which
  *  columns to display as well as which property types to allow.
  */
-typedef struct get_cbdata {
-	int cb_sources;
-	int cb_columns[4];
-	int cb_colwidths[5];
-	boolean_t cb_scripted;
-	boolean_t cb_literal;
-	boolean_t cb_first;
-	zfs_proplist_t *cb_proplist;
-} get_cbdata_t;
-
-#define	GET_COL_NAME		1
-#define	GET_COL_PROPERTY	2
-#define	GET_COL_VALUE		3
-#define	GET_COL_SOURCE		4
-
-/*
- * Print the column headers for 'zfs get'.
- */
-static void
-print_get_headers(get_cbdata_t *cbp)
-{
-	zfs_proplist_t *pl = cbp->cb_proplist;
-	int i;
-	char *title;
-	size_t len;
-
-	cbp->cb_first = B_FALSE;
-	if (cbp->cb_scripted)
-		return;
-
-	/*
-	 * Start with the length of the column headers.
-	 */
-	cbp->cb_colwidths[GET_COL_NAME] = strlen(gettext("NAME"));
-	cbp->cb_colwidths[GET_COL_PROPERTY] = strlen(gettext("PROPERTY"));
-	cbp->cb_colwidths[GET_COL_VALUE] = strlen(gettext("VALUE"));
-	cbp->cb_colwidths[GET_COL_SOURCE] = strlen(gettext("SOURCE"));
-
-	/*
-	 * Go through and calculate the widths for each column.  For the
-	 * 'source' column, we kludge it up by taking the worst-case scenario of
-	 * inheriting from the longest name.  This is acceptable because in the
-	 * majority of cases 'SOURCE' is the last column displayed, and we don't
-	 * use the width anyway.  Note that the 'VALUE' column can be oversized,
-	 * if the name of the property is much longer the any values we find.
-	 */
-	for (pl = cbp->cb_proplist; pl != NULL; pl = pl->pl_next) {
-		/*
-		 * 'PROPERTY' column
-		 */
-		if (pl->pl_prop != ZFS_PROP_INVAL) {
-			len = strlen(zfs_prop_to_name(pl->pl_prop));
-			if (len > cbp->cb_colwidths[GET_COL_PROPERTY])
-				cbp->cb_colwidths[GET_COL_PROPERTY] = len;
-		} else {
-			len = strlen(pl->pl_user_prop);
-			if (len > cbp->cb_colwidths[GET_COL_PROPERTY])
-				cbp->cb_colwidths[GET_COL_PROPERTY] = len;
-		}
-
-		/*
-		 * 'VALUE' column
-		 */
-		if ((pl->pl_prop != ZFS_PROP_NAME || !pl->pl_all) &&
-		    pl->pl_width > cbp->cb_colwidths[GET_COL_VALUE])
-			cbp->cb_colwidths[GET_COL_VALUE] = pl->pl_width;
-
-		/*
-		 * 'NAME' and 'SOURCE' columns
-		 */
-		if (pl->pl_prop == ZFS_PROP_NAME &&
-		    pl->pl_width > cbp->cb_colwidths[GET_COL_NAME]) {
-			cbp->cb_colwidths[GET_COL_NAME] = pl->pl_width;
-			cbp->cb_colwidths[GET_COL_SOURCE] = pl->pl_width +
-			    strlen(gettext("inherited from"));
-		}
-	}
-
-	/*
-	 * Now go through and print the headers.
-	 */
-	for (i = 0; i < 4; i++) {
-		switch (cbp->cb_columns[i]) {
-		case GET_COL_NAME:
-			title = gettext("NAME");
-			break;
-		case GET_COL_PROPERTY:
-			title = gettext("PROPERTY");
-			break;
-		case GET_COL_VALUE:
-			title = gettext("VALUE");
-			break;
-		case GET_COL_SOURCE:
-			title = gettext("SOURCE");
-			break;
-		default:
-			title = NULL;
-		}
-
-		if (title != NULL) {
-			if (i == 3 || cbp->cb_columns[i + 1] == 0)
-				(void) printf("%s", title);
-			else
-				(void) printf("%-*s  ",
-				    cbp->cb_colwidths[cbp->cb_columns[i]],
-				    title);
-		}
-	}
-	(void) printf("\n");
-}
-
-/*
- * Display a single line of output, according to the settings in the callback
- * structure.
- */
-static void
-print_one_property(zfs_handle_t *zhp, get_cbdata_t *cbp, const char *propname,
-    const char *value, zfs_source_t sourcetype, const char *source)
-{
-	int i;
-	const char *str;
-	char buf[128];
-
-	/*
-	 * Ignore those source types that the user has chosen to ignore.
-	 */
-	if ((sourcetype & cbp->cb_sources) == 0)
-		return;
-
-	if (cbp->cb_first)
-		print_get_headers(cbp);
-
-	for (i = 0; i < 4; i++) {
-		switch (cbp->cb_columns[i]) {
-		case GET_COL_NAME:
-			str = zfs_get_name(zhp);
-			break;
-
-		case GET_COL_PROPERTY:
-			str = propname;
-			break;
-
-		case GET_COL_VALUE:
-			str = value;
-			break;
-
-		case GET_COL_SOURCE:
-			switch (sourcetype) {
-			case ZFS_SRC_NONE:
-				str = "-";
-				break;
-
-			case ZFS_SRC_DEFAULT:
-				str = "default";
-				break;
-
-			case ZFS_SRC_LOCAL:
-				str = "local";
-				break;
-
-			case ZFS_SRC_TEMPORARY:
-				str = "temporary";
-				break;
-
-			case ZFS_SRC_INHERITED:
-				(void) snprintf(buf, sizeof (buf),
-				    "inherited from %s", source);
-				str = buf;
-				break;
-			}
-			break;
-
-		default:
-			continue;
-		}
-
-		if (cbp->cb_columns[i + 1] == 0)
-			(void) printf("%s", str);
-		else if (cbp->cb_scripted)
-			(void) printf("%s\t", str);
-		else
-			(void) printf("%-*s  ",
-			    cbp->cb_colwidths[cbp->cb_columns[i]],
-			    str);
-
-	}
-
-	(void) printf("\n");
-}
 
 /*
  * Invoked to display the properties for a single dataset.
@@ -1074,7 +885,7 @@
 	char buf[ZFS_MAXPROPLEN];
 	zfs_source_t sourcetype;
 	char source[ZFS_MAXNAMELEN];
-	get_cbdata_t *cbp = data;
+	libzfs_get_cbdata_t *cbp = data;
 	nvlist_t *userprop = zfs_get_user_props(zhp);
 	zfs_proplist_t *pl = cbp->cb_proplist;
 	nvlist_t *propval;
@@ -1097,11 +908,18 @@
 			    cbp->cb_literal) != 0) {
 				if (pl->pl_all)
 					continue;
+				if (!zfs_prop_valid_for_type(pl->pl_prop,
+				    ZFS_TYPE_ANY)) {
+					(void) fprintf(stderr,
+					    gettext("No such property '%s'\n"),
+					    zfs_prop_to_name(pl->pl_prop));
+					continue;
+				}
 				sourcetype = ZFS_SRC_NONE;
 				(void) strlcpy(buf, "-", sizeof (buf));
 			}
 
-			print_one_property(zhp, cbp,
+			libzfs_print_one_property(zfs_get_name(zhp), cbp,
 			    zfs_prop_to_name(pl->pl_prop),
 			    buf, sourcetype, source);
 		} else {
@@ -1127,7 +945,7 @@
 				}
 			}
 
-			print_one_property(zhp, cbp,
+			libzfs_print_one_property(zfs_get_name(zhp), cbp,
 			    pl->pl_user_prop, strval, sourcetype,
 			    source);
 		}
@@ -1139,7 +957,7 @@
 static int
 zfs_do_get(int argc, char **argv)
 {
-	get_cbdata_t cb = { 0 };
+	libzfs_get_cbdata_t cb = { 0 };
 	boolean_t recurse = B_FALSE;
 	int i, c;
 	char *value, *fields;
@@ -1209,7 +1027,7 @@
 					(void) fprintf(stderr,
 					    gettext("invalid column name "
 					    "'%s'\n"), value);
-					    usage(B_FALSE);
+					usage(B_FALSE);
 				}
 			}
 			break;
@@ -1242,7 +1060,7 @@
 					(void) fprintf(stderr,
 					    gettext("invalid source "
 					    "'%s'\n"), value);
-					    usage(B_FALSE);
+					usage(B_FALSE);
 				}
 			}
 			break;
@@ -2108,7 +1926,7 @@
 	if (isatty(STDOUT_FILENO)) {
 		(void) fprintf(stderr,
 		    gettext("Error: Stream can not be written to a terminal.\n"
-			    "You must redirect standard output.\n"));
+		    "You must redirect standard output.\n"));
 		return (1);
 	}
 
@@ -2198,8 +2016,8 @@
 	if (isatty(STDIN_FILENO)) {
 		(void) fprintf(stderr,
 		    gettext("Error: Backup stream can not be read "
-			    "from a terminal.\n"
-			    "You must redirect standard input.\n"));
+		    "from a terminal.\n"
+		    "You must redirect standard input.\n"));
 		return (1);
 	}
 
@@ -2726,8 +2544,8 @@
 		return (1);
 
 	verify(zfs_prop_get(zhp, op == OP_SHARE ?
-		ZFS_PROP_SHARENFS : ZFS_PROP_MOUNTPOINT, property,
-		sizeof (property), NULL, NULL, 0, B_FALSE) == 0);
+	    ZFS_PROP_SHARENFS : ZFS_PROP_MOUNTPOINT, property,
+	    sizeof (property), NULL, NULL, 0, B_FALSE) == 0);
 
 	if (op == OP_SHARE) {
 		if (strcmp(property, "off") == 0) {
@@ -2968,7 +2786,7 @@
 		 */
 		if (argv[0][0] == '/')
 			return (unshare_unmount_path(op, argv[0],
-				flags, B_FALSE));
+			    flags, B_FALSE));
 
 		types = ZFS_TYPE_FILESYSTEM;
 		if (op == OP_SHARE)
--- a/usr/src/cmd/zpool/zpool_iter.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/cmd/zpool/zpool_iter.c	Wed Mar 28 12:48:13 2007 -0700
@@ -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.
  */
 
@@ -84,6 +84,7 @@
 	} else {
 		zpool_close(zhp);
 		free(node);
+		return (-1);
 	}
 
 	return (0);
@@ -96,7 +97,7 @@
  * line.
  */
 zpool_list_t *
-pool_list_get(int argc, char **argv, int *err)
+pool_list_get(int argc, char **argv, zpool_proplist_t **proplist, int *err)
 {
 	zpool_list_t *zlp;
 
@@ -121,9 +122,12 @@
 		for (i = 0; i < argc; i++) {
 			zpool_handle_t *zhp;
 
-			if ((zhp = zpool_open_canfail(g_zfs, argv[i])) != NULL)
-				(void) add_pool(zhp, zlp);
-			else
+			if ((zhp = zpool_open_canfail(g_zfs,
+			    argv[i])) != NULL && add_pool(zhp, zlp) == 0) {
+				if (proplist &&
+				    zpool_expand_proplist(zhp, proplist) != 0)
+					*err = B_TRUE;
+			} else
 				*err = B_TRUE;
 		}
 	}
@@ -222,13 +226,13 @@
  * using the pool_list_* interfaces.
  */
 int
-for_each_pool(int argc, char **argv, boolean_t unavail, zpool_iter_f func,
-    void *data)
+for_each_pool(int argc, char **argv, boolean_t unavail,
+    zpool_proplist_t **proplist, zpool_iter_f func, void *data)
 {
 	zpool_list_t *list;
 	int ret = 0;
 
-	if ((list = pool_list_get(argc, argv, &ret)) == NULL)
+	if ((list = pool_list_get(argc, argv, proplist, &ret)) == NULL)
 		return (1);
 
 	if (pool_list_iter(list, unavail, func, data) != 0)
--- a/usr/src/cmd/zpool/zpool_main.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/cmd/zpool/zpool_main.c	Wed Mar 28 12:48:13 2007 -0700
@@ -41,6 +41,7 @@
 #include <strings.h>
 #include <unistd.h>
 #include <priv.h>
+#include <sys/fs/zfs.h>
 
 #include <sys/stat.h>
 
@@ -75,6 +76,9 @@
 
 static int zpool_do_history(int, char **);
 
+static int zpool_do_get(int, char **);
+static int zpool_do_set(int, char **);
+
 /*
  * These libumem hooks provide a reasonable set of defaults for the allocator's
  * debugging facilities.
@@ -109,7 +113,9 @@
 	HELP_REMOVE,
 	HELP_SCRUB,
 	HELP_STATUS,
-	HELP_UPGRADE
+	HELP_UPGRADE,
+	HELP_GET,
+	HELP_SET
 } zpool_help_t;
 
 
@@ -153,7 +159,9 @@
 	{ "export",	zpool_do_export,	HELP_EXPORT		},
 	{ "upgrade",	zpool_do_upgrade,	HELP_UPGRADE		},
 	{ NULL },
-	{ "history",	zpool_do_history,	HELP_HISTORY		}
+	{ "history",	zpool_do_history,	HELP_HISTORY		},
+	{ "get",	zpool_do_get,		HELP_GET		},
+	{ "set",	zpool_do_set,		HELP_SET		},
 };
 
 #define	NCOMMAND	(sizeof (command_table) / sizeof (command_table[0]))
@@ -209,6 +217,11 @@
 		return (gettext("\tupgrade\n"
 		    "\tupgrade -v\n"
 		    "\tupgrade <-a | pool>\n"));
+	case HELP_GET:
+		return (gettext("\tget <all | property[,property]...> "
+		    "<pool> ...\n"));
+	case HELP_SET:
+		return (gettext("\tset <property=value> <pool> \n"));
 	}
 
 	abort();
@@ -261,6 +274,24 @@
 };
 
 /*
+ * Callback routine that will print out a pool property value.
+ */
+static zpool_prop_t
+print_prop_cb(zpool_prop_t prop, void *cb)
+{
+	FILE *fp = cb;
+
+	(void) fprintf(fp, "\t%-13s  ", zpool_prop_to_name(prop));
+
+	if (zpool_prop_values(prop) == NULL)
+		(void) fprintf(fp, "-\n");
+	else
+		(void) fprintf(fp, "%s\n", zpool_prop_values(prop));
+
+	return (ZFS_PROP_CONT);
+}
+
+/*
  * Display usage message.  If we're inside a command, display only the usage for
  * that command.  Otherwise, iterate over the entire command table and display
  * a complete usage message.
@@ -298,6 +329,20 @@
 		}
 	}
 
+	if (current_command != NULL &&
+	    ((strcmp(current_command->name, "set") == 0) ||
+	    (strcmp(current_command->name, "get") == 0))) {
+
+		(void) fprintf(fp,
+		    gettext("\nthe following properties are supported:\n"));
+
+		(void) fprintf(fp, "\n\t%-13s  %s\n\n",
+		    "PROPERTY", "VALUES");
+
+		/* Iterate over all properties */
+		(void) zpool_prop_iter(print_prop_cb, fp, B_FALSE);
+	}
+
 	/*
 	 * See comments at end of main().
 	 */
@@ -520,7 +565,7 @@
  *      -m	Set default mountpoint for the root dataset.  By default it's
  *      	'/<pool>'
  *
- * Creates the the named pool according to the given vdev specification.  The
+ * Creates the named pool according to the given vdev specification.  The
  * bulk of the vdev processing is done in get_vdev_spec() in zpool_vdev.c.  Once
  * we get the nvlist back from get_vdev_spec(), we either print out the contents
  * (if '-n' was specified), or pass it to libzfs to do the creation.
@@ -787,7 +832,7 @@
  *
  *	-f	Forcefully unmount datasets
  *
- * Export the the given pools.  By default, the command will attempt to cleanly
+ * Export the given pools.  By default, the command will attempt to cleanly
  * unmount any active datasets within the pool.  If the '-f' flag is specified,
  * then the datasets will be forcefully unmounted.
  */
@@ -994,7 +1039,7 @@
 	(void) printf(gettext("    id: %llu\n"), (u_longlong_t)guid);
 	(void) printf(gettext(" state: %s"), health);
 	if (pool_state == POOL_STATE_DESTROYED)
-	    (void) printf(gettext(" (DESTROYED)"));
+		(void) printf(gettext(" (DESTROYED)"));
 	(void) printf("\n");
 
 	switch (reason) {
@@ -1705,7 +1750,7 @@
 	 * Construct the list of all interesting pools.
 	 */
 	ret = 0;
-	if ((list = pool_list_get(argc, argv, &ret)) == NULL)
+	if ((list = pool_list_get(argc, argv, NULL, &ret)) == NULL)
 		return (1);
 
 	if (pool_list_count(list) == 0 && argc != 0) {
@@ -2001,7 +2046,7 @@
 
 	cb.cb_first = B_TRUE;
 
-	ret = for_each_pool(argc, argv, B_TRUE, list_callback, &cb);
+	ret = for_each_pool(argc, argv, B_TRUE, NULL, list_callback, &cb);
 
 	if (argc == 0 && cb.cb_first) {
 		(void) printf(gettext("no pools available\n"));
@@ -2456,7 +2501,7 @@
 		usage(B_FALSE);
 	}
 
-	return (for_each_pool(argc, argv, B_TRUE, scrub_callback, &cb));
+	return (for_each_pool(argc, argv, B_TRUE, NULL, scrub_callback, &cb));
 }
 
 typedef struct status_cbdata {
@@ -2820,7 +2865,7 @@
 
 	case ZPOOL_STATUS_CORRUPT_LABEL_NR:
 		(void) printf(gettext("status: One or more devices could not "
-		    "be used because the the label is missing \n\tor invalid.  "
+		    "be used because the label is missing \n\tor invalid.  "
 		    "There are insufficient replicas for the pool to "
 		    "continue\n\tfunctioning.\n"));
 		(void) printf(gettext("action: Destroy and re-create the pool "
@@ -3006,7 +3051,7 @@
 	if (argc == 0)
 		cb.cb_allpools = B_TRUE;
 
-	ret = for_each_pool(argc, argv, B_TRUE, status_callback, &cb);
+	ret = for_each_pool(argc, argv, B_TRUE, NULL, status_callback, &cb);
 
 	if (argc == 0 && cb.cb_count == 0)
 		(void) printf(gettext("no pools available\n"));
@@ -3183,6 +3228,7 @@
 		(void) printf(gettext(" 4   zpool history\n"));
 		(void) printf(gettext(" 5   Compression using the gzip "
 		    "algorithm\n"));
+		(void) printf(gettext(" 6   bootfs pool property "));
 		(void) printf(gettext("\nFor more information on a particular "
 		    "version, including supported releases, see:\n\n"));
 		(void) printf("http://www.opensolaris.org/os/community/zfs/"
@@ -3216,7 +3262,8 @@
 				    "their associated\nfeatures.\n"));
 		}
 	} else {
-		ret = for_each_pool(argc, argv, B_FALSE, upgrade_one, &cb);
+		ret = for_each_pool(argc, argv, B_FALSE, NULL,
+		    upgrade_one, &cb);
 	}
 
 	return (ret);
@@ -3278,7 +3325,8 @@
 	argc -= optind;
 	argv += optind;
 
-	ret = for_each_pool(argc, argv, B_FALSE, get_history_one, &first);
+	ret = for_each_pool(argc, argv, B_FALSE,  NULL, get_history_one,
+	    &first);
 
 	if (argc == 0 && first == B_TRUE) {
 		(void) printf(gettext("no pools available\n"));
@@ -3288,12 +3336,165 @@
 	return (ret);
 }
 
+static int
+get_callback(zpool_handle_t *zhp, void *data)
+{
+	libzfs_get_cbdata_t *cbp = (libzfs_get_cbdata_t *)data;
+	char value[MAXNAMELEN];
+	zfs_source_t srctype;
+	zpool_proplist_t *pl;
+
+	for (pl = cbp->cb_proplist; pl != NULL; pl = pl->pl_next) {
+
+		/*
+		 * Skip the special fake placeholder.
+		 */
+		if (pl->pl_prop == ZFS_PROP_NAME &&
+		    pl == cbp->cb_proplist)
+			continue;
+
+		if (zpool_get_prop(zhp, pl->pl_prop,
+		    value, sizeof (value), &srctype) != 0)
+			continue;
+
+		libzfs_print_one_property(zpool_get_name(zhp), cbp,
+		    zpool_prop_to_name(pl->pl_prop), value, srctype, NULL);
+	}
+	return (0);
+}
+
+int
+zpool_do_get(int argc, char **argv)
+{
+	libzfs_get_cbdata_t cb = { 0 };
+	zpool_proplist_t fake_name = { 0 };
+	int ret;
+
+	if (argc < 3)
+		usage(B_FALSE);
+
+	cb.cb_first = B_TRUE;
+	cb.cb_sources = ZFS_SRC_ALL;
+	cb.cb_columns[0] = GET_COL_NAME;
+	cb.cb_columns[1] = GET_COL_PROPERTY;
+	cb.cb_columns[2] = GET_COL_VALUE;
+	cb.cb_columns[3] = GET_COL_SOURCE;
+
+	if (zpool_get_proplist(g_zfs, argv[1],  &cb.cb_proplist) != 0)
+		usage(B_FALSE);
+
+	if (cb.cb_proplist != NULL) {
+		fake_name.pl_prop = ZFS_PROP_NAME;
+		fake_name.pl_width = strlen(gettext("NAME"));
+		fake_name.pl_next = cb.cb_proplist;
+		cb.cb_proplist = &fake_name;
+	}
+
+	ret = for_each_pool(argc - 2, argv + 2, B_TRUE, &cb.cb_proplist,
+	    get_callback, &cb);
+
+	if (cb.cb_proplist == &fake_name)
+		zfs_free_proplist(fake_name.pl_next);
+	else
+		zfs_free_proplist(cb.cb_proplist);
+
+	return (ret);
+}
+
+typedef struct set_cbdata {
+	char *cb_propname;
+	char *cb_value;
+	boolean_t cb_any_successful;
+} set_cbdata_t;
+
+int
+set_callback(zpool_handle_t *zhp, void *data)
+{
+	int error;
+	set_cbdata_t *cb = (set_cbdata_t *)data;
+
+	error = zpool_set_prop(zhp, cb->cb_propname, cb->cb_value);
+
+	if (!error)
+		cb->cb_any_successful = B_TRUE;
+
+	return (error);
+}
+
+int
+zpool_do_set(int argc, char **argv)
+{
+	set_cbdata_t cb = { 0 };
+	int error;
+
+	if (argc > 1 && argv[1][0] == '-') {
+		(void) fprintf(stderr, gettext("invalid option '%c'\n"),
+		    argv[1][1]);
+		usage(B_FALSE);
+	}
+
+	if (argc < 2) {
+		(void) fprintf(stderr, gettext("missing property=value "
+		    "argument\n"));
+		usage(B_FALSE);
+	}
+
+	if (argc < 3) {
+		(void) fprintf(stderr, gettext("missing pool name\n"));
+		usage(B_FALSE);
+	}
+
+	if (argc > 3) {
+		(void) fprintf(stderr, gettext("too many pool names\n"));
+		usage(B_FALSE);
+	}
+
+	cb.cb_propname = argv[1];
+	cb.cb_value = strchr(cb.cb_propname, '=');
+	if (cb.cb_value == NULL) {
+		(void) fprintf(stderr, gettext("missing value in "
+		    "property=value argument\n"));
+		usage(B_FALSE);
+	}
+
+	*(cb.cb_value) = '\0';
+	cb.cb_value++;
+
+	error = for_each_pool(argc - 2, argv + 2, B_TRUE, NULL,
+	    set_callback, &cb);
+
+	if (cb.cb_any_successful) {
+		*(cb.cb_value - 1) = '=';
+		zpool_log_history(g_zfs, argc, argv, argv[2], B_FALSE, B_FALSE);
+	}
+
+	return (error);
+}
+
+static int
+find_command_idx(char *command, int *idx)
+{
+	int i;
+
+	for (i = 0; i < NCOMMAND; i++) {
+		if (command_table[i].name == NULL)
+			continue;
+
+		if (strcmp(command, command_table[i].name) == 0) {
+			*idx = i;
+			return (0);
+		}
+	}
+	return (1);
+}
+
 int
 main(int argc, char **argv)
 {
 	int ret;
 	int i;
 	char *cmdname;
+	int found = 0;
 
 	(void) setlocale(LC_ALL, "");
 	(void) textdomain(TEXT_DOMAIN);
@@ -3327,15 +3528,10 @@
 	/*
 	 * Run the appropriate command.
 	 */
-	for (i = 0; i < NCOMMAND; i++) {
-		if (command_table[i].name == NULL)
-			continue;
-
-		if (strcmp(cmdname, command_table[i].name) == 0) {
-			current_command = &command_table[i];
-			ret = command_table[i].func(argc - 1, argv + 1);
-			break;
-		}
+	if (find_command_idx(cmdname, &i) == 0) {
+		current_command = &command_table[i];
+		ret = command_table[i].func(argc - 1, argv + 1);
+		found++;
 	}
 
 	/*
@@ -3348,7 +3544,7 @@
 		return (!!ioctl(fd, ZFS_IOC_POOL_FREEZE, buf));
 	}
 
-	if (i == NCOMMAND) {
+	if (!found) {
 		(void) fprintf(stderr, gettext("unrecognized "
 		    "command '%s'\n"), cmdname);
 		usage(B_FALSE);
--- a/usr/src/cmd/zpool/zpool_util.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/cmd/zpool/zpool_util.h	Wed Mar 28 12:48:13 2007 -0700
@@ -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.
  */
 
@@ -51,11 +51,12 @@
 /*
  * Pool list functions
  */
-int for_each_pool(int, char **, boolean_t unavail, zpool_iter_f, void *);
+int for_each_pool(int, char **, boolean_t unavail, zpool_proplist_t **,
+    zpool_iter_f, void *);
 
 typedef struct zpool_list zpool_list_t;
 
-zpool_list_t *pool_list_get(int, char **, int *);
+zpool_list_t *pool_list_get(int, char **, zpool_proplist_t **, int *);
 void pool_list_update(zpool_list_t *);
 int pool_list_iter(zpool_list_t *, int unavail, zpool_iter_f, void *);
 void pool_list_free(zpool_list_t *);
--- a/usr/src/common/zfs/zfs_prop.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/common/zfs/zfs_prop.c	Wed Mar 28 12:48:13 2007 -0700
@@ -179,10 +179,67 @@
 	{ "copies",	prop_type_index,	1,	"1",	prop_inherit,
 	    ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
 	    "1 | 2 | 3", "COPIES", B_TRUE, B_TRUE },
+	{ "bootfs", prop_type_string,	0,	NULL,	prop_default,
+	    ZFS_TYPE_POOL, "<filesystem>", "BOOTFS", B_FALSE, B_TRUE },
 };
 
 #define	ZFS_PROP_COUNT	((sizeof (zfs_prop_table))/(sizeof (prop_desc_t)))
 
+/*
+ * Returns TRUE if the property applies to the given dataset types.
+ */
+int
+zfs_prop_valid_for_type(zfs_prop_t prop, int types)
+{
+	return ((zfs_prop_table[prop].pd_types & types) != 0);
+}
+
+/*
+ * Determine if the specified property is visible or not.
+ */
+boolean_t
+zfs_prop_is_visible(zfs_prop_t prop)
+{
+	if (prop < 0)
+		return (B_FALSE);
+
+	return (zfs_prop_table[prop].pd_visible);
+}
+
+/*
+ * Iterate over all properties, calling back into the specified function
+ * for each property. We will continue to iterate until we either
+ * reach the end or the callback function something other than
+ * ZFS_PROP_CONT.
+ */
+zfs_prop_t
+zfs_prop_iter_common(zfs_prop_f func, void *cb, zfs_type_t type,
+    boolean_t show_all)
+{
+	int i;
+
+	for (i = 0; i < ZFS_PROP_COUNT; i++) {
+		if (zfs_prop_valid_for_type(i, type) &&
+		    (zfs_prop_is_visible(i) || show_all)) {
+			if (func(i, cb) != ZFS_PROP_CONT)
+				return (i);
+		}
+	}
+	return (ZFS_PROP_CONT);
+}
+
+zfs_prop_t
+zfs_prop_iter(zfs_prop_f func, void *cb, boolean_t show_all)
+{
+	return (zfs_prop_iter_common(func, cb, ZFS_TYPE_ANY, show_all));
+}
+
+zpool_prop_t
+zpool_prop_iter(zpool_prop_f func, void *cb, boolean_t show_all)
+{
+	return (zfs_prop_iter_common(func, cb, ZFS_TYPE_POOL, show_all));
+}
+
 zfs_proptype_t
 zfs_prop_get_type(zfs_prop_t prop)
 {
@@ -233,15 +290,34 @@
 }
 
 /*
- * Given a property name, returns the corresponding property ID.
+ * Given a property name and its type, returns the corresponding property ID.
+ */
+zfs_prop_t
+zfs_name_to_prop_common(const char *propname, zfs_type_t type)
+{
+	zfs_prop_t prop;
+
+	prop = zfs_prop_iter_common(zfs_name_to_prop_cb, (void *)propname,
+	    type, B_TRUE);
+	return (prop == ZFS_PROP_CONT ? ZFS_PROP_INVAL : prop);
+}
+
+/*
+ * Given a zfs dataset property name, returns the corresponding property ID.
  */
 zfs_prop_t
 zfs_name_to_prop(const char *propname)
 {
-	zfs_prop_t prop;
+	return (zfs_name_to_prop_common(propname, ZFS_TYPE_ANY));
+}
 
-	prop = zfs_prop_iter(zfs_name_to_prop_cb, (void *)propname, B_TRUE);
-	return (prop == ZFS_PROP_CONT ? ZFS_PROP_INVAL : prop);
+/*
+ * Given a pool property name, returns the corresponding property ID.
+ */
+zpool_prop_t
+zpool_name_to_prop(const char *propname)
+{
+	return (zfs_name_to_prop_common(propname, ZFS_TYPE_POOL));
 }
 
 /*
@@ -305,7 +381,8 @@
 }
 
 /*
- * Given a property ID, returns the corresponding name.
+ * Given a dataset property ID, returns the corresponding name.
+ * Assuming the zfs dataset propety ID is valid.
  */
 const char *
 zfs_prop_to_name(zfs_prop_t prop)
@@ -314,6 +391,16 @@
 }
 
 /*
+ * Given a pool property ID, returns the corresponding name.
+ * Assuming the pool propety ID is valid.
+ */
+const char *
+zpool_prop_to_name(zpool_prop_t prop)
+{
+	return (zfs_prop_table[prop].pd_name);
+}
+
+/*
  * Returns TRUE if the property is inheritable.
  */
 int
@@ -445,56 +532,31 @@
 	return (-1);
 }
 
-/*
- * Determine if the specified property is visible or not.
- */
-boolean_t
-zfs_prop_is_visible(zfs_prop_t prop)
-{
-	if (prop < 0)
-		return (B_FALSE);
-
-	return (zfs_prop_table[prop].pd_visible);
-}
-
-/*
- * Iterate over all properties, calling back into the specified function
- * for each property. We will continue to iterate until we either
- * reach the end or the callback function something other than
- * ZFS_PROP_CONT.
- */
-zfs_prop_t
-zfs_prop_iter(zfs_prop_f func, void *cb, boolean_t show_all)
-{
-	int i;
-
-	for (i = 0; i < ZFS_PROP_COUNT; i++) {
-		if (zfs_prop_is_visible(i) || show_all) {
-			if (func(i, cb) != ZFS_PROP_CONT)
-				return (i);
-		}
-	}
-	return (ZFS_PROP_CONT);
-}
-
 #ifndef _KERNEL
 
 /*
- * Returns TRUE if the property applies to the given dataset types.
+ * Returns a string describing the set of acceptable values for the given
+ * zfs property, or NULL if it cannot be set.
  */
-int
-zfs_prop_valid_for_type(zfs_prop_t prop, int types)
+const char *
+zfs_prop_values(zfs_prop_t prop)
 {
-	return ((zfs_prop_table[prop].pd_types & types) != 0);
+	if (zfs_prop_table[prop].pd_types == ZFS_TYPE_POOL)
+		return (NULL);
+
+	return (zfs_prop_table[prop].pd_values);
 }
 
 /*
  * Returns a string describing the set of acceptable values for the given
- * property, or NULL if it cannot be set.
+ * zpool property, or NULL if it cannot be set.
  */
 const char *
-zfs_prop_values(zfs_prop_t prop)
+zpool_prop_values(zfs_prop_t prop)
 {
+	if (zfs_prop_table[prop].pd_types != ZFS_TYPE_POOL)
+		return (NULL);
+
 	return (zfs_prop_table[prop].pd_values);
 }
 
--- a/usr/src/grub/grub-0.95/AUTHORS	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/AUTHORS	Wed Mar 28 12:48:13 2007 -0700
@@ -1,3 +1,8 @@
+
+ZFS support added by Sun Microsystems.
+Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+Use is subject to license terms.
+
 VaX#n8 (real name unknown) wrote shared_src/fsys_ext2fs.c.
 
 Heiko Schroeder rewrote shared_src/stage1.S to be more readable.
--- a/usr/src/grub/grub-0.95/configure	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/configure	Wed Mar 28 12:48:13 2007 -0700
@@ -867,6 +867,7 @@
   --disable-vstafs        disable VSTa FS support in Stage 2
   --disable-jfs           disable IBM JFS support in Stage 2
   --disable-xfs           disable SGI XFS support in Stage 2
+  --disable-zfs           disable ZFS support in Stage 2
   --disable-iso9660       disable ISO9660 support in Stage 2
   --disable-gunzip        disable decompression in Stage 2
   --disable-md5-password  disable MD5 password support in Stage 2
@@ -5495,6 +5496,16 @@
   FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1"
 fi
 
+# Check whether --enable-zfs or --disable-zfs was given.
+if test "${enable_zfs+set}" = set; then
+  enableval="$enable_zfs"
+
+fi;
+
+if test x"$enable_zfs" != xno; then
+  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ZFS=1"
+fi
+
 # Check whether --enable-iso9660 or --disable-iso9660 was given.
 if test "${enable_iso9660+set}" = set; then
   enableval="$enable_iso9660"
--- a/usr/src/grub/grub-0.95/configure.ac	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/configure.ac	Wed Mar 28 12:48:13 2007 -0700
@@ -291,6 +291,13 @@
   FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1"
 fi
 
+AC_ARG_ENABLE(zfs,
+  [  --disable-zfs           disable ZFS support in Stage 2])
+
+if test x"$enable_zfs" != xno; then
+  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ZFS=1"
+fi
+
 AC_ARG_ENABLE(iso9660,
   [  --disable-iso9660       disable ISO9660 support in Stage 2])
 
--- a/usr/src/grub/grub-0.95/grub/Makefile.am	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/grub/Makefile.am	Wed Mar 28 12:48:13 2007 -0700
@@ -8,7 +8,7 @@
 
 AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
 	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
-	-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+	-DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \
 	$(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \
 	-I$(top_srcdir)/stage1 -I$(top_srcdir)/lib
--- a/usr/src/grub/grub-0.95/grub/Makefile.in	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/grub/Makefile.in	Wed Mar 28 12:48:13 2007 -0700
@@ -180,7 +180,7 @@
 @SERIAL_SPEED_SIMULATION_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1
 AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
 	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
-	-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+	-DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \
 	$(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \
 	-I$(top_srcdir)/stage1 -I$(top_srcdir)/lib
--- a/usr/src/grub/grub-0.95/grub/Makefile.solaris	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/grub/Makefile.solaris	Wed Mar 28 12:48:13 2007 -0700
@@ -19,7 +19,7 @@
 LINKFLAGS	+= -O2
 CPPFLAGS	+= -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
 		   -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 \
-		   -DFSYS_REISERFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 \
+		   -DFSYS_REISERFS=1 -DFSYS_ZFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 \
 		   -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \
 		   -DSUPPORT_SERIAL=1 
 
--- a/usr/src/grub/grub-0.95/grub/asmstub.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/grub/asmstub.c	Wed Mar 28 12:48:13 2007 -0700
@@ -64,7 +64,7 @@
 #include <term.h>
 
 /* Simulated memory sizes. */
-#define EXTENDED_MEMSIZE (3 * 1024 * 1024)	/* 3MB */
+#define EXTENDED_MEMSIZE (64 * 1024 * 1024)	/* 64MB */
 #define CONVENTIONAL_MEMSIZE (640 * 1024)	/* 640kB */
 
 unsigned long install_partition = 0x20000;
--- a/usr/src/grub/grub-0.95/stage2/Makefile.am	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/Makefile.am	Wed Mar 28 12:48:13 2007 -0700
@@ -7,7 +7,8 @@
         fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \
 	imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \
 	nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \
-	terminfo.h tparm.h nbi.h ufs.h ufs2.h vstafs.h xfs.h graphics.h
+	terminfo.h tparm.h nbi.h ufs.h ufs2.h vstafs.h xfs.h graphics.h \
+	fsys_zfs.h
 EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS)
 
 # For <stage1.h>.
@@ -18,12 +19,13 @@
 libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
 	disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
 	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c \
+	fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \
 	fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
 	terminfo.c tparm.c graphics.c
 libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
 	-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
 	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
-	-DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+	-DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_ZFS=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 \
 	-fwritable-strings
 
@@ -35,26 +37,27 @@
 if DISKLESS_SUPPORT
 pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
 	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
-	reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
+	reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 zfs_stage1_5 vstafs_stage1_5 \
 	xfs_stage1_5 nbgrub pxegrub
 noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
 noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
 	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
 	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
 	reiserfs_stage1_5.exec ufs_stage1_5.exec ufs2_stage1_5.exec \
+	zfs_stage1_5.exec \
 	vstafs_stage1_5.exec xfs_stage1_5.exec \
 	nbloader.exec pxeloader.exec diskless.exec
 else
 pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
 	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
-	reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
+	reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 zfs_stage1_5 vstafs_stage1_5 \
 	xfs_stage1_5
 noinst_DATA = pre_stage2 start start_eltorito
 noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
 	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
 	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
 	reiserfs_stage1_5.exec ufs_stage1_5.exec ufs2_stage1_5.exec \
-	vstafs_stage1_5.exec xfs_stage1_5.exec
+	zfs_stage1_5.exec vstafs_stage1_5.exec xfs_stage1_5.exec
 endif
 MOSTLYCLEANFILES = $(noinst_PROGRAMS)
 
@@ -99,6 +102,7 @@
 	cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
 	fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
 	fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \
+	fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \
 	gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \
 	tparm.c graphics.c
 pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
@@ -191,6 +195,15 @@
 	-DNO_BLOCK_FILES=1
 ufs2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
 
+# For zfs_stage1_5 target.
+zfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
+	stage1_5.c fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c bios.c
+zfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \
+	-DNO_BLOCK_FILES=1
+zfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \
+	-DNO_BLOCK_FILES=1
+zfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
 # For minix_stage1_5 target.
 minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
 	stage1_5.c fsys_minix.c bios.c
--- a/usr/src/grub/grub-0.95/stage2/Makefile.in	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/Makefile.in	Wed Mar 28 12:48:13 2007 -0700
@@ -18,7 +18,7 @@
 
 
 
-SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(iso9660_stage1_5_exec_SOURCES) $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) $(ufs2_stage1_5_exec_SOURCES) $(ufs_stage1_5_exec_SOURCES) $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES)
+SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(iso9660_stage1_5_exec_SOURCES) $(jfs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) $(ufs2_stage1_5_exec_SOURCES) $(zfs_stage1_5_exec_SOURCE) $(ufs_stage1_5_exec_SOURCES) $(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES)
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -54,6 +54,7 @@
 @DISKLESS_SUPPORT_FALSE@	reiserfs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_FALSE@	ufs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_FALSE@	ufs2_stage1_5.exec$(EXEEXT) \
+@DISKLESS_SUPPORT_FALSE@	zfs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_FALSE@	vstafs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_FALSE@	xfs_stage1_5.exec$(EXEEXT)
 @DISKLESS_SUPPORT_TRUE@noinst_PROGRAMS = pre_stage2.exec$(EXEEXT) \
@@ -68,6 +69,7 @@
 @DISKLESS_SUPPORT_TRUE@	reiserfs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_TRUE@	ufs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_TRUE@	ufs2_stage1_5.exec$(EXEEXT) \
+@DISKLESS_SUPPORT_TRUE@	zfs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_TRUE@	vstafs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_TRUE@	xfs_stage1_5.exec$(EXEEXT) \
 @DISKLESS_SUPPORT_TRUE@	nbloader.exec$(EXEEXT) \
@@ -97,6 +99,10 @@
 	libgrub_a-fsys_iso9660.$(OBJEXT) libgrub_a-fsys_jfs.$(OBJEXT) \
 	libgrub_a-fsys_minix.$(OBJEXT) \
 	libgrub_a-fsys_reiserfs.$(OBJEXT) libgrub_a-fsys_ufs.$(OBJEXT) \
+	libgrub_a-zfs_sha256.$(OBJEXT) \
+	libgrub_a-zfs_lzjb.$(OBJEXT) \
+	libgrub_a-zfs_fletcher.$(OBJEXT) \
+	libgrub_a-fsys_zfs.$(OBJEXT) \
 	libgrub_a-fsys_ufs2.$(OBJEXT) libgrub_a-fsys_vstafs.$(OBJEXT) \
 	libgrub_a-fsys_xfs.$(OBJEXT) libgrub_a-gunzip.$(OBJEXT) \
 	libgrub_a-md5.$(OBJEXT) libgrub_a-serial.$(OBJEXT) \
@@ -118,6 +124,10 @@
 	diskless_exec-fsys_jfs.$(OBJEXT) \
 	diskless_exec-fsys_minix.$(OBJEXT) \
 	diskless_exec-fsys_reiserfs.$(OBJEXT) \
+	diskless_exec-zfs_sha256.$(OBJEXT) \
+	diskless_exec-zfs_lzjb.$(OBJEXT) \
+	diskless_exec-zfs_fletcher.$(OBJEXT) \
+	diskless_exec-fsys_zfs.$(OBJEXT) \
 	diskless_exec-fsys_ufs.$(OBJEXT) \
 	diskless_exec-fsys_ufs2.$(OBJEXT) \
 	diskless_exec-fsys_vstafs.$(OBJEXT) \
@@ -211,6 +221,10 @@
 	pre_stage2_exec-fsys_jfs.$(OBJEXT) \
 	pre_stage2_exec-fsys_minix.$(OBJEXT) \
 	pre_stage2_exec-fsys_reiserfs.$(OBJEXT) \
+	pre_stage2_exec-zfs_sha256.$(OBJEXT) \
+	pre_stage2_exec-zfs_lzjb.$(OBJEXT) \
+	pre_stage2_exec-zfs_fletcher.$(OBJEXT) \
+	pre_stage2_exec-fsys_zfs.$(OBJEXT) \
 	pre_stage2_exec-fsys_ufs.$(OBJEXT) \
 	pre_stage2_exec-fsys_ufs2.$(OBJEXT) \
 	pre_stage2_exec-fsys_vstafs.$(OBJEXT) \
@@ -267,6 +281,19 @@
 	ufs_stage1_5_exec-bios.$(OBJEXT)
 ufs_stage1_5_exec_OBJECTS = $(am_ufs_stage1_5_exec_OBJECTS)
 ufs_stage1_5_exec_LDADD = $(LDADD)
+am_zfs_stage1_5_exec_OBJECTS = zfs_stage1_5_exec-start.$(OBJEXT) \
+	zfs_stage1_5_exec-asm.$(OBJEXT) \
+	zfs_stage1_5_exec-common.$(OBJEXT) \
+	zfs_stage1_5_exec-char_io.$(OBJEXT) \
+	zfs_stage1_5_exec-disk_io.$(OBJEXT) \
+	zfs_stage1_5_exec-stage1_5.$(OBJEXT) \
+	zfs_stage1_5_exec-zfs_sha256.$(OBJEXT) \
+	zfs_stage1_5_exec-zfs_lzjb.$(OBJEXT) \
+	zfs_stage1_5_exec-zfs_fletcher.$(OBJEXT) \
+	zfs_stage1_5_exec-fsys_zfs.$(OBJEXT) \
+	zfs_stage1_5_exec-bios.$(OBJEXT)
+zfs_stage1_5_exec_OBJECTS = $(am_zfs_stage1_5_exec_OBJECTS)
+zfs_stage1_5_exec_LDADD = $(LDADD)
 am_vstafs_stage1_5_exec_OBJECTS =  \
 	vstafs_stage1_5_exec-start.$(OBJEXT) \
 	vstafs_stage1_5_exec-asm.$(OBJEXT) \
@@ -307,6 +334,10 @@
 @AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-fsys_jfs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-fsys_minix.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-fsys_reiserfs.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-zfs_sha256.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-zfs_lzjb.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-zfs_fletcher.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-fsys_zfs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-fsys_ufs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-fsys_ufs2.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/diskless_exec-fsys_vstafs.Po \
@@ -363,6 +394,10 @@
 @AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-fsys_jfs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-fsys_minix.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-fsys_reiserfs.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-zfs_sha256.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-zfs_lzjb.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-zfs_fletcher.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-fsys_zfs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-fsys_ufs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-fsys_ufs2.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/libgrub_a-fsys_vstafs.Po \
@@ -395,6 +430,10 @@
 @AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-fsys_minix.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po \
@@ -426,6 +465,15 @@
 @AMDEP_TRUE@	./$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-bios.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-char_io.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-common.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/vstafs_stage1_5_exec-bios.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/vstafs_stage1_5_exec-common.Po \
@@ -451,6 +499,7 @@
 	$(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) \
 	$(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) \
 	$(ufs2_stage1_5_exec_SOURCES) $(ufs_stage1_5_exec_SOURCES) \
+	$(zfs_stage1_5_exec_SOURCES) \
 	$(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES)
 DIST_SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) \
 	$(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) \
@@ -460,6 +509,7 @@
 	$(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) \
 	$(start_exec_SOURCES) $(start_eltorito_exec_SOURCES) \
 	$(ufs2_stage1_5_exec_SOURCES) $(ufs_stage1_5_exec_SOURCES) \
+	$(zfs_stage1_5_exec_SOURCES) \
 	$(vstafs_stage1_5_exec_SOURCES) $(xfs_stage1_5_exec_SOURCES)
 am__installdirs = "$(DESTDIR)$(pkglibdir)"
 pkglibDATA_INSTALL = $(INSTALL_DATA)
@@ -590,7 +640,7 @@
         fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \
 	imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \
 	nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \
-	terminfo.h tparm.h nbi.h ufs.h ufs2.h vstafs.h xfs.h graphics.h
+	terminfo.h tparm.h nbi.h fsys_zfs.h ufs.h ufs2.h vstafs.h xfs.h graphics.h
 
 EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS)
 
@@ -602,23 +652,26 @@
 libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
 	disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
 	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c \
+	zfs_sha256.c zfs_lzjb.c zfs_fletcher.c fsys_zfs.c \
 	fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
 	terminfo.c tparm.c graphics.c
 
 libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
 	-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
 	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
-	-DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+	-DFSYS_ZFS=1 -DFSYS_UFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 \
 	-fwritable-strings
 
 @DISKLESS_SUPPORT_FALSE@pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
 @DISKLESS_SUPPORT_FALSE@	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+@DISKLESS_SUPPORT_FALSE@	zfs_stage1_5 \
 @DISKLESS_SUPPORT_FALSE@	reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
 @DISKLESS_SUPPORT_FALSE@	xfs_stage1_5
 
 @DISKLESS_SUPPORT_TRUE@pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
 @DISKLESS_SUPPORT_TRUE@	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+@DISKLESS_SUPPORT_TRUE@		zfs_stage1_5 \
 @DISKLESS_SUPPORT_TRUE@	reiserfs_stage1_5 ufs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
 @DISKLESS_SUPPORT_TRUE@	xfs_stage1_5 nbgrub pxegrub
 
@@ -648,6 +701,7 @@
 pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \
 	cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
 	fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
+	fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c \
 	fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \
 	gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \
 	tparm.c graphics.c
@@ -702,6 +756,18 @@
 
 ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
 
+# For zfs_stage1_5 target.
+zfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
+	stage1_5.c fsys_zfs.c zfs_fletcher.c zfs_lzjb.c zfs_sha256.c bios.c
+
+zfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \
+	-DNO_BLOCK_FILES=1
+
+zfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_ZFS=1 \
+	-DNO_BLOCK_FILES=1
+
+zfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
 # For ufs_stage1_5 target.
 ufs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
 	stage1_5.c fsys_ufs.c bios.c
@@ -904,6 +970,9 @@
 start_eltorito.exec$(EXEEXT): $(start_eltorito_exec_OBJECTS) $(start_eltorito_exec_DEPENDENCIES) 
 	@rm -f start_eltorito.exec$(EXEEXT)
 	$(LINK) $(start_eltorito_exec_LDFLAGS) $(start_eltorito_exec_OBJECTS) $(start_eltorito_exec_LDADD) $(LIBS)
+zfs_stage1_5.exec$(EXEEXT): $(zfs_stage1_5_exec_OBJECTS) $(zfs_stage1_5_exec_DEPENDENCIES) 
+	@rm -f zfs_stage1_5.exec$(EXEEXT)
+	$(LINK) $(zfs_stage1_5_exec_LDFLAGS) $(zfs_stage1_5_exec_OBJECTS) $(zfs_stage1_5_exec_LDADD) $(LIBS)
 ufs2_stage1_5.exec$(EXEEXT): $(ufs2_stage1_5_exec_OBJECTS) $(ufs2_stage1_5_exec_DEPENDENCIES) 
 	@rm -f ufs2_stage1_5.exec$(EXEEXT)
 	$(LINK) $(ufs2_stage1_5_exec_LDFLAGS) $(ufs2_stage1_5_exec_OBJECTS) $(ufs2_stage1_5_exec_LDADD) $(LIBS)
@@ -938,6 +1007,10 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_jfs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_minix.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_reiserfs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_sha256.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_lzjb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-zfs_fletcher.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_zfs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ufs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_ufs2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskless_exec-fsys_vstafs.Po@am__quote@
@@ -994,6 +1067,10 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_jfs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_minix.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_reiserfs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_sha256.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_lzjb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-zfs_fletcher.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_zfs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ufs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_ufs2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgrub_a-fsys_vstafs.Po@am__quote@
@@ -1026,6 +1103,10 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_jfs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_minix.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_ufs2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pre_stage2_exec-fsys_vstafs.Po@am__quote@
@@ -1057,6 +1138,15 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-disk_io.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-fsys_ufs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufs_stage1_5_exec-stage1_5.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-bios.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-char_io.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-bios.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-char_io.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstafs_stage1_5_exec-common.Po@am__quote@
@@ -1220,6 +1310,18 @@
 ufs_stage1_5_exec-asm.obj: asm.S
 	$(CCAS) $(ufs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o ufs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi`
 
+zfs_stage1_5_exec-start.o: start.S
+	$(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S
+
+zfs_stage1_5_exec-start.obj: start.S
+	$(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-start.obj `if test -f 'start.S'; then $(CYGPATH_W) 'start.S'; else $(CYGPATH_W) '$(srcdir)/start.S'; fi`
+
+zfs_stage1_5_exec-asm.o: asm.S
+	$(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-asm.o `test -f 'asm.S' || echo '$(srcdir)/'`asm.S
+
+zfs_stage1_5_exec-asm.obj: asm.S
+	$(CCAS) $(zfs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o zfs_stage1_5_exec-asm.obj `if test -f 'asm.S'; then $(CYGPATH_W) 'asm.S'; else $(CYGPATH_W) '$(srcdir)/asm.S'; fi`
+
 vstafs_stage1_5_exec-start.o: start.S
 	$(CCAS) $(vstafs_stage1_5_exec_CCASFLAGS) $(CCASFLAGS) -c -o vstafs_stage1_5_exec-start.o `test -f 'start.S' || echo '$(srcdir)/'`start.S
 
@@ -1468,6 +1570,70 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`
 
+libgrub_a-zfs_sha256.o: zfs_sha256.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" -c -o libgrub_a-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" "$(DEPDIR)/libgrub_a-zfs_sha256.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_sha256.c' object='libgrub_a-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/libgrub_a-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_sha256.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c
+
+libgrub_a-zfs_sha256.obj: zfs_sha256.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" -c -o libgrub_a-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo" "$(DEPDIR)/libgrub_a-zfs_sha256.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_sha256.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_sha256.c' object='libgrub_a-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/libgrub_a-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_sha256.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`
+
+libgrub_a-zfs_lzjb.o: zfs_lzjb.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" -c -o libgrub_a-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" "$(DEPDIR)/libgrub_a-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_lzjb.c' object='libgrub_a-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/libgrub_a-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_lzjb.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c
+
+libgrub_a-zfs_lzjb.obj: zfs_lzjb.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" -c -o libgrub_a-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo" "$(DEPDIR)/libgrub_a-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_lzjb.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_lzjb.c' object='libgrub_a-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/libgrub_a-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_lzjb.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`
+
+libgrub_a-zfs_fletcher.o: zfs_fletcher.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" -c -o libgrub_a-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" "$(DEPDIR)/libgrub_a-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_fletcher.c' object='libgrub_a-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/libgrub_a-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_fletcher.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c
+
+libgrub_a-zfs_fletcher.obj: zfs_fletcher.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" -c -o libgrub_a-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo" "$(DEPDIR)/libgrub_a-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/libgrub_a-zfs_fletcher.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_fletcher.c' object='libgrub_a-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/libgrub_a-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/libgrub_a-zfs_fletcher.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`
+
+libgrub_a-fsys_zfs.o: fsys_zfs.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" -c -o libgrub_a-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_zfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fsys_zfs.c' object='libgrub_a-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/libgrub_a-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_zfs.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c
+
+libgrub_a-fsys_zfs.obj: fsys_zfs.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" -c -o libgrub_a-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo" "$(DEPDIR)/libgrub_a-fsys_zfs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_zfs.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fsys_zfs.c' object='libgrub_a-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/libgrub_a-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_zfs.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`
+
 libgrub_a-fsys_ufs.o: fsys_ufs.c
 @am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -MT libgrub_a-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" -c -o libgrub_a-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo" "$(DEPDIR)/libgrub_a-fsys_ufs.Po"; else rm -f "$(DEPDIR)/libgrub_a-fsys_ufs.Tpo"; exit 1; fi
@@ -1884,6 +2050,70 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`
 
+diskless_exec-zfs_sha256.o: zfs_sha256.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" -c -o diskless_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" "$(DEPDIR)/diskless_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_sha256.c' object='diskless_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/diskless_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c
+
+diskless_exec-zfs_sha256.obj: zfs_sha256.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" -c -o diskless_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo" "$(DEPDIR)/diskless_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_sha256.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_sha256.c' object='diskless_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/diskless_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`
+
+diskless_exec-zfs_lzjb.o: zfs_lzjb.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" -c -o diskless_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" "$(DEPDIR)/diskless_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_lzjb.c' object='diskless_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/diskless_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c
+
+diskless_exec-zfs_lzjb.obj: zfs_lzjb.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" -c -o diskless_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo" "$(DEPDIR)/diskless_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_lzjb.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_lzjb.c' object='diskless_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/diskless_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`
+
+diskless_exec-zfs_fletcher.o: zfs_fletcher.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" -c -o diskless_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" "$(DEPDIR)/diskless_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_fletcher.c' object='diskless_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/diskless_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c
+
+diskless_exec-zfs_fletcher.obj: zfs_fletcher.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" -c -o diskless_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo" "$(DEPDIR)/diskless_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/diskless_exec-zfs_fletcher.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_fletcher.c' object='diskless_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/diskless_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/diskless_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`
+
+diskless_exec-fsys_zfs.o: fsys_zfs.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" -c -o diskless_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fsys_zfs.c' object='diskless_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/diskless_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c
+
+diskless_exec-fsys_zfs.obj: fsys_zfs.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" -c -o diskless_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo" "$(DEPDIR)/diskless_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_zfs.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fsys_zfs.c' object='diskless_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/diskless_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`
+
 diskless_exec-fsys_ufs.o: fsys_ufs.c
 @am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -MT diskless_exec-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" -c -o diskless_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo" "$(DEPDIR)/diskless_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/diskless_exec-fsys_ufs.Tpo"; exit 1; fi
@@ -2908,6 +3138,70 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_reiserfs.obj `if test -f 'fsys_reiserfs.c'; then $(CYGPATH_W) 'fsys_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_reiserfs.c'; fi`
 
+pre_stage2_exec-zfs_sha256.o: zfs_sha256.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" -c -o pre_stage2_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_sha256.c' object='pre_stage2_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c
+
+pre_stage2_exec-zfs_sha256.obj: zfs_sha256.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" -c -o pre_stage2_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_sha256.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_sha256.c' object='pre_stage2_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/pre_stage2_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`
+
+pre_stage2_exec-zfs_lzjb.o: zfs_lzjb.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" -c -o pre_stage2_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_lzjb.c' object='pre_stage2_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c
+
+pre_stage2_exec-zfs_lzjb.obj: zfs_lzjb.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" -c -o pre_stage2_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_lzjb.c' object='pre_stage2_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/pre_stage2_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`
+
+pre_stage2_exec-zfs_fletcher.o: zfs_fletcher.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" -c -o pre_stage2_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_fletcher.c' object='pre_stage2_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c
+
+pre_stage2_exec-zfs_fletcher.obj: zfs_fletcher.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" -c -o pre_stage2_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo" "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_fletcher.c' object='pre_stage2_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/pre_stage2_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`
+
+pre_stage2_exec-fsys_zfs.o: fsys_zfs.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" -c -o pre_stage2_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fsys_zfs.c' object='pre_stage2_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c
+
+pre_stage2_exec-fsys_zfs.obj: fsys_zfs.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" -c -o pre_stage2_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_zfs.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fsys_zfs.c' object='pre_stage2_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/pre_stage2_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`
+
 pre_stage2_exec-fsys_ufs.o: fsys_ufs.c
 @am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -MT pre_stage2_exec-fsys_ufs.o -MD -MP -MF "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" -c -o pre_stage2_exec-fsys_ufs.o `test -f 'fsys_ufs.c' || echo '$(srcdir)/'`fsys_ufs.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo" "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Po"; else rm -f "$(DEPDIR)/pre_stage2_exec-fsys_ufs.Tpo"; exit 1; fi
@@ -3404,6 +3698,150 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ufs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`
 
+zfs_stage1_5_exec-common.o: common.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" -c -o zfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='common.c' object='zfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c
+
+zfs_stage1_5_exec-common.obj: common.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-common.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" -c -o zfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-common.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='common.c' object='zfs_stage1_5_exec-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`
+
+zfs_stage1_5_exec-char_io.o: char_io.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-char_io.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" -c -o zfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='char_io.c' object='zfs_stage1_5_exec-char_io.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-char_io.o `test -f 'char_io.c' || echo '$(srcdir)/'`char_io.c
+
+zfs_stage1_5_exec-char_io.obj: char_io.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-char_io.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" -c -o zfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-char_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-char_io.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='char_io.c' object='zfs_stage1_5_exec-char_io.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-char_io.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-char_io.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-char_io.obj `if test -f 'char_io.c'; then $(CYGPATH_W) 'char_io.c'; else $(CYGPATH_W) '$(srcdir)/char_io.c'; fi`
+
+zfs_stage1_5_exec-disk_io.o: disk_io.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-disk_io.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" -c -o zfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='disk_io.c' object='zfs_stage1_5_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-disk_io.o `test -f 'disk_io.c' || echo '$(srcdir)/'`disk_io.c
+
+zfs_stage1_5_exec-disk_io.obj: disk_io.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-disk_io.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" -c -o zfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-disk_io.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='disk_io.c' object='zfs_stage1_5_exec-disk_io.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-disk_io.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-disk_io.obj `if test -f 'disk_io.c'; then $(CYGPATH_W) 'disk_io.c'; else $(CYGPATH_W) '$(srcdir)/disk_io.c'; fi`
+
+zfs_stage1_5_exec-stage1_5.o: stage1_5.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-stage1_5.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" -c -o zfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='stage1_5.c' object='zfs_stage1_5_exec-stage1_5.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-stage1_5.o `test -f 'stage1_5.c' || echo '$(srcdir)/'`stage1_5.c
+
+zfs_stage1_5_exec-stage1_5.obj: stage1_5.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-stage1_5.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" -c -o zfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='stage1_5.c' object='zfs_stage1_5_exec-stage1_5.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-stage1_5.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-stage1_5.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-stage1_5.obj `if test -f 'stage1_5.c'; then $(CYGPATH_W) 'stage1_5.c'; else $(CYGPATH_W) '$(srcdir)/stage1_5.c'; fi`
+
+zfs_stage1_5_exec-zfs_sha256.o: zfs_sha256.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_sha256.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" -c -o zfs_stage1_5_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_sha256.c' object='zfs_stage1_5_exec-zfs_sha256.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_sha256.o `test -f 'zfs_sha256.c' || echo '$(srcdir)/'`zfs_sha256.c
+
+zfs_stage1_5_exec-zfs_sha256.obj: zfs_sha256.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_sha256.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" -c -o zfs_stage1_5_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_sha256.c' object='zfs_stage1_5_exec-zfs_sha256.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_sha256.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_sha256.obj `if test -f 'zfs_sha256.c'; then $(CYGPATH_W) 'zfs_sha256.c'; else $(CYGPATH_W) '$(srcdir)/zfs_sha256.c'; fi`
+
+zfs_stage1_5_exec-zfs_lzjb.o: zfs_lzjb.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_lzjb.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" -c -o zfs_stage1_5_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_lzjb.c' object='zfs_stage1_5_exec-zfs_lzjb.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_lzjb.o `test -f 'zfs_lzjb.c' || echo '$(srcdir)/'`zfs_lzjb.c
+
+zfs_stage1_5_exec-zfs_lzjb.obj: zfs_lzjb.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_lzjb.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" -c -o zfs_stage1_5_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_lzjb.c' object='zfs_stage1_5_exec-zfs_lzjb.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_lzjb.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_lzjb.obj `if test -f 'zfs_lzjb.c'; then $(CYGPATH_W) 'zfs_lzjb.c'; else $(CYGPATH_W) '$(srcdir)/zfs_lzjb.c'; fi`
+
+zfs_stage1_5_exec-zfs_fletcher.o: zfs_fletcher.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_fletcher.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" -c -o zfs_stage1_5_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_fletcher.c' object='zfs_stage1_5_exec-zfs_fletcher.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_fletcher.o `test -f 'zfs_fletcher.c' || echo '$(srcdir)/'`zfs_fletcher.c
+
+zfs_stage1_5_exec-zfs_fletcher.obj: zfs_fletcher.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-zfs_fletcher.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" -c -o zfs_stage1_5_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zfs_fletcher.c' object='zfs_stage1_5_exec-zfs_fletcher.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-zfs_fletcher.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-zfs_fletcher.obj `if test -f 'zfs_fletcher.c'; then $(CYGPATH_W) 'zfs_fletcher.c'; else $(CYGPATH_W) '$(srcdir)/zfs_fletcher.c'; fi`
+
+zfs_stage1_5_exec-fsys_zfs.o: fsys_zfs.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-fsys_zfs.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" -c -o zfs_stage1_5_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fsys_zfs.c' object='zfs_stage1_5_exec-fsys_zfs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-fsys_zfs.o `test -f 'fsys_zfs.c' || echo '$(srcdir)/'`fsys_zfs.c
+
+zfs_stage1_5_exec-fsys_zfs.obj: fsys_zfs.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ufs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-fsys_zfs.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" -c -o zfs_stage1_5_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fsys_zfs.c' object='zfs_stage1_5_exec-fsys_zfs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-fsys_zfs.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-fsys_zfs.obj `if test -f 'fsys_zfs.c'; then $(CYGPATH_W) 'fsys_zfs.c'; else $(CYGPATH_W) '$(srcdir)/fsys_zfs.c'; fi`
+
+zfs_stage1_5_exec-bios.o: bios.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-bios.o -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" -c -o zfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='bios.c' object='zfs_stage1_5_exec-bios.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-bios.o `test -f 'bios.c' || echo '$(srcdir)/'`bios.c
+
+zfs_stage1_5_exec-bios.obj: bios.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT zfs_stage1_5_exec-bios.obj -MD -MP -MF "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" -c -o zfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo" "$(DEPDIR)/zfs_stage1_5_exec-bios.Po"; else rm -f "$(DEPDIR)/zfs_stage1_5_exec-bios.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='bios.c' object='zfs_stage1_5_exec-bios.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/zfs_stage1_5_exec-bios.Po' tmpdepfile='$(DEPDIR)/zfs_stage1_5_exec-bios.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o zfs_stage1_5_exec-bios.obj `if test -f 'bios.c'; then $(CYGPATH_W) 'bios.c'; else $(CYGPATH_W) '$(srcdir)/bios.c'; fi`
+
 vstafs_stage1_5_exec-common.o: common.c
 @am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vstafs_stage1_5_exec_CFLAGS) $(CFLAGS) -MT vstafs_stage1_5_exec-common.o -MD -MP -MF "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" -c -o vstafs_stage1_5_exec-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo" "$(DEPDIR)/vstafs_stage1_5_exec-common.Po"; else rm -f "$(DEPDIR)/vstafs_stage1_5_exec-common.Tpo"; exit 1; fi
--- a/usr/src/grub/grub-0.95/stage2/Makefile.solaris	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/Makefile.solaris	Wed Mar 28 12:48:13 2007 -0700
@@ -18,6 +18,7 @@
 LIBS		=
 
 FSYS_CFLAGS	= -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS=1 \
+		  -DFSYS_ZFS=1 \
 		  -DFSYS_UFS2=1 -DFSYS_REISERFS=1 -DFSYS_ISO9660=1 \
 		  -DUSE_MD5_PASSWORDS=1
 $(STAGE2_NETBOOT)TFTP_CFLAGS	= -DFSYS_TFTP=1
@@ -30,6 +31,7 @@
 SERIAL_CFLAGS	= -DSUPPORT_SERIAL=1
 GRUB_CFLAGS	= -O2 -I../lib -DGRUB_UTIL=1 \
 		  -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_ISO9660=1 \
+		  -DFSYS_ZFS=1 \
 		  -DFSYS_REISERFS=1 -DFSYS_UFS=1 -DFSYS_UFS2=1 \
 		  -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1
 $(OPTION_FS)GRUB_CFLAGS	+= -DFSYS_MINIX=1 -DFSYS_JFS=1 -DFSYS_XFS=1 \
@@ -71,6 +73,10 @@
 		  libgrub_a-fsys_jfs.o		\
 		  libgrub_a-fsys_minix.o	\
 		  libgrub_a-fsys_reiserfs.o	\
+		  libgrub_a-zfs_sha256.o	\
+		  libgrub_a-zfs_lzjb.o		\
+		  libgrub_a-zfs_fletcher.o	\
+		  libgrub_a-fsys_zfs.o		\
 		  libgrub_a-fsys_ufs.o		\
 		  libgrub_a-fsys_ufs2.o		\
 		  libgrub_a-fsys_vstafs.o	\
@@ -99,6 +105,7 @@
 		  $(STAGE2_ELTORITO_DATA)	\
 		  $(UFS2_STAGE1_5_DATA)		\
 		  $(UFS_STAGE1_5_DATA)		\
+		  $(ZFS_STAGE1_5_DATA)		\
 		  $(VSTAFS_STAGE1_5_DATA)	\
 		  $(XFS_STAGE1_5_DATA)
 
@@ -123,11 +130,12 @@
 		  $(NBLOADER_EXEC)		\
 		  $(PRE_STAGE2_EXEC)		\
 		  $(PXELOADER_EXEC)		\
-		  $(REISERFS_STAGE1_5_EXEC)	\
+ 		  $(REISERFS_STAGE1_5_EXEC)	\
 		  $(START_EXEC)			\
 		  $(START_ELTORITO_EXEC)	\
 		  $(UFS2_STAGE1_5_EXEC)		\
 		  $(UFS_STAGE1_5_EXEC)		\
+		  $(ZFS_STAGE1_5_EXEC)		\
 		  $(VSTAFS_STAGE1_5_EXEC)	\
 		  $(XFS_STAGE1_5_EXEC)
 
@@ -154,6 +162,10 @@
 			  diskless_exec-fsys_jfs.o	\
 			  diskless_exec-fsys_minix.o	\
 			  diskless_exec-fsys_reiserfs.o	\
+			  diskless_exec-zfs_sha256.o	\
+			  diskless_exec-zfs_lzjb.o	\
+			  diskless_exec-zfs_fletcher.o	\
+			  diskless_exec-fsys_zfs.o	\
 			  diskless_exec-fsys_ufs.o	\
 			  diskless_exec-fsys_ufs2.o	\
 			  diskless_exec-fsys_vstafs.o	\
@@ -361,6 +373,10 @@
 			  pre_stage2_exec-fsys_jfs.o \
 			  pre_stage2_exec-fsys_minix.o \
 			  pre_stage2_exec-fsys_reiserfs.o \
+			  pre_stage2_exec-zfs_sha256.o \
+			  pre_stage2_exec-zfs_lzjb.o \
+			  pre_stage2_exec-zfs_fletcher.o \
+			  pre_stage2_exec-fsys_zfs.o \
 			  pre_stage2_exec-fsys_ufs.o \
 			  pre_stage2_exec-fsys_ufs2.o \
 			  pre_stage2_exec-fsys_vstafs.o \
@@ -402,26 +418,26 @@
 #
 # ReiserFS stage 1.5
 #
-REISERFS_STAGE1_5_DATA	= reiserfs_stage1_5
-REISERFS_STAGE1_5_EXEC	= reiserfs_stage1_5.exec
+REISERFS_STAGE1_5_DATA  = reiserfs_stage1_5
+REISERFS_STAGE1_5_EXEC  = reiserfs_stage1_5.exec
 
 REISERFS_STAGE1_5_ASMOBJS = reiserfs_stage1_5_exec-asm.o \
 			    reiserfs_stage1_5_exec-start.o
 
-REISERFS_STAGE1_5_OBJS	= reiserfs_stage1_5_exec-bios.o \
+REISERFS_STAGE1_5_OBJS  = reiserfs_stage1_5_exec-bios.o \
 			  reiserfs_stage1_5_exec-char_io.o \
 			  reiserfs_stage1_5_exec-common.o \
 			  reiserfs_stage1_5_exec-disk_io.o \
 			  reiserfs_stage1_5_exec-fsys_reiserfs.o \
 			  reiserfs_stage1_5_exec-stage1_5.o
-
+ 
 $(REISERFS_STAGE1_5_EXEC) := LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK)
-
+ 
 $(REISERFS_STAGE1_5_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) \
 				$(STAGE1_5_CFLAGS) \
 				-DFSYS_REISERFS=1 -DNO_BLOCK_FILES=1
-
-$(REISERFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
+ 
+$(REISERFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS)	\
 				-DFSYS_REISERFS=1 -DNO_BLOCK_FILES=1
 
 #
@@ -503,6 +519,33 @@
 				-DFSYS_UFS=1 -DNO_BLOCK_FILES=1
 
 #
+# ZFS stage 1.5
+#
+ZFS_STAGE1_5_DATA	= zfs_stage1_5
+ZFS_STAGE1_5_EXEC	= zfs_stage1_5.exec
+
+ZFS_STAGE1_5_ASMOBJS	= zfs_stage1_5_exec-asm.o \
+			  zfs_stage1_5_exec-start.o
+
+ZFS_STAGE1_5_OBJS	= zfs_stage1_5_exec-bios.o \
+			  zfs_stage1_5_exec-char_io.o \
+			  zfs_stage1_5_exec-common.o \
+			  zfs_stage1_5_exec-disk_io.o \
+			  zfs_stage1_5_exec-zfs_sha256.o \
+			  zfs_stage1_5_exec-zfs_lzjb.o \
+			  zfs_stage1_5_exec-zfs_fletcher.o \
+			  zfs_stage1_5_exec-fsys_zfs.o \
+			  zfs_stage1_5_exec-stage1_5.o
+
+$(ZFS_STAGE1_5_EXEC)	:= LDFLAGS = $(BASE_LDFLAGS) $(STAGE1_5_LINK)
+
+$(ZFS_STAGE1_5_ASMOBJS)	:= CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE1_5_CFLAGS) \
+				-DFSYS_ZFS=1 -DNO_BLOCK_FILES=1
+
+$(ZFS_STAGE1_5_OBJS)	:= CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
+				-DFSYS_ZFS=1 -DNO_BLOCK_FILES=1
+
+#
 # VSTa FS
 #
 VSTAFS_STAGE1_5_DATA	= vstafs_stage1_5
@@ -551,17 +594,20 @@
 				-DFSYS_XFS=1 -DNO_BLOCK_FILES=1
 
 
-INSTALL_TARGETS	= $(INSTALL_DATA:%=$(ROOT_BOOT_GRUB)/%)
+INSTALL_TARGETS	= $(INSTALL_DATA:%=$(ROOT_BOOT_GRUB)/%) \
+		$(SRC_ZFSINC_DIR)
 
 #
-# Source files to be installed in $(SRC_DIR).
+# Source files to be installed in $(ROOT_SRC).
 #
 SRC_DIR		= $(ROOT_SRC)/stage2
+SRC_ZFSINC_DIR	= $(SRC_DIR)/zfs-include
 SRC_FILES	= Makefile.am Makefile.in apic.h apm.S asm.S bios.c boot.c \
 		  builtins.c char_io.c cmdline.c common.c console.c defs.h \
 		  dir.h disk_inode.h disk_inode_ffs.h disk_io.c fat.h \
 		  filesys.h freebsd.h fs.h fsys_ext2fs.c fsys_fat.c \
 		  fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
+		  zfs_sha256.c zfs_lzjb.c zfs_fletcher.c fsys_zfs.c \
 		  fsys_reiserfs.c fsys_ufs.c fsys_ufs2.c fsys_vstafs.c \
 		  fsys_xfs.c graphics.c graphics.h gunzip.c hercules.c \
 		  hercules.h i386-elf.h imgact_aout.h iso9660.h jfs.h \
@@ -569,9 +615,13 @@
 		  pc_slice.h pxeloader.S serial.c serial.h setjmp.S shared.h \
 		  size_test smp-imps.c smp-imps.h stage1_5.c stage2.c \
 		  start.S start_eltorito.S term.h terminfo.c terminfo.h \
-		  tparm.c tparm.h ufs.h ufs2.h vstafs.h xfs.h
+		  tparm.c tparm.h fsys_zfs.h ufs.h ufs2.h vstafs.h xfs.h
+SRC_ZFSINC_FILES = dmu.h dmu_objset.h dnode.h dsl_dataset.h dsl_dir.h spa.h \
+		uberblock_impl.h vdev_impl.h zap_impl.h zap_leaf.h zfs.h \
+		zfs_acl.h zfs_znode.h zil.h zio.h zio_checksum.h
 
-INSTALL_TARGETS	+= $(SRC_FILES:%=$(SRC_DIR)/%)
+INSTALL_TARGETS	+= $(SRC_FILES:%=$(SRC_DIR)/%) \
+		$(SRC_ZFSINC_FILES:%=$(SRC_ZFSINC_DIR)/%)
 
 
 ###############################################################################
@@ -750,8 +800,8 @@
 #
 # ReiserFS stage 1.5
 #
-$(REISERFS_STAGE1_5_EXEC): $(REISERFS_STAGE1_5_ASMOBJS) \
-    $(REISERFS_STAGE1_5_OBJS)
+$(REISERFS_STAGE1_5_EXEC): $(REISERFS_STAGE1_5_ASMOBJS)	\
+	$(REISERFS_STAGE1_5_OBJS)
 	$(RM) $@
 	$(LINK) -o $@ $(REISERFS_STAGE1_5_ASMOBJS) $(REISERFS_STAGE1_5_OBJS) \
 	    $(LIBS)
@@ -828,6 +878,19 @@
 	$(CC) $(CFLAGS) -c -o $@ $(@:ufs_stage1_5_exec-%.o=%.c)
 
 #
+# ZFS stage 1.5
+#
+$(ZFS_STAGE1_5_EXEC): $(ZFS_STAGE1_5_ASMOBJS) $(ZFS_STAGE1_5_OBJS)
+	$(RM) $@
+	$(LINK) -o $@ $(ZFS_STAGE1_5_ASMOBJS) $(ZFS_STAGE1_5_OBJS) $(LIBS)
+
+$(ZFS_STAGE1_5_ASMOBJS): $$(@:zfs_stage1_5_exec-%.o=%.S)
+	$(CCAS) $(CCASFLAGS) -c -o $@ $(@:zfs_stage1_5_exec-%.o=%.S)
+
+$(ZFS_STAGE1_5_OBJS): $$(@:zfs_stage1_5_exec-%.o=%.c)
+	$(CC) $(CFLAGS) -c -o $@ $(@:zfs_stage1_5_exec-%.o=%.c)
+
+#
 # VSTa stage 1.5
 #
 $(VSTAFS_STAGE1_5_EXEC): $(VSTAFS_STAGE1_5_ASMOBJS) $(VSTAFS_STAGE1_5_OBJS)
@@ -863,10 +926,12 @@
 $(SRC_DIR)/%: $(SRC_DIR) %
 	$(INS.file)
 
-$(ROOT_BOOT_GRUB) $(SRC_DIR):
+$(SRC_ZFSINC_DIR)/%: $(SRC_ZFSINC_DIR) %
+	$(INS.file)
+
+$(ROOT_BOOT_GRUB) $(SRC_DIR) $(SRC_ZFSINC_DIR):
 	$(INS.dir)
 
-
 clean: _FORCE
 	$(RM) *.o $(BUILT_SOURCES) $(LIBRARIES) $(PROGRAMS) $(NOINSTALL_DATA)
 
--- a/usr/src/grub/grub-0.95/stage2/boot.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/boot.c	Wed Mar 28 12:48:13 2007 -0700
@@ -669,7 +669,12 @@
 	      tab_size = pu.elf->e_shentsize * pu.elf->e_shnum;
 	      
 	      grub_seek (pu.elf->e_shoff);
-	      if (grub_read ((char *) RAW_ADDR (cur_addr), tab_size)
+              /*
+	       * Should not need to call RAW_ADDR; cur_addr is already
+               * adjusted to account for grub_scratch_mem.
+	       * XXX Linux might calculate cur_addr differently.
+	       */
+	      if (grub_read ((char *) (cur_addr), tab_size)
 		  == tab_size)
 		{
 		  mbi.syms.e.addr = cur_addr;
@@ -697,8 +702,13 @@
 		      
 		      sec_size = shdr[i].sh_size;
 
+		      /*
+		       * Should not need to call RAW_ADDR; cur_addr is already
+		       * adjusted to account for grub_scratch_mem.
+		       * XXX Linux might calculate cur_addr differently.
+		       */
 		      if (! (memcheck (cur_addr, sec_size)
-			     && (grub_read ((char *) RAW_ADDR (cur_addr),
+			     && (grub_read ((char *) (cur_addr),
 					    sec_size)
 				 == sec_size)))
 			{
--- a/usr/src/grub/grub-0.95/stage2/builtins.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/builtins.c	Wed Mar 28 12:48:13 2007 -0700
@@ -113,6 +113,10 @@
   fallback_entryno = -1;
   fallback_entries[0] = -1;
   grub_timeout = -1;
+  current_rootpool[0] = '\0';
+  current_bootfs[0] = '\0';
+  current_bootfs_obj = 0;
+  is_zfs_mount = 0;
 }
 
 /* Check a password for correctness.  Returns 0 if password was
@@ -2630,6 +2634,56 @@
 };
 
 
+/*
+ * To boot from a ZFS root filesystem, the kernel$ or module$ commands
+ * must include "-B $ZFS-BOOTFS" to pass to the kernel:
+ *
+ * e.g.
+ * kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=ttya
+ *
+ * The expand_dollar_bootfs routine expands $ZFS-BOOTFS to
+ * "pool-name/zfs-rootfilesystem-object-num", e.g. "rootpool/85"
+ * so that in the kernel zfs_mountroot would know which zfs root
+ * filesystem to be mounted.
+ */
+static int
+expand_dollar_bootfs(char *in, char *out)
+{
+	char *token, *tmpout = out;
+	int outlen, blen;
+
+	outlen = strlen(in);
+	blen = current_bootfs_obj == 0 ? strlen(current_rootpool) :
+	    strlen(current_rootpool) + 11;
+
+	out[0] = '\0';
+	while (token = strstr(in, "$ZFS-BOOTFS")) {
+
+		if ((outlen += blen) > MAX_CMDLINE) {
+			errnum = ERR_WONT_FIT;
+			return (1);
+		}
+
+		token[0] = '\0';	
+		grub_sprintf(tmpout, "%s", in);
+		token[0] = '$';
+		in = token + 11; /* move over $ZFS-BOOTFS */
+		tmpout = out + strlen(out);
+
+		/* Note: %u only fits 32 bit integer; */ 
+		if (current_bootfs_obj > 0)
+			grub_sprintf(tmpout, "zfs-bootfs=%s/%u",
+			    current_rootpool, current_bootfs_obj);
+		else
+			grub_sprintf(tmpout, "zfs-bootfs=%s",
+			    current_rootpool);
+		tmpout = out + strlen(out); 
+	}
+
+	strncat(out, in, MAX_CMDLINE);
+	return (0);
+}
+
 /* kernel */
 static int
 kernel_func (char *arg, int flags)
@@ -2699,7 +2753,7 @@
   if (kernel_type == KERNEL_TYPE_NONE)
     return 1;
 
-  mb_cmdline += len + 1;
+  mb_cmdline += grub_strlen(mb_cmdline) + 1;
   return 0;
 }
 
@@ -2949,10 +3003,9 @@
 	return (ret);
 }
 
-static int
-expand_arch (char *arg, int flags, int func())
+static void
+expand_arch (char *arg, char *newarg)
 {
-  char newarg[MAX_CMDLINE];	/* everything boils down to MAX_CMDLINE */
   char *index;
 
   newarg[0] = '\0';
@@ -2970,17 +3023,29 @@
   }
 
   strncat(newarg, arg, MAX_CMDLINE);
-
-  grub_printf("loading %s\n", newarg);
-
-  return (func(newarg, flags));
+  return;
 }
 
 /* kernel$ */
 static int
 kernel_dollar_func (char *arg, int flags)
 {
-  return (expand_arch(arg, flags, (void *)&kernel_func));
+  char newarg[MAX_CMDLINE];	/* everything boils down to MAX_CMDLINE */
+
+  grub_printf("loading '%s' ...\n", arg);
+  expand_arch(arg, newarg);
+
+  if (kernel_func(newarg, flags))
+	return (1);
+
+  mb_cmdline = (char *)MB_CMDLINE_BUF;
+  if (expand_dollar_bootfs(newarg, mb_cmdline))
+	return (1);
+
+  grub_printf("'%s' is loaded\n", mb_cmdline);
+  mb_cmdline += grub_strlen(mb_cmdline) + 1;
+
+  return (0);
 }
 
 static struct builtin builtin_kernel_dollar =
@@ -3177,7 +3242,8 @@
       grub_memmove (mb_cmdline, arg, len + 1);
       if (! load_module (arg, mb_cmdline))
 	return 1;
-      mb_cmdline += len + 1;
+
+      mb_cmdline += grub_strlen(mb_cmdline) + 1;
       break;
 
     case KERNEL_TYPE_LINUX:
@@ -3211,7 +3277,23 @@
 static int
 module_dollar_func (char *arg, int flags)
 {
-  return (expand_arch(arg, flags, (void *)&module_func));
+  char newarg[MAX_CMDLINE];	/* everything boils down to MAX_CMDLINE */
+  char *cmdline_sav;
+
+  grub_printf("loading '%s' ...\n", arg);
+  expand_arch(arg, newarg);
+
+  cmdline_sav = (char *)mb_cmdline;
+  if (module_func(newarg, flags))
+	return (1);
+
+  if (expand_dollar_bootfs(newarg, cmdline_sav))
+	return (1);
+
+  grub_printf("'%s' is loaded\n", (char *)cmdline_sav);
+  mb_cmdline += grub_strlen(cmdline_sav) + 1;
+
+  return (0);
 }
 
 static struct builtin builtin_module_dollar =
@@ -3770,6 +3852,7 @@
 static int
 root_func (char *arg, int flags)
 {
+  is_zfs_mount = 0;
   return real_root_func (arg, 1);
 }
 
@@ -3792,6 +3875,56 @@
 };
 
 
+/*
+ * COMMAND to override the default root filesystem for ZFS
+ *	bootfs pool/fs
+ */
+static int
+bootfs_func (char *arg, int flags)
+{
+	int hdbias = 0;
+	char *biasptr;
+	char *next;
+
+	if (! *arg) {
+	    if (current_bootfs[0] != '\0')
+		grub_printf ("The zfs boot filesystem is set to '%s'.\n",
+				current_bootfs);
+	    else if (current_rootpool[0] != 0 && current_bootfs_obj != 0)
+		grub_printf("The zfs boot filesystem is <default: %s/%u>.",
+				current_rootpool, current_bootfs_obj);
+	    else if (current_rootpool[0] != 0 && current_bootfs_obj == 0)
+		grub_printf("The zfs boot pool is '%s'.", current_rootpool);
+	    else
+		grub_printf ("The zfs boot filesystem will be <default>.\n");
+
+	    return (1);
+	}
+
+	/* Verify the zfs filesystem name */
+	if (arg[0] == '/' || arg[0] == '\0') {
+		errnum = ERR_BAD_ARGUMENT;
+		return 0;
+	}
+
+	if (set_bootfs(arg) == 0) {
+		errnum = ERR_BAD_ARGUMENT;
+		return 0;
+	}
+
+	return (1);
+}
+
+static struct builtin builtin_bootfs =
+{
+  "bootfs",
+  bootfs_func,
+  BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
+  "bootfs [ZFSBOOTFS]",
+  "Set the current zfs boot filesystem to ZFSBOOTFS (rootpool/rootfs)."
+};
+
+
 /* rootnoverify */
 static int
 rootnoverify_func (char *arg, int flags)
@@ -3829,6 +3962,11 @@
   int saved_offsets[2];
   int saved_lengths[2];
 
+  /* not supported for zfs root */
+  if (is_zfs_mount == 1) {
+	return (0); /* no-op */
+  }
+
   /* Save sector information about at most two sectors.  */
   auto void disk_read_savesect_func (int sector, int offset, int length);
   void disk_read_savesect_func (int sector, int offset, int length)
@@ -5398,6 +5536,7 @@
 #endif
   &builtin_blocklist,
   &builtin_boot,
+  &builtin_bootfs,
 #ifdef SUPPORT_NETBOOT
   &builtin_bootp,
 #endif /* SUPPORT_NETBOOT */
--- a/usr/src/grub/grub-0.95/stage2/char_io.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/char_io.c	Wed Mar 28 12:48:13 2007 -0700
@@ -1056,7 +1056,10 @@
    a static library supporting minimal standard C functions and link
    each image with the library. Complicated things should be left to
    computer, definitely. -okuji  */
-#if !defined(STAGE1_5) || defined(FSYS_VSTAFS)
+
+/* Make some grub_str* routines available to ZFS plug-in as well */
+
+#if !defined(STAGE1_5) || defined(FSYS_VSTAFS) || defined(FSYS_ZFS)
 int
 grub_strcmp (const char *s1, const char *s2)
 {
@@ -1072,7 +1075,20 @@
 
   return 0;
 }
-#endif /* ! STAGE1_5 || FSYS_VSTAFS */
+
+int
+grub_strncmp(const char *s1, const char *s2, int n)
+{
+        if (s1 == s2)
+                return (0);
+        n++;
+        while (--n != 0 && *s1 == *s2++)
+                if (*s1++ == '\0')
+                        return (0);
+        return ((n == 0) ? 0 : *(unsigned char *)s1 - *(unsigned char *)--s2);
+}
+
+#endif /* ! STAGE1_5 || FSYS_VSTAFS || defined(FSYS_ZFS) */
 
 #ifndef STAGE1_5
 /* Wait for a keypress and return its code.  */
@@ -1210,21 +1226,7 @@
   return 1;
 }
 
-#ifndef STAGE1_5
-/* Terminate the string STR with NUL.  */
-int
-nul_terminate (char *str)
-{
-  int ch;
-  
-  while (*str && ! grub_isspace (*str))
-    str++;
-
-  ch = *str;
-  *str = 0;
-  return ch;
-}
-
+#if !defined(STAGE1_5) || defined(FSYS_ZFS)
 char *
 grub_strstr (const char *s1, const char *s2)
 {
@@ -1246,6 +1248,22 @@
 
   return 0;
 }
+#endif /* !defined(STAGE1_5) || defined(FSYS_ZFS) */
+
+#ifndef STAGE1_5
+/* Terminate the string STR with NUL.  */
+int
+nul_terminate (char *str)
+{
+  int ch;
+  
+  while (*str && ! grub_isspace (*str))
+    str++;
+
+  ch = *str;
+  *str = 0;
+  return ch;
+}
 
 int
 grub_strlen (const char *str)
--- a/usr/src/grub/grub-0.95/stage2/common.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/common.c	Wed Mar 28 12:48:13 2007 -0700
@@ -92,7 +92,9 @@
   [ERR_UNRECOGNIZED] = "Unrecognized command",
   [ERR_WONT_FIT] = "Selected item cannot fit into memory",
   [ERR_WRITE] = "Disk write error",
-  [ERR_BAD_GZIP_CRC] = "Incorrect gunzip CRC checksum"
+  [ERR_BAD_GZIP_CRC] = "Incorrect gunzip CRC checksum",
+  [ERR_FILESYSTEM_NOT_FOUND] = "File System not found"
+    /* this zfs file system is not found in the pool of the device */
 };
 
 
--- a/usr/src/grub/grub-0.95/stage2/disk_io.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/disk_io.c	Wed Mar 28 12:48:13 2007 -0700
@@ -77,6 +77,9 @@
 # ifdef FSYS_UFS2
   {"ufs2", ufs2_mount, ufs2_read, ufs2_dir, 0, ufs2_embed},
 # endif
+# ifdef FSYS_ZFS
+  {"zfs", zfs_mount, zfs_read, zfs_open, 0, zfs_embed},
+# endif
 # ifdef FSYS_ISO9660
   {"iso9660", iso9660_mount, iso9660_read, iso9660_dir, 0, 0},
 # endif
@@ -120,6 +123,12 @@
 
 int current_slice;
 
+/* ZFS root filesystem for booting */
+char current_rootpool[MAXNAMELEN];
+char current_bootfs[MAXNAMELEN];
+uint64_t current_bootfs_obj;
+int is_zfs_mount;
+
 /* disk buffer parameters */
 int buf_drive = -1;
 int buf_track;
@@ -148,6 +157,7 @@
   if (byte_len <= 0)
     return 1;
 
+  errnum = ERR_NONE;
   while (byte_len > 0 && !errnum)
     {
       int soff, num_sect, track, size = byte_len;
@@ -1003,6 +1013,12 @@
 part_choice;
 #endif /* ! STAGE1_5 */
 
+int
+set_bootfs(char *fsname)
+{
+	grub_memmove(current_bootfs, fsname, MAXNAMELEN);
+}
+
 char *
 set_device (char *device)
 {
--- a/usr/src/grub/grub-0.95/stage2/filesys.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/filesys.h	Wed Mar 28 12:48:13 2007 -0700
@@ -50,6 +50,16 @@
 #define FSYS_UFS2_NUM 0
 #endif
 
+#ifdef FSYS_ZFS
+#define FSYS_ZFS_NUM 1
+int zfs_mount (void);
+int zfs_read (char *buf, int len);
+int zfs_open (char *dirname);
+int zfs_embed (int *start_sector, int needed_sectors);
+#else
+#define FSYS_ZFS_NUM 0
+#endif
+
 #ifdef FSYS_FAT
 #define FSYS_FAT_NUM 1
 int fat_mount (void);
@@ -138,7 +148,8 @@
 #define NUM_FSYS	\
   (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM	\
    + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM	\
-   + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS_NUM + FSYS_UFS2_NUM)
+   + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS_NUM + FSYS_UFS2_NUM \
+   + FSYS_ZFS_NUM)
 #endif
 
 /* defines for the block filesystem info area */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/fsys_zfs.c	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,1197 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * The zfs plug-in routines for GRUB are:
+ *
+ * zfs_mount() - locates a valid uberblock of the root pool and reads
+ *		in its MOS at the memory address MOS.
+ *
+ * zfs_open() - locates a plain file object by following the MOS
+ *		and places its dnode at the memory address DNODE.
+ *
+ * zfs_read() - read in the data blocks pointed by the DNODE.
+ *
+ * ZFS_SCRATCH is used as a working area.
+ *
+ * (memory addr)   MOS      DNODE	ZFS_SCRATCH
+ *		    |         |          |
+ *	    +-------V---------V----------V---------------+
+ *   memory |       | dnode   | dnode    |  scratch      |
+ *	    |       | 512B    | 512B     |  area         |
+ *	    +--------------------------------------------+
+ */
+
+#ifdef	FSYS_ZFS
+
+#include "shared.h"
+#include "filesys.h"
+#include "fsys_zfs.h"
+
+/* cache for a file block of the currently zfs_open()-ed file */
+static void *file_buf = NULL;
+static uint64_t file_start = 0;
+static uint64_t file_end = 0;
+
+/* cache for a dnode block */
+static dnode_phys_t *dnode_buf = NULL;
+static dnode_phys_t *dnode_mdn = NULL;
+static uint64_t dnode_start = 0;
+static uint64_t dnode_end = 0;
+
+static char *stackbase;
+
+decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] =
+{
+	{"noop", 0},
+	{"on", lzjb_decompress}, 	/* ZIO_COMPRESS_ON */
+	{"off", 0},
+	{"lzjb", lzjb_decompress}	/* ZIO_COMPRESS_LZJB */
+};
+
+/*
+ * Our own version of bcmp().
+ */
+static int
+zfs_bcmp(const void *s1, const void *s2, size_t n)
+{
+	const uchar_t *ps1 = s1;
+	const uchar_t *ps2 = s2;
+
+	if (s1 != s2 && n != 0) {
+		do {
+			if (*ps1++ != *ps2++)
+				return (1);
+		} while (--n != 0);
+	}
+
+	return (0);
+}
+
+/*
+ * Our own version of log2().  Same thing as highbit()-1.
+ */
+static int
+zfs_log2(uint64_t num)
+{
+	int i = 0;
+
+	while (num > 1) {
+		i++;
+		num = num >> 1;
+	}
+
+	return (i);
+}
+
+/* Checksum Functions */
+static void
+zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp)
+{
+	ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0);
+}
+
+/* Checksum Table and Values */
+zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
+	NULL,			NULL,			0, 0,	"inherit",
+	NULL,			NULL,			0, 0,	"on",
+	zio_checksum_off,	zio_checksum_off,	0, 0,	"off",
+	zio_checksum_SHA256,	zio_checksum_SHA256,	1, 1,	"label",
+	zio_checksum_SHA256,	zio_checksum_SHA256,	1, 1,	"gang_header",
+	fletcher_2_native,	fletcher_2_byteswap,	0, 1,	"zilog",
+	fletcher_2_native,	fletcher_2_byteswap,	0, 0,	"fletcher2",
+	fletcher_4_native,	fletcher_4_byteswap,	1, 0,	"fletcher4",
+	zio_checksum_SHA256,	zio_checksum_SHA256,	1, 0,	"SHA256",
+};
+
+/*
+ * zio_checksum_verify: Provides support for checksum verification.
+ *
+ * Fletcher2, Fletcher4, and SHA256 are supported.
+ *
+ * Return:
+ * 	-1 = Failure
+ *	 0 = Success
+ */
+static int
+zio_checksum_verify(blkptr_t *bp, char *data, int size)
+{
+	zio_cksum_t zc = bp->blk_cksum;
+	uint32_t checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER :
+	    BP_GET_CHECKSUM(bp);
+	int byteswap = BP_SHOULD_BYTESWAP(bp);
+	zio_block_tail_t *zbt = (zio_block_tail_t *)(data + size) - 1;
+	zio_checksum_info_t *ci = &zio_checksum_table[checksum];
+	zio_cksum_t actual_cksum, expected_cksum;
+
+	/* byteswap is not supported */
+	if (byteswap)
+		return (-1);
+
+	if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL)
+		return (-1);
+
+	if (ci->ci_zbt) {
+		if (checksum == ZIO_CHECKSUM_GANG_HEADER) {
+			/*
+			 * 'gang blocks' is not supported.
+			 */
+			return (-1);
+		}
+
+		if (zbt->zbt_magic == BSWAP_64(ZBT_MAGIC)) {
+			/* byte swapping is not supported */
+			return (-1);
+		} else {
+			expected_cksum = zbt->zbt_cksum;
+			zbt->zbt_cksum = zc;
+			ci->ci_func[0](data, size, &actual_cksum);
+			zbt->zbt_cksum = expected_cksum;
+		}
+		zc = expected_cksum;
+
+	} else {
+		if (BP_IS_GANG(bp))
+			return (-1);
+		ci->ci_func[byteswap](data, size, &actual_cksum);
+	}
+
+	if ((actual_cksum.zc_word[0] - zc.zc_word[0]) |
+	    (actual_cksum.zc_word[1] - zc.zc_word[1]) |
+	    (actual_cksum.zc_word[2] - zc.zc_word[2]) |
+	    (actual_cksum.zc_word[3] - zc.zc_word[3]))
+		return (-1);
+
+	return (0);
+}
+
+/*
+ * vdev_label_offset takes "offset" (the offset within a vdev_label) and
+ * returns its physical disk offset (starting from the beginning of the vdev).
+ *
+ * Input:
+ *	psize	: Physical size of this vdev
+ *      l	: Label Number (0-3)
+ *	offset	: The offset with a vdev_label in which we want the physical
+ *		  address
+ * Return:
+ * 	Success : physical disk offset
+ * 	Failure : errnum = ERR_BAD_ARGUMENT, return value is meaningless
+ */
+uint64_t
+vdev_label_offset(uint64_t psize, int l, uint64_t offset)
+{
+	/* XXX Need to add back label support! */
+	if (l >= VDEV_LABELS/2 || offset > sizeof (vdev_label_t)) {
+		errnum = ERR_BAD_ARGUMENT;
+		return (0);
+	}
+
+	return (offset + l * sizeof (vdev_label_t) + (l < VDEV_LABELS / 2 ?
+	    0 : psize - VDEV_LABELS * sizeof (vdev_label_t)));
+
+}
+
+/*
+ * vdev_uberblock_compare takes two uberblock structures and returns an integer
+ * indicating the more recent of the two.
+ * 	Return Value = 1 if ub2 is more recent
+ * 	Return Value = -1 if ub1 is more recent
+ * The most recent uberblock is determined using its transaction number and
+ * timestamp.  The uberblock with the highest transaction number is
+ * considered "newer".  If the transaction numbers of the two blocks match, the
+ * timestamps are compared to determine the "newer" of the two.
+ */
+static int
+vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2)
+{
+	if (ub1->ub_txg < ub2->ub_txg)
+		return (-1);
+	if (ub1->ub_txg > ub2->ub_txg)
+		return (1);
+
+	if (ub1->ub_timestamp < ub2->ub_timestamp)
+		return (-1);
+	if (ub1->ub_timestamp > ub2->ub_timestamp)
+		return (1);
+
+	return (0);
+}
+
+/*
+ * Three pieces of information are needed to verify an uberblock: the magic
+ * number, the version number, and the checksum.
+ *
+ * Currently Implemented: version number, magic number
+ * Need to Implement: checksum
+ *
+ * Return:
+ *     0 - Success
+ *    -1 - Failure
+ */
+static int
+uberblock_verify(uberblock_phys_t *ub, int offset)
+{
+
+	uberblock_t *uber = &ub->ubp_uberblock;
+	blkptr_t bp;
+
+	BP_ZERO(&bp);
+	BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL);
+	BP_SET_BYTEORDER(&bp, ZFS_HOST_BYTEORDER);
+	ZIO_SET_CHECKSUM(&bp.blk_cksum, offset, 0, 0, 0);
+
+	if (zio_checksum_verify(&bp, (char *)ub, UBERBLOCK_SIZE) != 0)
+		return (-1);
+
+	if (uber->ub_magic == UBERBLOCK_MAGIC &&
+	    uber->ub_version >= ZFS_VERSION_1 &&
+	    uber->ub_version <= ZFS_VERSION)
+		return (0);
+
+	return (-1);
+}
+
+/*
+ * Find the best uberblock.
+ * Return:
+ *    Success - Pointer to the best uberblock.
+ *    Failure - NULL
+ */
+static uberblock_phys_t *
+find_bestub(uberblock_phys_t *ub_array, int label)
+{
+	uberblock_phys_t *ubbest = NULL;
+	int i, offset;
+
+	for (i = 0; i < (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT); i++) {
+		offset = vdev_label_offset(0, label, VDEV_UBERBLOCK_OFFSET(i));
+		if (errnum == ERR_BAD_ARGUMENT)
+			return (NULL);
+		if (uberblock_verify(&ub_array[i], offset) == 0) {
+			if (ubbest == NULL) {
+				ubbest = &ub_array[i];
+			} else {
+				if (vdev_uberblock_compare(
+				    &(ub_array[i].ubp_uberblock),
+				    &(ubbest->ubp_uberblock)) > 0)
+					ubbest = &ub_array[i];
+			}
+		}
+	}
+
+	return (ubbest);
+}
+
+/*
+ * Read in a block and put its uncompressed data in buf.
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+static int
+zio_read(blkptr_t *bp, void *buf, char *stack)
+{
+	uint64_t offset, sector;
+	int psize, lsize;
+	int i, comp, cksum;
+
+	psize = BP_GET_PSIZE(bp);
+	lsize = BP_GET_LSIZE(bp);
+	comp = BP_GET_COMPRESS(bp);
+	cksum = BP_GET_CHECKSUM(bp);
+
+	/* pick a good dva from the block pointer */
+	for (i = 0; i < SPA_DVAS_PER_BP; i++) {
+
+		if (bp->blk_dva[i].dva_word[0] == 0 &&
+		    bp->blk_dva[i].dva_word[1] == 0)
+			continue;
+
+		/* read in a block */
+		offset = DVA_GET_OFFSET(&bp->blk_dva[i]);
+		sector =  DVA_OFFSET_TO_PHYS_SECTOR(offset);
+
+		if (comp != ZIO_COMPRESS_OFF) {
+
+			if (devread(sector, 0, psize, stack) == 0)
+				continue;
+			if (zio_checksum_verify(bp, stack, psize) != 0)
+				continue;
+			decomp_table[comp].decomp_func(stack, buf, psize,
+			    lsize);
+		} else {
+			if (devread(sector, 0, psize, buf) == 0)
+				continue;
+			if (zio_checksum_verify(bp, buf, psize) != 0)
+				continue;
+		}
+		return (0);
+	}
+
+	return (ERR_FSYS_CORRUPT);
+}
+
+/*
+ * Get the block from a block id.
+ * push the block onto the stack.
+ *
+ * Return:
+ * 	0 - success
+ * 	errnum - failure
+ */
+static int
+dmu_read(dnode_phys_t *dn, uint64_t blkid, void *buf, char *stack)
+{
+	int idx, level;
+	blkptr_t *bp_array = dn->dn_blkptr;
+	int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT;
+	blkptr_t *bp, *tmpbuf;
+
+	bp = (blkptr_t *)stack;
+	stack += sizeof (blkptr_t);
+
+	tmpbuf = (blkptr_t *)stack;
+	stack += 1<<dn->dn_indblkshift;
+
+	for (level = dn->dn_nlevels - 1; level >= 0; level--) {
+		idx = (blkid >> (epbs * level)) & ((1<<epbs)-1);
+		*bp = bp_array[idx];
+		if (level == 0)
+			tmpbuf = buf;
+		if (errnum = zio_read(bp, tmpbuf, stack))
+			return (errnum);
+
+		bp_array = tmpbuf;
+	}
+
+	return (0);
+}
+
+/*
+ * mzap_lookup: Looks up property described by "name" and returns the value
+ * in "value".
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+static int
+mzap_lookup(mzap_phys_t *zapobj, int objsize, char *name,
+	uint64_t *value)
+{
+	int i, chunks;
+	mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk;
+
+	chunks = objsize/MZAP_ENT_LEN - 1;
+	for (i = 0; i < chunks; i++) {
+		if (grub_strcmp(mzap_ent[i].mze_name, name) == 0) {
+			*value = mzap_ent[i].mze_value;
+			return (0);
+		}
+	}
+
+	return (ERR_FSYS_CORRUPT);
+}
+
+static uint64_t
+zap_hash(uint64_t salt, const char *name)
+{
+	static uint64_t table[256];
+	const uint8_t *cp;
+	uint8_t c;
+	uint64_t crc = salt;
+
+	if (table[128] == 0) {
+		uint64_t *ct;
+		int i, j;
+		for (i = 0; i < 256; i++) {
+			for (ct = table + i, *ct = i, j = 8; j > 0; j--)
+				*ct = (*ct >> 1) ^ (-(*ct & 1) &
+				    ZFS_CRC64_POLY);
+		}
+	}
+
+	if (crc == 0 || table[128] != ZFS_CRC64_POLY) {
+		errnum = ERR_FSYS_CORRUPT;
+		return (0);
+	}
+
+	for (cp = (const uint8_t *)name; (c = *cp) != '\0'; cp++)
+		crc = (crc >> 8) ^ table[(crc ^ c) & 0xFF];
+
+	/*
+	 * Only use 28 bits, since we need 4 bits in the cookie for the
+	 * collision differentiator.  We MUST use the high bits, since
+	 * those are the onces that we first pay attention to when
+	 * chosing the bucket.
+	 */
+	crc &= ~((1ULL << (64 - ZAP_HASHBITS)) - 1);
+
+	return (crc);
+}
+
+/*
+ * Only to be used on 8-bit arrays.
+ * array_len is actual len in bytes (not encoded le_value_length).
+ * buf is null-terminated.
+ */
+static int
+zap_leaf_array_equal(zap_leaf_phys_t *l, int blksft, int chunk,
+    int array_len, const char *buf)
+{
+	int bseen = 0;
+
+	while (bseen < array_len) {
+		struct zap_leaf_array *la =
+		    &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array;
+		int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES);
+
+		if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft))
+			return (0);
+
+		if (zfs_bcmp(la->la_array, buf + bseen, toread) != 0)
+			break;
+		chunk = la->la_next;
+		bseen += toread;
+	}
+	return (bseen == array_len);
+}
+
+/*
+ * Given a zap_leaf_phys_t, walk thru the zap leaf chunks to get the
+ * value for the property "name".
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+int
+zap_leaf_lookup(zap_leaf_phys_t *l, int blksft, uint64_t h,
+    const char *name, uint64_t *value)
+{
+	uint16_t chunk;
+	struct zap_leaf_entry *le;
+
+	/* Verify if this is a valid leaf block */
+	if (l->l_hdr.lh_block_type != ZBT_LEAF)
+		return (ERR_FSYS_CORRUPT);
+	if (l->l_hdr.lh_magic != ZAP_LEAF_MAGIC)
+		return (ERR_FSYS_CORRUPT);
+
+	for (chunk = l->l_hash[LEAF_HASH(blksft, h)];
+	    chunk != CHAIN_END; chunk = le->le_next) {
+
+		if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft))
+			return (ERR_FSYS_CORRUPT);
+
+		le = ZAP_LEAF_ENTRY(l, blksft, chunk);
+
+		/* Verify the chunk entry */
+		if (le->le_type != ZAP_CHUNK_ENTRY)
+			return (ERR_FSYS_CORRUPT);
+
+		if (le->le_hash != h)
+			continue;
+
+		if (zap_leaf_array_equal(l, blksft, le->le_name_chunk,
+		    le->le_name_length, name)) {
+
+			struct zap_leaf_array *la;
+			uint8_t *ip;
+
+			if (le->le_int_size != 8 || le->le_value_length != 1)
+				return (ERR_FSYS_CORRUPT);
+
+			/* get the uint64_t property value */
+			la = &ZAP_LEAF_CHUNK(l, blksft,
+			    le->le_value_chunk).l_array;
+			ip = la->la_array;
+
+			*value = (uint64_t)ip[0] << 56 | (uint64_t)ip[1] << 48 |
+			    (uint64_t)ip[2] << 40 | (uint64_t)ip[3] << 32 |
+			    (uint64_t)ip[4] << 24 | (uint64_t)ip[5] << 16 |
+			    (uint64_t)ip[6] << 8 | (uint64_t)ip[7];
+
+			return (0);
+		}
+	}
+
+	return (ERR_FSYS_CORRUPT);
+}
+
+/*
+ * Fat ZAP lookup
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+int
+fzap_lookup(dnode_phys_t *zap_dnode, zap_phys_t *zap,
+    char *name, uint64_t *value, char *stack)
+{
+	zap_leaf_phys_t *l;
+	uint64_t hash, idx, blkid;
+	int blksft = zfs_log2(zap_dnode->dn_datablkszsec << DNODE_SHIFT);
+
+	/* Verify if this is a fat zap header block */
+	if (zap->zap_magic != (uint64_t)ZAP_MAGIC)
+		return (ERR_FSYS_CORRUPT);
+
+	hash = zap_hash(zap->zap_salt, name);
+	if (errnum)
+		return (errnum);
+
+	/* get block id from index */
+	if (zap->zap_ptrtbl.zt_numblks != 0) {
+		/* external pointer tables not supported */
+		return (ERR_FSYS_CORRUPT);
+	}
+	idx = ZAP_HASH_IDX(hash, zap->zap_ptrtbl.zt_shift);
+	blkid = ((uint64_t *)zap)[idx + (1<<(blksft-3-1))];
+
+	/* Get the leaf block */
+	l = (zap_leaf_phys_t *)stack;
+	stack += 1<<blksft;
+	if (errnum = dmu_read(zap_dnode, blkid, l, stack))
+		return (errnum);
+
+	return (zap_leaf_lookup(l, blksft, hash, name, value));
+}
+
+/*
+ * Read in the data of a zap object and find the value for a matching
+ * property name.
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+static int
+zap_lookup(dnode_phys_t *zap_dnode, char *name, uint64_t *val, char *stack)
+{
+	uint64_t block_type;
+	int size;
+	void *zapbuf;
+
+	/* Read in the first block of the zap object data. */
+	zapbuf = stack;
+	size = zap_dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT;
+	stack += size;
+	if (errnum = dmu_read(zap_dnode, 0, zapbuf, stack))
+		return (errnum);
+
+	block_type = *((uint64_t *)zapbuf);
+
+	if (block_type == ZBT_MICRO) {
+		return (mzap_lookup(zapbuf, size, name, val));
+	} else if (block_type == ZBT_HEADER) {
+		/* this is a fat zap */
+		return (fzap_lookup(zap_dnode, zapbuf, name,
+		    val, stack));
+	}
+
+	return (ERR_FSYS_CORRUPT);
+}
+
+/*
+ * Get the dnode of an object number from the metadnode of an object set.
+ *
+ * Input
+ *	mdn - metadnode to get the object dnode
+ *	objnum - object number for the object dnode
+ *	buf - data buffer that holds the returning dnode
+ *	stack - scratch area
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+static int
+dnode_get(dnode_phys_t *mdn, uint64_t objnum, uint8_t type, dnode_phys_t *buf,
+	char *stack)
+{
+	uint64_t blkid, blksz; /* the block id this object dnode is in */
+	int epbs; /* shift of number of dnodes in a block */
+	int idx; /* index within a block */
+	dnode_phys_t *dnbuf;
+
+	blksz = mdn->dn_datablkszsec << SPA_MINBLOCKSHIFT;
+	epbs = zfs_log2(blksz) - DNODE_SHIFT;
+	blkid = objnum >> epbs;
+	idx = objnum & ((1<<epbs)-1);
+
+	if (dnode_buf != NULL && dnode_mdn == mdn &&
+	    objnum >= dnode_start && objnum < dnode_end) {
+		grub_memmove(buf, &dnode_buf[idx], DNODE_SIZE);
+		VERIFY_DN_TYPE(buf, type);
+		return (0);
+	}
+
+	if (dnode_buf && blksz == 1<<DNODE_BLOCK_SHIFT) {
+		dnbuf = dnode_buf;
+		dnode_mdn = mdn;
+		dnode_start = blkid << epbs;
+		dnode_end = (blkid + 1) << epbs;
+	} else {
+		dnbuf = (dnode_phys_t *)stack;
+		stack += blksz;
+	}
+
+	if (errnum = dmu_read(mdn, blkid, (char *)dnbuf, stack))
+		return (errnum);
+
+	grub_memmove(buf, &dnbuf[idx], DNODE_SIZE);
+	VERIFY_DN_TYPE(buf, type);
+
+	return (0);
+}
+
+/*
+ * Check if this is the "menu.lst" file.
+ * str starts with '/'.
+ */
+static int
+is_menu_lst(char *str)
+{
+	char *tptr;
+
+	if ((tptr = grub_strstr(str, "menu.lst")) &&
+	    (tptr[8] == '\0' || tptr[8] == ' ') &&
+	    *(tptr-1) == '/')
+		return (1);
+
+	return (0);
+}
+
+/*
+ * Get the file dnode for a given file name where mdn is the meta dnode
+ * for this ZFS object set. When found, place the file dnode in dn.
+ * The 'path' argument will be mangled.
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+static int
+dnode_get_path(dnode_phys_t *mdn, char *path, dnode_phys_t *dn,
+    char *stack)
+{
+	uint64_t objnum;
+	char *cname, ch;
+
+	if (errnum = dnode_get(mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE,
+	    dn, stack))
+		return (errnum);
+
+	if (errnum = zap_lookup(dn, ZFS_ROOT_OBJ, &objnum, stack))
+		return (errnum);
+
+	if (errnum = dnode_get(mdn, objnum, DMU_OT_DIRECTORY_CONTENTS,
+	    dn, stack))
+		return (errnum);
+
+	/* skip leading slashes */
+	while (*path == '/')
+		path++;
+
+	while (*path && !isspace(*path)) {
+
+		/* get the next component name */
+		cname = path;
+		while (*path && !isspace(*path) && *path != '/')
+			path++;
+		ch = *path;
+		*path = 0;   /* ensure null termination */
+
+		if (errnum = zap_lookup(dn, cname, &objnum, stack))
+			return (errnum);
+
+		if (errnum = dnode_get(mdn, objnum, 0, dn, stack))
+			return (errnum);
+
+		*path = ch;
+		while (*path == '/')
+			path++;
+	}
+
+	/* We found the dnode for this file. Verify if it is a plain file. */
+	VERIFY_DN_TYPE(dn, DMU_OT_PLAIN_FILE_CONTENTS);
+
+	return (0);
+}
+
+/*
+ * Get the default 'bootfs' property value from the rootpool.
+ *
+ * Return:
+ *	0 - success
+ *	errnum -failure
+ */
+static int
+get_default_bootfsobj(dnode_phys_t *mosmdn, uint64_t *obj, char *stack)
+{
+	uint64_t objnum = 0;
+	dnode_phys_t *dn = (dnode_phys_t *)stack;
+	stack += DNODE_SIZE;
+
+	if (dnode_get(mosmdn, DMU_POOL_DIRECTORY_OBJECT,
+	    DMU_OT_OBJECT_DIRECTORY, dn, stack))
+		return (ERR_FILESYSTEM_NOT_FOUND);
+
+	/*
+	 * find the object number for 'pool_props', and get the dnode
+	 * of the 'pool_props'.
+	 */
+	if (zap_lookup(dn, DMU_POOL_PROPS, &objnum, stack))
+		return (ERR_FILESYSTEM_NOT_FOUND);
+
+	if (dnode_get(mosmdn, objnum, DMU_OT_POOL_PROPS, dn, stack))
+		return (ERR_FILESYSTEM_NOT_FOUND);
+
+	if (zap_lookup(dn, ZPOOL_PROP_BOOTFS, &objnum, stack))
+		return (ERR_FILESYSTEM_NOT_FOUND);
+
+	if (!objnum)
+		return (ERR_FILESYSTEM_NOT_FOUND);
+
+	*obj = objnum;
+	return (0);
+}
+
+/*
+ * Given a MOS metadnode, get the metadnode of a given filesystem name (fsname),
+ * e.g. pool/rootfs, or a given object number (obj), e.g. the object number
+ * of pool/rootfs.
+ *
+ * If no fsname and no obj are given, return the DSL_DIR metadnode.
+ * If fsname is given, return its metadnode and its matching object number.
+ * If only obj is given, return the metadnode for this object number.
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+static int
+get_objset_mdn(dnode_phys_t *mosmdn, char *fsname, uint64_t *obj,
+    dnode_phys_t *mdn, char *stack)
+{
+	uint64_t objnum, headobj;
+	char *cname, ch;
+	blkptr_t *bp;
+	objset_phys_t *osp;
+
+	if (fsname == NULL && obj) {
+		headobj = *obj;
+		goto skip;
+	}
+
+	if (errnum = dnode_get(mosmdn, DMU_POOL_DIRECTORY_OBJECT,
+	    DMU_OT_OBJECT_DIRECTORY, mdn, stack))
+		return (errnum);
+
+	if (errnum = zap_lookup(mdn, DMU_POOL_ROOT_DATASET, &objnum,
+	    stack))
+		return (errnum);
+
+	if (errnum = dnode_get(mosmdn, objnum, DMU_OT_DSL_DIR, mdn, stack))
+		return (errnum);
+
+	if (fsname == NULL) {
+		headobj =
+		    ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj;
+		goto skip;
+	}
+
+	/* take out the pool name */
+	while (*fsname && !isspace(*fsname) && *fsname != '/')
+		fsname++;
+
+	while (*fsname && !isspace(*fsname)) {
+		uint64_t childobj;
+
+		while (*fsname == '/')
+			fsname++;
+
+		cname = fsname;
+		while (*fsname && !isspace(*fsname) && *fsname != '/')
+			fsname++;
+		ch = *fsname;
+		*fsname = 0;
+
+		childobj =
+		    ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_child_dir_zapobj;
+		if (errnum = dnode_get(mosmdn, childobj,
+		    DMU_OT_DSL_DIR_CHILD_MAP, mdn, stack))
+			return (errnum);
+
+		if (errnum = zap_lookup(mdn, cname, &objnum, stack))
+			return (errnum);
+
+		if (errnum = dnode_get(mosmdn, objnum, DMU_OT_DSL_DIR,
+		    mdn, stack))
+			return (errnum);
+
+		*fsname = ch;
+	}
+	headobj = ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj;
+	if (obj)
+		*obj = headobj;
+
+skip:
+	if (errnum = dnode_get(mosmdn, headobj, DMU_OT_DSL_DATASET, mdn, stack))
+		return (errnum);
+
+	/* TODO: Add snapshot support here - for fsname=snapshot-name */
+
+	bp = &((dsl_dataset_phys_t *)DN_BONUS(mdn))->ds_bp;
+	osp = (objset_phys_t *)stack;
+	stack += sizeof (objset_phys_t);
+	if (errnum = zio_read(bp, osp, stack))
+		return (errnum);
+
+	grub_memmove((char *)mdn, (char *)&osp->os_meta_dnode, DNODE_SIZE);
+
+	return (0);
+}
+
+/*
+ * Parse the packed nvlist and search for the string value of a given name.
+ *
+ * An XDR packed nvlist is encoded as (from nvs_xdr_create) :
+ *
+ *      encoding method/host endian     (4 bytes)
+ *      nvl_version                     (4 bytes)
+ *      nvl_nvflag                      (4 bytes)
+ *	encoded nvpairs:
+ *		encoded size of the nvpair      (4 bytes)
+ *		decoded size of the nvpair      (4 bytes)
+ *		name string size                (4 bytes)
+ *		name string data                (sizeof(NV_ALIGN4(string))
+ *		data type                       (4 bytes)
+ *		# of elements in the nvpair     (4 bytes)
+ *		data
+ *      2 zero's for the last nvpair
+ *		(end of the entire list)	(8 bytes)
+ *
+ * Return:
+ *	0 - success
+ *	1 - failure
+ */
+int
+nvlist_lookup_value(char *nvlist, char *name, void *val, int valtype)
+{
+	int name_len, type, nelm, slen, encode_size;
+	char *nvpair, *nvp_name, *strval = val;
+	uint64_t *intval = val;
+
+	/* Verify if the 1st and 2nd byte in the nvlist are valid. */
+	if (nvlist[0] != NV_ENCODE_XDR || nvlist[1] != HOST_ENDIAN)
+		return (1);
+
+	/* skip the header, nvl_version, and nvl_nvflag */
+	nvlist = nvlist + 4 * 3;
+
+	/*
+	 * Loop thru the nvpair list
+	 * The XDR representation of an integer is in big-endian byte order.
+	 */
+	while (encode_size = BSWAP_32(*(uint32_t *)nvlist))  {
+
+		nvpair = nvlist + 4 * 2; /* skip the encode/decode size */
+
+		name_len = BSWAP_32(*(uint32_t *)nvpair);
+		nvpair += 4;
+
+		nvp_name = nvpair;
+		nvpair = nvpair + ((name_len + 3) & ~3); /* align */
+
+		type = BSWAP_32(*(uint32_t *)nvpair);
+		nvpair += 4;
+
+		if ((grub_strncmp(nvp_name, name, name_len) == 0) &&
+		    type == valtype) {
+
+			if ((nelm = BSWAP_32(*(uint32_t *)nvpair)) != 1)
+				return (1);
+			nvpair += 4;
+
+			switch (valtype) {
+			case DATA_TYPE_STRING:
+				slen = BSWAP_32(*(uint32_t *)nvpair);
+				nvpair += 4;
+				grub_memmove(strval, nvpair, slen);
+				strval[slen] = '\0';
+				return (0);
+
+			case DATA_TYPE_UINT64:
+				*intval = BSWAP_64(*(uint64_t *)nvpair);
+				return (0);
+			}
+		}
+
+		nvlist += encode_size; /* goto the next nvpair */
+	}
+
+	return (1);
+}
+
+/*
+ * Get the pool name of the root pool from the vdev nvpair list of the label.
+ *
+ * Return:
+ *	0 - success
+ *	errnum - failure
+ */
+int
+get_pool_name_value(int label, char *name, void *value, int valtype,
+    char *stack)
+{
+	vdev_phys_t *vdev;
+	uint64_t sector;
+
+	sector = (label * sizeof (vdev_label_t) + VDEV_SKIP_SIZE +
+	    VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT;
+
+	/* Read in the vdev name-value pair list (112K). */
+	if (devread(sector, 0, VDEV_PHYS_SIZE, stack) == 0)
+		return (ERR_READ);
+
+	vdev = (vdev_phys_t *)stack;
+
+	if (nvlist_lookup_value(vdev->vp_nvlist, name, value, valtype))
+		return (ERR_FSYS_CORRUPT);
+	else
+		return (0);
+}
+
+/*
+ * zfs_mount() locates a valid uberblock of the root pool and read in its MOS
+ * to the memory address MOS.
+ *
+ * Return:
+ *	1 - success
+ *	0 - failure
+ */
+int
+zfs_mount(void)
+{
+	char *stack;
+	int label = 0;
+	uberblock_phys_t *ub_array, *ubbest = NULL;
+	objset_phys_t *osp;
+
+	/* if zfs is already mounted, don't do it again */
+	if (is_zfs_mount == 1)
+		return (1);
+
+	stackbase = ZFS_SCRATCH;
+	stack = stackbase;
+	ub_array = (uberblock_phys_t *)stack;
+	stack += VDEV_UBERBLOCK_RING;
+
+	osp = (objset_phys_t *)stack;
+	stack += sizeof (objset_phys_t);
+
+	/* XXX add back labels support? */
+	for (label = 0; ubbest == NULL && label < (VDEV_LABELS/2); label++) {
+		uint64_t sector = (label * sizeof (vdev_label_t) +
+		    VDEV_SKIP_SIZE + VDEV_BOOT_HEADER_SIZE +
+		    VDEV_PHYS_SIZE) >> SPA_MINBLOCKSHIFT;
+
+		/* Read in the uberblock ring (128K). */
+		if (devread(sector, 0, VDEV_UBERBLOCK_RING,
+		    (char *)ub_array) == 0)
+			continue;
+
+		if ((ubbest = find_bestub(ub_array, label)) != NULL &&
+		    zio_read(&ubbest->ubp_uberblock.ub_rootbp, osp, stack)
+		    == 0) {
+			uint64_t pool_state;
+
+			VERIFY_OS_TYPE(osp, DMU_OST_META);
+
+			/* Got the MOS. Save it at the memory addr MOS. */
+			grub_memmove(MOS, &osp->os_meta_dnode, DNODE_SIZE);
+
+			if (get_pool_name_value(label, ZPOOL_CONFIG_POOL_STATE,
+			    &pool_state, DATA_TYPE_UINT64, stack))
+				return (0);
+
+			if (pool_state == POOL_STATE_DESTROYED)
+				return (0);
+
+			if (get_pool_name_value(label, ZPOOL_CONFIG_POOL_NAME,
+			    current_rootpool, DATA_TYPE_STRING, stack))
+				return (0);
+
+			is_zfs_mount = 1;
+			return (1);
+		}
+	}
+
+	return (0);
+}
+
+/*
+ * zfs_open() locates a file in the rootpool by following the
+ * MOS and places the dnode of the file in the memory address DNODE.
+ *
+ * Return:
+ *	1 - success
+ *	0 - failure
+ */
+int
+zfs_open(char *filename)
+{
+	char *stack;
+	dnode_phys_t *mdn;
+
+	file_buf = NULL;
+	stackbase = ZFS_SCRATCH;
+	stack = stackbase;
+
+	mdn = (dnode_phys_t *)stack;
+	stack += sizeof (dnode_phys_t);
+
+	dnode_mdn = NULL;
+	dnode_buf = (dnode_phys_t *)stack;
+	stack += 1<<DNODE_BLOCK_SHIFT;
+
+	/*
+	 * menu.lst is placed at the root pool filesystem level,
+	 * do not goto 'current_bootfs'.
+	 */
+	if (is_menu_lst(filename)) {
+		if (errnum = get_objset_mdn(MOS, NULL, NULL, mdn, stack))
+			return (0);
+
+		current_bootfs_obj = 0;
+	} else {
+		if (current_bootfs[0] == '\0') {
+			/* Get the default root filesystem object number */
+			if (get_default_bootfsobj(MOS,
+			    &current_bootfs_obj, stack)) {
+				errnum = ERR_FILESYSTEM_NOT_FOUND;
+				return (0);
+			}
+
+			if (errnum = get_objset_mdn(MOS, NULL,
+			    &current_bootfs_obj, mdn, stack))
+				return (0);
+		} else {
+			if (errnum = get_objset_mdn(MOS,
+			    current_bootfs, &current_bootfs_obj, mdn, stack))
+				return (0);
+		}
+	}
+
+	if (dnode_get_path(mdn, filename, DNODE, stack)) {
+		errnum = ERR_FILE_NOT_FOUND;
+		return (0);
+	}
+
+	/* get the file size and set the file position to 0 */
+	filemax = ((znode_phys_t *)DN_BONUS(DNODE))->zp_size;
+	filepos = 0;
+
+	dnode_buf = NULL;
+	return (1);
+}
+
+/*
+ * zfs_read reads in the data blocks pointed by the DNODE.
+ *
+ * Return:
+ *	len - the length successfully read in to the buffer
+ *	0   - failure
+ */
+int
+zfs_read(char *buf, int len)
+{
+	char *stack;
+	char *tmpbuf;
+	int blksz, length, movesize;
+
+	if (file_buf == NULL) {
+		file_buf = stackbase;
+		stackbase += SPA_MAXBLOCKSIZE;
+		file_start = file_end = 0;
+	}
+	stack = stackbase;
+
+	/*
+	 * If offset is in memory, move it into the buffer provided and return.
+	 */
+	if (filepos >= file_start && filepos+len <= file_end) {
+		grub_memmove(buf, file_buf + filepos - file_start, len);
+		filepos += len;
+		return (len);
+	}
+
+	blksz = DNODE->dn_datablkszsec << SPA_MINBLOCKSHIFT;
+
+	/*
+	 * Entire Dnode is too big to fit into the space available.  We
+	 * will need to read it in chunks.  This could be optimized to
+	 * read in as large a chunk as there is space available, but for
+	 * now, this only reads in one data block at a time.
+	 */
+	length = len;
+	while (length) {
+		/*
+		 * Find requested blkid and the offset within that block.
+		 */
+		uint64_t blkid = filepos / blksz;
+
+		if (errnum = dmu_read(DNODE, blkid, file_buf, stack))
+			return (0);
+
+		file_start = blkid * blksz;
+		file_end = file_start + blksz;
+
+		movesize = MIN(length, file_end - filepos);
+
+		grub_memmove(buf, file_buf + filepos - file_start,
+		    movesize);
+		buf += movesize;
+		length -= movesize;
+		filepos += movesize;
+	}
+
+	return (len);
+}
+
+/*
+ * No-Op
+ */
+int
+zfs_embed(int *start_sector, int needed_sectors)
+{
+	return (1);
+}
+
+#endif /* FSYS_ZFS */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/fsys_zfs.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,191 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#ifndef _FSYS_ZFS_H
+#define	_FSYS_ZFS_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#ifdef	FSYS_ZFS
+
+typedef unsigned long long uint64_t;
+typedef unsigned int uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+typedef unsigned char uchar_t;
+
+#if defined(_LP64) || defined(_I32LPx)
+typedef	unsigned long size_t;
+#else
+typedef	unsigned int size_t;
+#endif
+
+#include <zfs-include/zfs.h>
+#include <zfs-include/dmu.h>
+#include <zfs-include/spa.h>
+#include <zfs-include/zio.h>
+#include <zfs-include/zio_checksum.h>
+#include <zfs-include/vdev_impl.h>
+#include <zfs-include/zap_impl.h>
+#include <zfs-include/zap_leaf.h>
+#include <zfs-include/uberblock_impl.h>
+#include <zfs-include/dnode.h>
+#include <zfs-include/dsl_dir.h>
+#include <zfs-include/zfs_acl.h>
+#include <zfs-include/zfs_znode.h>
+#include <zfs-include/dsl_dataset.h>
+#include <zfs-include/zil.h>
+#include <zfs-include/dmu_objset.h>
+
+/*
+ * Global Memory addresses to store MOS and DNODE data
+ */
+#define	MOS			((dnode_phys_t *)(RAW_ADDR(0x100000)))
+#define	DNODE			((dnode_phys_t *)(MOS + DNODE_SIZE))
+#define	ZFS_SCRATCH		((char *)(DNODE + DNODE_SIZE))
+
+/*
+ * Verify dnode type.
+ * Can only be used in functions returning non-0 for failure.
+ */
+#define	VERIFY_DN_TYPE(dnp, type) \
+	if (type && (dnp)->dn_type != type) { \
+		return (ERR_FSYS_CORRUPT); \
+	}
+
+/*
+ * Verify object set type.
+ * Can only be used in functions returning 0 for failure.
+ */
+#define	VERIFY_OS_TYPE(osp, type) \
+	if (type && (osp)->os_type != type) { \
+		errnum = ERR_FSYS_CORRUPT; \
+		return (0); \
+	}
+
+#define	ZPOOL_PROP_BOOTFS		"bootfs"
+
+/* General macros */
+#define	BSWAP_8(x)	((x) & 0xff)
+#define	BSWAP_16(x)	((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8))
+#define	BSWAP_32(x)	((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16))
+#define	BSWAP_64(x)	((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32))
+#define	P2ROUNDUP(x, align)	(-(-(x) & -(align)))
+
+/*
+ * XXX Match these macro up with real zfs once we have nvlist support so that we
+ * can support large sector disks.
+ */
+#define	UBERBLOCK_SIZE		(1ULL << UBERBLOCK_SHIFT)
+#undef	offsetof
+#define	offsetof(t, m)   ((int)&(((t *)0)->m))
+#define	VDEV_UBERBLOCK_SHIFT	UBERBLOCK_SHIFT
+#define	VDEV_UBERBLOCK_OFFSET(n) \
+offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT])
+
+typedef struct uberblock uberblock_t;
+
+/* XXX Uberblock_phys_t is no longer in the kernel zfs */
+typedef struct uberblock_phys {
+	uberblock_t	ubp_uberblock;
+	char		ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) -
+				sizeof (zio_block_tail_t)];
+	zio_block_tail_t ubp_zbt;
+} uberblock_phys_t;
+
+/*
+ * Macros to get fields in a bp or DVA.
+ */
+#define	P2PHASE(x, align)		((x) & ((align) - 1))
+#define	DVA_OFFSET_TO_PHYS_SECTOR(offset) \
+	((offset + VDEV_LABEL_START_SIZE) >> SPA_MINBLOCKSHIFT)
+
+/*
+ * For nvlist manipulation. (from nvpair.h)
+ */
+#define	NV_ENCODE_NATIVE	0
+#define	NV_ENCODE_XDR		1
+#define	HOST_ENDIAN		1	/* for x86 machine */
+#define	DATA_TYPE_UINT64	8
+#define	DATA_TYPE_STRING	9
+
+/*
+ * Decompression Entry - lzjb
+ */
+#ifndef	NBBY
+#define	NBBY	8
+#endif
+
+typedef int zfs_decomp_func_t(void *s_start, void *d_start, size_t s_len,
+			size_t d_len);
+typedef struct decomp_entry {
+	char *name;
+	zfs_decomp_func_t *decomp_func;
+} decomp_entry_t;
+
+/*
+ * FAT ZAP data structures
+ */
+#define	ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */
+#define	ZAP_HASH_IDX(hash, n)	(((n) == 0) ? 0 : ((hash) >> (64 - (n))))
+#define	CHAIN_END	0xffff	/* end of the chunk chain */
+
+/*
+ * The amount of space within the chunk available for the array is:
+ * chunk size - space for type (1) - space for next pointer (2)
+ */
+#define	ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3)
+
+#define	ZAP_LEAF_HASH_SHIFT(bs)	(bs - 5)
+#define	ZAP_LEAF_HASH_NUMENTRIES(bs) (1 << ZAP_LEAF_HASH_SHIFT(bs))
+#define	LEAF_HASH(bs, h) \
+	((ZAP_LEAF_HASH_NUMENTRIES(bs)-1) & \
+	((h) >> (64 - ZAP_LEAF_HASH_SHIFT(bs)-l->l_hdr.lh_prefix_len)))
+
+/*
+ * The amount of space available for chunks is:
+ * block size shift - hash entry size (2) * number of hash
+ * entries - header space (2*chunksize)
+ */
+#define	ZAP_LEAF_NUMCHUNKS(bs) \
+	(((1<<bs) - 2*ZAP_LEAF_HASH_NUMENTRIES(bs)) / \
+	ZAP_LEAF_CHUNKSIZE - 2)
+
+/*
+ * The chunks start immediately after the hash table.  The end of the
+ * hash table is at l_hash + HASH_NUMENTRIES, which we simply cast to a
+ * chunk_t.
+ */
+#define	ZAP_LEAF_CHUNK(l, bs, idx) \
+	((zap_leaf_chunk_t *)(l->l_hash + ZAP_LEAF_HASH_NUMENTRIES(bs)))[idx]
+#define	ZAP_LEAF_ENTRY(l, bs, idx) (&ZAP_LEAF_CHUNK(l, bs, idx).l_entry)
+
+extern void fletcher_2_native(const void *, uint64_t, zio_cksum_t *);
+extern void fletcher_2_byteswap(const void *, uint64_t, zio_cksum_t *);
+extern void fletcher_4_native(const void *, uint64_t, zio_cksum_t *);
+extern void fletcher_4_byteswap(const void *, uint64_t, zio_cksum_t *);
+extern void zio_checksum_SHA256(const void *, uint64_t, zio_cksum_t *);
+extern int lzjb_decompress(void *, void *, size_t, size_t);
+
+#endif	/* FSYS_ZFS */
+
+#endif /* !_FSYS_ZFS_H */
--- a/usr/src/grub/grub-0.95/stage2/shared.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/shared.h	Wed Mar 28 12:48:13 2007 -0700
@@ -44,6 +44,9 @@
 # define RAW_SEG(x) (x)
 #endif
 
+#define	MAXNAMELEN	256
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+
 /*
  *  Integer sizes
  */
@@ -214,6 +217,7 @@
 #define STAGE2_ID_ISO9660_STAGE1_5	9
 #define STAGE2_ID_UFS2_STAGE1_5		10
 #define STAGE2_ID_UFS_STAGE1_5		11
+#define STAGE2_ID_ZFS_STAGE1_5		12
 
 #ifndef STAGE1_5
 # define STAGE2_ID	STAGE2_ID_STAGE2
@@ -240,6 +244,8 @@
 #  define STAGE2_ID	STAGE2_ID_UFS2_STAGE1_5
 # elif defined(FSYS_UFS)
 #  define STAGE2_ID	STAGE2_ID_UFS_STAGE1_5
+# elif defined(FSYS_ZFS)
+#  define STAGE2_ID	STAGE2_ID_ZFS_STAGE1_5
 # else
 #  error "unknown Stage 2"
 # endif
@@ -554,6 +560,7 @@
   ERR_NO_DISK_SPACE,
   ERR_NUMBER_OVERFLOW,
   ERR_BAD_GZIP_CRC,
+  ERR_FILESYSTEM_NOT_FOUND,
 
   MAX_ERR_NUM
 } grub_error_t;
@@ -640,6 +647,10 @@
 
 extern unsigned long current_drive;
 extern unsigned long current_partition;
+extern char current_rootpool[MAXNAMELEN];
+extern char current_bootfs[MAXNAMELEN];
+extern unsigned long long current_bootfs_obj;
+extern int is_zfs_mount;
 
 extern int fsys_type;
 
--- a/usr/src/grub/grub-0.95/stage2/ufs.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/grub/grub-0.95/stage2/ufs.h	Wed Mar 28 12:48:13 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -17,7 +17,6 @@
 #define	UFS_NIADDR	3	/* indirect blocks */
 #define	MAXMNTLEN	512
 #define	MAXCSBUFS	32
-#define	MAXNAMELEN	256
 
 /* file types */
 #define	IFMT		0xf000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/dmu.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,106 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_DMU_H
+#define	_SYS_DMU_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * This file describes the interface that the DMU provides for its
+ * consumers.
+ *
+ * The DMU also interacts with the SPA.  That interface is described in
+ * dmu_spa.h.
+ */
+typedef enum dmu_object_type {
+	DMU_OT_NONE,
+	/* general: */
+	DMU_OT_OBJECT_DIRECTORY,	/* ZAP */
+	DMU_OT_OBJECT_ARRAY,		/* UINT64 */
+	DMU_OT_PACKED_NVLIST,		/* UINT8 (XDR by nvlist_pack/unpack) */
+	DMU_OT_PACKED_NVLIST_SIZE,	/* UINT64 */
+	DMU_OT_BPLIST,			/* UINT64 */
+	DMU_OT_BPLIST_HDR,		/* UINT64 */
+	/* spa: */
+	DMU_OT_SPACE_MAP_HEADER,	/* UINT64 */
+	DMU_OT_SPACE_MAP,		/* UINT64 */
+	/* zil: */
+	DMU_OT_INTENT_LOG,		/* UINT64 */
+	/* dmu: */
+	DMU_OT_DNODE,			/* DNODE */
+	DMU_OT_OBJSET,			/* OBJSET */
+	/* dsl: */
+	DMU_OT_DSL_DIR,			/* UINT64 */
+	DMU_OT_DSL_DIR_CHILD_MAP,	/* ZAP */
+	DMU_OT_DSL_DS_SNAP_MAP,		/* ZAP */
+	DMU_OT_DSL_PROPS,		/* ZAP */
+	DMU_OT_DSL_DATASET,		/* UINT64 */
+	/* zpl: */
+	DMU_OT_ZNODE,			/* ZNODE */
+	DMU_OT_ACL,			/* ACL */
+	DMU_OT_PLAIN_FILE_CONTENTS,	/* UINT8 */
+	DMU_OT_DIRECTORY_CONTENTS,	/* ZAP */
+	DMU_OT_MASTER_NODE,		/* ZAP */
+	DMU_OT_UNLINKED_SET,		/* ZAP */
+	/* zvol: */
+	DMU_OT_ZVOL,			/* UINT8 */
+	DMU_OT_ZVOL_PROP,		/* ZAP */
+	/* other; for testing only! */
+	DMU_OT_PLAIN_OTHER,		/* UINT8 */
+	DMU_OT_UINT64_OTHER,		/* UINT64 */
+	DMU_OT_ZAP_OTHER,		/* ZAP */
+	/* new object types: */
+	DMU_OT_ERROR_LOG,		/* ZAP */
+	DMU_OT_SPA_HISTORY,		/* UINT8 */
+	DMU_OT_SPA_HISTORY_OFFSETS,	/* spa_his_phys_t */
+	DMU_OT_POOL_PROPS,		/* ZAP */
+
+	DMU_OT_NUMTYPES
+} dmu_object_type_t;
+
+typedef enum dmu_objset_type {
+	DMU_OST_NONE,
+	DMU_OST_META,
+	DMU_OST_ZFS,
+	DMU_OST_ZVOL,
+	DMU_OST_OTHER,			/* For testing only! */
+	DMU_OST_ANY,			/* Be careful! */
+	DMU_OST_NUMTYPES
+} dmu_objset_type_t;
+
+/*
+ * The names of zap entries in the DIRECTORY_OBJECT of the MOS.
+ */
+#define	DMU_POOL_DIRECTORY_OBJECT	1
+#define	DMU_POOL_CONFIG			"config"
+#define	DMU_POOL_ROOT_DATASET		"root_dataset"
+#define	DMU_POOL_SYNC_BPLIST		"sync_bplist"
+#define	DMU_POOL_ERRLOG_SCRUB		"errlog_scrub"
+#define	DMU_POOL_ERRLOG_LAST		"errlog_last"
+#define	DMU_POOL_SPARES			"spares"
+#define	DMU_POOL_DEFLATE		"deflate"
+#define	DMU_POOL_HISTORY		"history"
+#define	DMU_POOL_PROPS			"pool_props"
+
+#endif	/* _SYS_DMU_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/dmu_objset.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,37 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_DMU_OBJSET_H
+#define	_SYS_DMU_OBJSET_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+typedef struct objset_phys {
+	dnode_phys_t os_meta_dnode;
+	zil_header_t os_zil_header;
+	uint64_t os_type;
+	char os_pad[1024 - sizeof (dnode_phys_t) - sizeof (zil_header_t) -
+	    sizeof (uint64_t)];
+} objset_phys_t;
+
+#endif /* _SYS_DMU_OBJSET_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/dnode.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,78 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_DNODE_H
+#define	_SYS_DNODE_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Fixed constants.
+ */
+#define	DNODE_SHIFT		9	/* 512 bytes */
+#define	DN_MIN_INDBLKSHIFT	10	/* 1k */
+#define	DN_MAX_INDBLKSHIFT	14	/* 16k */
+#define	DNODE_BLOCK_SHIFT	14	/* 16k */
+#define	DNODE_CORE_SIZE		64	/* 64 bytes for dnode sans blkptrs */
+#define	DN_MAX_OBJECT_SHIFT	48	/* 256 trillion (zfs_fid_t limit) */
+#define	DN_MAX_OFFSET_SHIFT	64	/* 2^64 bytes in a dnode */
+
+/*
+ * Derived constants.
+ */
+#define	DNODE_SIZE	(1 << DNODE_SHIFT)
+#define	DN_MAX_NBLKPTR	((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT)
+#define	DN_MAX_BONUSLEN	(DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT))
+#define	DN_MAX_OBJECT	(1ULL << DN_MAX_OBJECT_SHIFT)
+
+#define	DNODES_PER_BLOCK_SHIFT	(DNODE_BLOCK_SHIFT - DNODE_SHIFT)
+#define	DNODES_PER_BLOCK	(1ULL << DNODES_PER_BLOCK_SHIFT)
+#define	DNODES_PER_LEVEL_SHIFT	(DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT)
+
+#define	DN_BONUS(dnp)	((void*)((dnp)->dn_bonus + \
+	(((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t))))
+
+typedef struct dnode_phys {
+	uint8_t dn_type;		/* dmu_object_type_t */
+	uint8_t dn_indblkshift;		/* ln2(indirect block size) */
+	uint8_t dn_nlevels;		/* 1=dn_blkptr->data blocks */
+	uint8_t dn_nblkptr;		/* length of dn_blkptr */
+	uint8_t dn_bonustype;		/* type of data in bonus buffer */
+	uint8_t	dn_checksum;		/* ZIO_CHECKSUM type */
+	uint8_t	dn_compress;		/* ZIO_COMPRESS type */
+	uint8_t dn_flags;		/* DNODE_FLAG_* */
+	uint16_t dn_datablkszsec;	/* data block size in 512b sectors */
+	uint16_t dn_bonuslen;		/* length of dn_bonus */
+	uint8_t dn_pad2[4];
+
+	/* accounting is protected by dn_dirty_mtx */
+	uint64_t dn_maxblkid;		/* largest allocated block ID */
+	uint64_t dn_used;		/* bytes (or sectors) of disk space */
+
+	uint64_t dn_pad3[4];
+
+	blkptr_t dn_blkptr[1];
+	uint8_t dn_bonus[DN_MAX_BONUSLEN];
+} dnode_phys_t;
+
+#endif	/* _SYS_DNODE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dataset.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,55 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_DSL_DATASET_H
+#define	_SYS_DSL_DATASET_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+typedef struct dsl_dataset_phys {
+	uint64_t ds_dir_obj;
+	uint64_t ds_prev_snap_obj;
+	uint64_t ds_prev_snap_txg;
+	uint64_t ds_next_snap_obj;
+	uint64_t ds_snapnames_zapobj;	/* zap obj of snaps; ==0 for snaps */
+	uint64_t ds_num_children;	/* clone/snap children; ==0 for head */
+	uint64_t ds_creation_time;	/* seconds since 1970 */
+	uint64_t ds_creation_txg;
+	uint64_t ds_deadlist_obj;
+	uint64_t ds_used_bytes;
+	uint64_t ds_compressed_bytes;
+	uint64_t ds_uncompressed_bytes;
+	uint64_t ds_unique_bytes;	/* only relevant to snapshots */
+	/*
+	 * The ds_fsid_guid is a 56-bit ID that can change to avoid
+	 * collisions.  The ds_guid is a 64-bit ID that will never
+	 * change, so there is a small probability that it will collide.
+	 */
+	uint64_t ds_fsid_guid;
+	uint64_t ds_guid;
+	uint64_t ds_flags;
+	blkptr_t ds_bp;
+	uint64_t ds_pad[8]; /* pad out to 320 bytes for good measure */
+} dsl_dataset_phys_t;
+
+#endif /* _SYS_DSL_DATASET_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/dsl_dir.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,50 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_DSL_DIR_H
+#define	_SYS_DSL_DIR_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+typedef struct dsl_dir_phys {
+	uint64_t dd_creation_time; /* not actually used */
+	uint64_t dd_head_dataset_obj;
+	uint64_t dd_parent_obj;
+	uint64_t dd_clone_parent_obj;
+	uint64_t dd_child_dir_zapobj;
+	/*
+	 * how much space our children are accounting for; for leaf
+	 * datasets, == physical space used by fs + snaps
+	 */
+	uint64_t dd_used_bytes;
+	uint64_t dd_compressed_bytes;
+	uint64_t dd_uncompressed_bytes;
+	/* Administrative quota setting */
+	uint64_t dd_quota;
+	/* Administrative reservation setting */
+	uint64_t dd_reserved;
+	uint64_t dd_props_zapobj;
+	uint64_t dd_pad[21]; /* pad out to 256 bytes for good measure */
+} dsl_dir_phys_t;
+
+#endif /* _SYS_DSL_DIR_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/spa.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,285 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_SPA_H
+#define	_SYS_SPA_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * General-purpose 32-bit and 64-bit bitfield encodings.
+ */
+#define	BF32_DECODE(x, low, len)	P2PHASE((x) >> (low), 1U << (len))
+#define	BF64_DECODE(x, low, len)	P2PHASE((x) >> (low), 1ULL << (len))
+#define	BF32_ENCODE(x, low, len)	(P2PHASE((x), 1U << (len)) << (low))
+#define	BF64_ENCODE(x, low, len)	(P2PHASE((x), 1ULL << (len)) << (low))
+
+#define	BF32_GET(x, low, len)		BF32_DECODE(x, low, len)
+#define	BF64_GET(x, low, len)		BF64_DECODE(x, low, len)
+
+#define	BF32_SET(x, low, len, val)	\
+	((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len))
+#define	BF64_SET(x, low, len, val)	\
+	((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len))
+
+#define	BF32_GET_SB(x, low, len, shift, bias)	\
+	((BF32_GET(x, low, len) + (bias)) << (shift))
+#define	BF64_GET_SB(x, low, len, shift, bias)	\
+	((BF64_GET(x, low, len) + (bias)) << (shift))
+
+#define	BF32_SET_SB(x, low, len, shift, bias, val)	\
+	BF32_SET(x, low, len, ((val) >> (shift)) - (bias))
+#define	BF64_SET_SB(x, low, len, shift, bias, val)	\
+	BF64_SET(x, low, len, ((val) >> (shift)) - (bias))
+
+/*
+ * We currently support nine block sizes, from 512 bytes to 128K.
+ * We could go higher, but the benefits are near-zero and the cost
+ * of COWing a giant block to modify one byte would become excessive.
+ */
+#define	SPA_MINBLOCKSHIFT	9
+#define	SPA_MAXBLOCKSHIFT	17
+#define	SPA_MINBLOCKSIZE	(1ULL << SPA_MINBLOCKSHIFT)
+#define	SPA_MAXBLOCKSIZE	(1ULL << SPA_MAXBLOCKSHIFT)
+
+#define	SPA_BLOCKSIZES		(SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1)
+
+/*
+ * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB.
+ * The ASIZE encoding should be at least 64 times larger (6 more bits)
+ * to support up to 4-way RAID-Z mirror mode with worst-case gang block
+ * overhead, three DVAs per bp, plus one more bit in case we do anything
+ * else that expands the ASIZE.
+ */
+#define	SPA_LSIZEBITS		16	/* LSIZE up to 32M (2^16 * 512)	*/
+#define	SPA_PSIZEBITS		16	/* PSIZE up to 32M (2^16 * 512)	*/
+#define	SPA_ASIZEBITS		24	/* ASIZE up to 64 times larger	*/
+
+/*
+ * All SPA data is represented by 128-bit data virtual addresses (DVAs).
+ * The members of the dva_t should be considered opaque outside the SPA.
+ */
+typedef struct dva {
+	uint64_t	dva_word[2];
+} dva_t;
+
+/*
+ * Each block has a 256-bit checksum -- strong enough for cryptographic hashes.
+ */
+typedef struct zio_cksum {
+	uint64_t	zc_word[4];
+} zio_cksum_t;
+
+/*
+ * Each block is described by its DVAs, time of birth, checksum, etc.
+ * The word-by-word, bit-by-bit layout of the blkptr is as follows:
+ *
+ *	64	56	48	40	32	24	16	8	0
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 0	|		vdev1		| GRID  |	  ASIZE		|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 1	|G|			 offset1				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 2	|		vdev2		| GRID  |	  ASIZE		|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 3	|G|			 offset2				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 4	|		vdev3		| GRID  |	  ASIZE		|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 5	|G|			 offset3				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 6	|E| lvl | type	| cksum | comp	|     PSIZE	|     LSIZE	|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 7	|			padding					|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 8	|			padding					|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 9	|			padding					|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * a	|			birth txg				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * b	|			fill count				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * c	|			checksum[0]				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * d	|			checksum[1]				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * e	|			checksum[2]				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * f	|			checksum[3]				|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ *
+ * Legend:
+ *
+ * vdev		virtual device ID
+ * offset	offset into virtual device
+ * LSIZE	logical size
+ * PSIZE	physical size (after compression)
+ * ASIZE	allocated size (including RAID-Z parity and gang block headers)
+ * GRID		RAID-Z layout information (reserved for future use)
+ * cksum	checksum function
+ * comp		compression function
+ * G		gang block indicator
+ * E		endianness
+ * type		DMU object type
+ * lvl		level of indirection
+ * birth txg	transaction group in which the block was born
+ * fill count	number of non-zero blocks under this bp
+ * checksum[4]	256-bit checksum of the data this bp describes
+ */
+typedef struct blkptr {
+	dva_t		blk_dva[3];	/* 128-bit Data Virtual Address	*/
+	uint64_t	blk_prop;	/* size, compression, type, etc	*/
+	uint64_t	blk_pad[3];	/* Extra space for the future	*/
+	uint64_t	blk_birth;	/* transaction group at birth	*/
+	uint64_t	blk_fill;	/* fill count			*/
+	zio_cksum_t	blk_cksum;	/* 256-bit checksum		*/
+} blkptr_t;
+
+#define	SPA_BLKPTRSHIFT	7		/* blkptr_t is 128 bytes	*/
+#define	SPA_DVAS_PER_BP	3		/* Number of DVAs in a bp	*/
+
+/*
+ * Macros to get and set fields in a bp or DVA.
+ */
+#define	DVA_GET_ASIZE(dva)	\
+	BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0)
+#define	DVA_SET_ASIZE(dva, x)	\
+	BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x)
+
+#define	DVA_GET_GRID(dva)	BF64_GET((dva)->dva_word[0], 24, 8)
+#define	DVA_SET_GRID(dva, x)	BF64_SET((dva)->dva_word[0], 24, 8, x)
+
+#define	DVA_GET_VDEV(dva)	BF64_GET((dva)->dva_word[0], 32, 32)
+#define	DVA_SET_VDEV(dva, x)	BF64_SET((dva)->dva_word[0], 32, 32, x)
+
+#define	DVA_GET_OFFSET(dva)	\
+	BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0)
+#define	DVA_SET_OFFSET(dva, x)	\
+	BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x)
+
+#define	DVA_GET_GANG(dva)	BF64_GET((dva)->dva_word[1], 63, 1)
+#define	DVA_SET_GANG(dva, x)	BF64_SET((dva)->dva_word[1], 63, 1, x)
+
+#define	BP_GET_LSIZE(bp)	\
+	(BP_IS_HOLE(bp) ? 0 : \
+	BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1))
+#define	BP_SET_LSIZE(bp, x)	\
+	BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x)
+
+#define	BP_GET_PSIZE(bp)	\
+	BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1)
+#define	BP_SET_PSIZE(bp, x)	\
+	BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x)
+
+#define	BP_GET_COMPRESS(bp)	BF64_GET((bp)->blk_prop, 32, 8)
+#define	BP_SET_COMPRESS(bp, x)	BF64_SET((bp)->blk_prop, 32, 8, x)
+
+#define	BP_GET_CHECKSUM(bp)	BF64_GET((bp)->blk_prop, 40, 8)
+#define	BP_SET_CHECKSUM(bp, x)	BF64_SET((bp)->blk_prop, 40, 8, x)
+
+#define	BP_GET_TYPE(bp)		BF64_GET((bp)->blk_prop, 48, 8)
+#define	BP_SET_TYPE(bp, x)	BF64_SET((bp)->blk_prop, 48, 8, x)
+
+#define	BP_GET_LEVEL(bp)	BF64_GET((bp)->blk_prop, 56, 5)
+#define	BP_SET_LEVEL(bp, x)	BF64_SET((bp)->blk_prop, 56, 5, x)
+
+#define	BP_GET_BYTEORDER(bp)	(0 - BF64_GET((bp)->blk_prop, 63, 1))
+#define	BP_SET_BYTEORDER(bp, x)	BF64_SET((bp)->blk_prop, 63, 1, x)
+
+#define	BP_GET_ASIZE(bp)	\
+	(DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
+		DVA_GET_ASIZE(&(bp)->blk_dva[2]))
+
+#define	BP_GET_UCSIZE(bp) \
+	((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) ? \
+	BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp));
+
+#define	BP_GET_NDVAS(bp)	\
+	(!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
+	!!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
+	!!DVA_GET_ASIZE(&(bp)->blk_dva[2]))
+
+#define	BP_COUNT_GANG(bp)	\
+	(DVA_GET_GANG(&(bp)->blk_dva[0]) + \
+	DVA_GET_GANG(&(bp)->blk_dva[1]) + \
+	DVA_GET_GANG(&(bp)->blk_dva[2]))
+
+#define	DVA_EQUAL(dva1, dva2)	\
+	((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
+	(dva1)->dva_word[0] == (dva2)->dva_word[0])
+
+#define	ZIO_CHECKSUM_EQUAL(zc1, zc2) \
+	(0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
+	((zc1).zc_word[1] - (zc2).zc_word[1]) | \
+	((zc1).zc_word[2] - (zc2).zc_word[2]) | \
+	((zc1).zc_word[3] - (zc2).zc_word[3])))
+
+
+#define	DVA_IS_VALID(dva)	(DVA_GET_ASIZE(dva) != 0)
+
+#define	ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3)	\
+{						\
+	(zcp)->zc_word[0] = w0;			\
+	(zcp)->zc_word[1] = w1;			\
+	(zcp)->zc_word[2] = w2;			\
+	(zcp)->zc_word[3] = w3;			\
+}
+
+#define	BP_IDENTITY(bp)		(&(bp)->blk_dva[0])
+#define	BP_IS_GANG(bp)		DVA_GET_GANG(BP_IDENTITY(bp))
+#define	BP_IS_HOLE(bp)		((bp)->blk_birth == 0)
+#define	BP_IS_OLDER(bp, txg)	(!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg))
+
+#define	BP_ZERO(bp)				\
+{						\
+	(bp)->blk_dva[0].dva_word[0] = 0;	\
+	(bp)->blk_dva[0].dva_word[1] = 0;	\
+	(bp)->blk_dva[1].dva_word[0] = 0;	\
+	(bp)->blk_dva[1].dva_word[1] = 0;	\
+	(bp)->blk_dva[2].dva_word[0] = 0;	\
+	(bp)->blk_dva[2].dva_word[1] = 0;	\
+	(bp)->blk_prop = 0;			\
+	(bp)->blk_pad[0] = 0;			\
+	(bp)->blk_pad[1] = 0;			\
+	(bp)->blk_pad[2] = 0;			\
+	(bp)->blk_birth = 0;			\
+	(bp)->blk_fill = 0;			\
+	ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0);	\
+}
+
+/*
+ * Note: the byteorder is either 0 or -1, both of which are palindromes.
+ * This simplifies the endianness handling a bit.
+ */
+#ifdef _BIG_ENDIAN
+#define	ZFS_HOST_BYTEORDER	(0ULL)
+#else
+#define	ZFS_HOST_BYTEORDER	(-1ULL)
+#endif
+
+#define	BP_SHOULD_BYTESWAP(bp)	(BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER)
+
+#define	BP_SPRINTF_LEN	320
+
+#endif	/* _SYS_SPA_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/uberblock_impl.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,51 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_UBERBLOCK_IMPL_H
+#define	_SYS_UBERBLOCK_IMPL_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * The uberblock version is incremented whenever an incompatible on-disk
+ * format change is made to the SPA, DMU, or ZAP.
+ *
+ * Note: the first two fields should never be moved.  When a storage pool
+ * is opened, the uberblock must be read off the disk before the version
+ * can be checked.  If the ub_version field is moved, we may not detect
+ * version mismatch.  If the ub_magic field is moved, applications that
+ * expect the magic number in the first word won't work.
+ */
+#define	UBERBLOCK_MAGIC		0x00bab10c		/* oo-ba-bloc!	*/
+#define	UBERBLOCK_SHIFT		10			/* up to 1K	*/
+
+struct uberblock {
+	uint64_t	ub_magic;	/* UBERBLOCK_MAGIC		*/
+	uint64_t	ub_version;	/* ZFS_VERSION			*/
+	uint64_t	ub_txg;		/* txg of last sync		*/
+	uint64_t	ub_guid_sum;	/* sum of all vdev guids	*/
+	uint64_t	ub_timestamp;	/* UTC time of last sync	*/
+	blkptr_t	ub_rootbp;	/* MOS objset_phys_t		*/
+};
+
+#endif	/* _SYS_UBERBLOCK_IMPL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/vdev_impl.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,72 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_VDEV_IMPL_H
+#define	_SYS_VDEV_IMPL_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#define	VDEV_SKIP_SIZE		(8 << 10)
+#define	VDEV_BOOT_HEADER_SIZE	(8 << 10)
+#define	VDEV_PHYS_SIZE		(112 << 10)
+#define	VDEV_UBERBLOCK_RING	(128 << 10)
+
+/* ZFS boot block */
+#define	VDEV_BOOT_MAGIC		0x2f5b007b10cULL
+#define	VDEV_BOOT_VERSION	1		/* version number	*/
+
+typedef struct vdev_boot_header {
+	uint64_t	vb_magic;		/* VDEV_BOOT_MAGIC	*/
+	uint64_t	vb_version;		/* VDEV_BOOT_VERSION	*/
+	uint64_t	vb_offset;		/* start offset	(bytes) */
+	uint64_t	vb_size;		/* size (bytes)		*/
+	char		vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)];
+} vdev_boot_header_t;
+
+typedef struct vdev_phys {
+	char		vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)];
+	zio_block_tail_t vp_zbt;
+} vdev_phys_t;
+
+typedef struct vdev_label {
+	char		vl_pad[VDEV_SKIP_SIZE];			/*   8K	*/
+	vdev_boot_header_t vl_boot_header;			/*   8K	*/
+	vdev_phys_t	vl_vdev_phys;				/* 112K	*/
+	char		vl_uberblock[VDEV_UBERBLOCK_RING];	/* 128K	*/
+} vdev_label_t;							/* 256K total */
+
+/*
+ * Size and offset of embedded boot loader region on each label.
+ * The total size of the first two labels plus the boot area is 4MB.
+ */
+#define	VDEV_BOOT_OFFSET	(2 * sizeof (vdev_label_t))
+#define	VDEV_BOOT_SIZE		(7ULL << 19)			/* 3.5M	*/
+
+/*
+ * Size of label regions at the start and end of each leaf device.
+ */
+#define	VDEV_LABEL_START_SIZE	(2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE)
+#define	VDEV_LABEL_END_SIZE	(2 * sizeof (vdev_label_t))
+#define	VDEV_LABELS		4
+
+#endif	/* _SYS_VDEV_IMPL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/zap_impl.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,112 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_ZAP_IMPL_H
+#define	_SYS_ZAP_IMPL_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#define	ZAP_MAGIC 0x2F52AB2ABULL
+
+#define	ZAP_HASHBITS		28
+#define	MZAP_ENT_LEN		64
+#define	MZAP_NAME_LEN		(MZAP_ENT_LEN - 8 - 4 - 2)
+#define	MZAP_MAX_BLKSHIFT	SPA_MAXBLOCKSHIFT
+#define	MZAP_MAX_BLKSZ		(1 << MZAP_MAX_BLKSHIFT)
+
+typedef struct mzap_ent_phys {
+	uint64_t mze_value;
+	uint32_t mze_cd;
+	uint16_t mze_pad;	/* in case we want to chain them someday */
+	char mze_name[MZAP_NAME_LEN];
+} mzap_ent_phys_t;
+
+typedef struct mzap_phys {
+	uint64_t mz_block_type;	/* ZBT_MICRO */
+	uint64_t mz_salt;
+	uint64_t mz_pad[6];
+	mzap_ent_phys_t mz_chunk[1];
+	/* actually variable size depending on block size */
+} mzap_phys_t;
+
+/*
+ * The (fat) zap is stored in one object. It is an array of
+ * 1<<FZAP_BLOCK_SHIFT byte blocks. The layout looks like one of:
+ *
+ * ptrtbl fits in first block:
+ * 	[zap_phys_t zap_ptrtbl_shift < 6] [zap_leaf_t] ...
+ *
+ * ptrtbl too big for first block:
+ * 	[zap_phys_t zap_ptrtbl_shift >= 6] [zap_leaf_t] [ptrtbl] ...
+ *
+ */
+
+#define	ZBT_LEAF		((1ULL << 63) + 0)
+#define	ZBT_HEADER		((1ULL << 63) + 1)
+#define	ZBT_MICRO		((1ULL << 63) + 3)
+/* any other values are ptrtbl blocks */
+
+/*
+ * the embedded pointer table takes up half a block:
+ * block size / entry size (2^3) / 2
+ */
+#define	ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1)
+
+/*
+ * The embedded pointer table starts half-way through the block.  Since
+ * the pointer table itself is half the block, it starts at (64-bit)
+ * word number (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap)).
+ */
+#define	ZAP_EMBEDDED_PTRTBL_ENT(zap, idx) \
+	((uint64_t *)(zap)->zap_f.zap_phys) \
+	[(idx) + (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap))]
+
+/*
+ * TAKE NOTE:
+ * If zap_phys_t is modified, zap_byteswap() must be modified.
+ */
+typedef struct zap_phys {
+	uint64_t zap_block_type;	/* ZBT_HEADER */
+	uint64_t zap_magic;		/* ZAP_MAGIC */
+
+	struct zap_table_phys {
+		uint64_t zt_blk;	/* starting block number */
+		uint64_t zt_numblks;	/* number of blocks */
+		uint64_t zt_shift;	/* bits to index it */
+		uint64_t zt_nextblk;	/* next (larger) copy start block */
+		uint64_t zt_blks_copied; /* number source blocks copied */
+	} zap_ptrtbl;
+
+	uint64_t zap_freeblk;		/* the next free block */
+	uint64_t zap_num_leafs;		/* number of leafs */
+	uint64_t zap_num_entries;	/* number of entries */
+	uint64_t zap_salt;		/* salt to stir into hash function */
+	/*
+	 * This structure is followed by padding, and then the embedded
+	 * pointer table.  The embedded pointer table takes up second
+	 * half of the block.  It is accessed using the
+	 * ZAP_EMBEDDED_PTRTBL_ENT() macro.
+	 */
+} zap_phys_t;
+
+#endif /* _SYS_ZAP_IMPL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/zap_leaf.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,102 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_ZAP_LEAF_H
+#define	_SYS_ZAP_LEAF_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#define	ZAP_LEAF_MAGIC 0x2AB1EAF
+
+/* chunk size = 24 bytes */
+#define	ZAP_LEAF_CHUNKSIZE 24
+
+/*
+ * The amount of space within the chunk available for the array is:
+ * chunk size - space for type (1) - space for next pointer (2)
+ */
+#define	ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3)
+
+typedef enum zap_chunk_type {
+	ZAP_CHUNK_FREE = 253,
+	ZAP_CHUNK_ENTRY = 252,
+	ZAP_CHUNK_ARRAY = 251,
+	ZAP_CHUNK_TYPE_MAX = 250
+} zap_chunk_type_t;
+
+/*
+ * TAKE NOTE:
+ * If zap_leaf_phys_t is modified, zap_leaf_byteswap() must be modified.
+ */
+typedef struct zap_leaf_phys {
+	struct zap_leaf_header {
+		uint64_t lh_block_type;		/* ZBT_LEAF */
+		uint64_t lh_pad1;
+		uint64_t lh_prefix;		/* hash prefix of this leaf */
+		uint32_t lh_magic;		/* ZAP_LEAF_MAGIC */
+		uint16_t lh_nfree;		/* number free chunks */
+		uint16_t lh_nentries;		/* number of entries */
+		uint16_t lh_prefix_len;		/* num bits used to id this */
+
+/* above is accessable to zap, below is zap_leaf private */
+
+		uint16_t lh_freelist;		/* chunk head of free list */
+		uint8_t lh_pad2[12];
+	} l_hdr; /* 2 24-byte chunks */
+
+	/*
+	 * The header is followed by a hash table with
+	 * ZAP_LEAF_HASH_NUMENTRIES(zap) entries.  The hash table is
+	 * followed by an array of ZAP_LEAF_NUMCHUNKS(zap)
+	 * zap_leaf_chunk structures.  These structures are accessed
+	 * with the ZAP_LEAF_CHUNK() macro.
+	 */
+
+	uint16_t l_hash[1];
+} zap_leaf_phys_t;
+
+typedef union zap_leaf_chunk {
+	struct zap_leaf_entry {
+		uint8_t le_type; 		/* always ZAP_CHUNK_ENTRY */
+		uint8_t le_int_size;		/* size of ints */
+		uint16_t le_next;		/* next entry in hash chain */
+		uint16_t le_name_chunk;		/* first chunk of the name */
+		uint16_t le_name_length;	/* bytes in name, incl null */
+		uint16_t le_value_chunk;	/* first chunk of the value */
+		uint16_t le_value_length;	/* value length in ints */
+		uint32_t le_cd;			/* collision differentiator */
+		uint64_t le_hash;		/* hash value of the name */
+	} l_entry;
+	struct zap_leaf_array {
+		uint8_t la_type;		/* always ZAP_CHUNK_ARRAY */
+		uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
+		uint16_t la_next;		/* next blk or CHAIN_END */
+	} l_array;
+	struct zap_leaf_free {
+		uint8_t lf_type;		/* always ZAP_CHUNK_FREE */
+		uint8_t lf_pad[ZAP_LEAF_ARRAY_BYTES];
+		uint16_t lf_next;	/* next in free list, or CHAIN_END */
+	} l_free;
+} zap_leaf_chunk_t;
+
+#endif /* _SYS_ZAP_LEAF_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/zfs.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,96 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_FS_ZFS_H
+#define	_SYS_FS_ZFS_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * On-disk version number.
+ */
+#define	ZFS_VERSION_1			1ULL
+#define	ZFS_VERSION_2			2ULL
+#define	ZFS_VERSION_3			3ULL
+#define	ZFS_VERSION_4			4ULL
+#define	ZFS_VERSION_5			5ULL
+#define	ZFS_VERSION_6			6ULL
+#define	ZFS_VERSION			ZFS_VERSION_6
+
+/*
+ * The following are configuration names used in the nvlist describing a pool's
+ * configuration.
+ */
+#define	ZPOOL_CONFIG_VERSION		"version"
+#define	ZPOOL_CONFIG_POOL_NAME		"name"
+#define	ZPOOL_CONFIG_POOL_STATE		"state"
+#define	ZPOOL_CONFIG_POOL_TXG		"txg"
+#define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
+#define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
+#define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
+#define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
+#define	ZPOOL_CONFIG_TYPE		"type"
+#define	ZPOOL_CONFIG_CHILDREN		"children"
+#define	ZPOOL_CONFIG_ID			"id"
+#define	ZPOOL_CONFIG_GUID		"guid"
+#define	ZPOOL_CONFIG_PATH		"path"
+#define	ZPOOL_CONFIG_DEVID		"devid"
+#define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
+#define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
+#define	ZPOOL_CONFIG_ASHIFT		"ashift"
+#define	ZPOOL_CONFIG_ASIZE		"asize"
+#define	ZPOOL_CONFIG_DTL		"DTL"
+#define	ZPOOL_CONFIG_STATS		"stats"
+#define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
+#define	ZPOOL_CONFIG_OFFLINE		"offline"
+#define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
+#define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
+#define	ZPOOL_CONFIG_SPARES		"spares"
+#define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
+#define	ZPOOL_CONFIG_NPARITY		"nparity"
+
+#define	VDEV_TYPE_ROOT			"root"
+#define	VDEV_TYPE_MIRROR		"mirror"
+#define	VDEV_TYPE_REPLACING		"replacing"
+#define	VDEV_TYPE_RAIDZ			"raidz"
+#define	VDEV_TYPE_DISK			"disk"
+#define	VDEV_TYPE_FILE			"file"
+#define	VDEV_TYPE_MISSING		"missing"
+#define	VDEV_TYPE_SPARE			"spare"
+
+/*
+ * pool state.  The following states are written to disk as part of the normal
+ * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE.  The remaining states are
+ * software abstractions used at various levels to communicate pool state.
+ */
+typedef enum pool_state {
+	POOL_STATE_ACTIVE = 0,		/* In active use		*/
+	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
+	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
+	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
+	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
+	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
+	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
+} pool_state_t;
+
+#endif	/* _SYS_FS_ZFS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/zfs_acl.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,52 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_FS_ZFS_ACL_H
+#define	_SYS_FS_ZFS_ACL_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#if defined(_LP64) || defined(_I32LPx)
+typedef	int	uid_t;			/* UID type */
+#else
+typedef	long	uid_t;			/* (historical version) */
+#endif
+
+typedef struct ace {
+	uid_t		a_who;		/* uid or gid */
+	uint32_t	a_access_mask;	/* read,write,... */
+	uint16_t	a_flags;	/* see below */
+	uint16_t	a_type;		/* allow or deny */
+} ace_t;
+
+#define	ACE_SLOT_CNT	6
+
+typedef struct zfs_znode_acl {
+	uint64_t	z_acl_extern_obj;	  /* ext acl pieces */
+	uint32_t	z_acl_count;		  /* Number of ACEs */
+	uint16_t	z_acl_version;		  /* acl version */
+	uint16_t	z_acl_pad;		  /* pad */
+	ace_t		z_ace_data[ACE_SLOT_CNT]; /* 6 standard ACEs */
+} zfs_znode_acl_t;
+
+#endif	/* _SYS_FS_ZFS_ACL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/zfs_znode.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,65 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_FS_ZFS_ZNODE_H
+#define	_SYS_FS_ZFS_ZNODE_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#define	MASTER_NODE_OBJ	1
+#define	ZFS_ROOT_OBJ		"ROOT"
+
+/*
+ * This is the persistent portion of the znode.  It is stored
+ * in the "bonus buffer" of the file.  Short symbolic links
+ * are also stored in the bonus buffer.
+ */
+typedef struct znode_phys {
+	uint64_t zp_atime[2];		/*  0 - last file access time */
+	uint64_t zp_mtime[2];		/* 16 - last file modification time */
+	uint64_t zp_ctime[2];		/* 32 - last file change time */
+	uint64_t zp_crtime[2];		/* 48 - creation time */
+	uint64_t zp_gen;		/* 64 - generation (txg of creation) */
+	uint64_t zp_mode;		/* 72 - file mode bits */
+	uint64_t zp_size;		/* 80 - size of file */
+	uint64_t zp_parent;		/* 88 - directory parent (`..') */
+	uint64_t zp_links;		/* 96 - number of links to file */
+	uint64_t zp_xattr;		/* 104 - DMU object for xattrs */
+	uint64_t zp_rdev;		/* 112 - dev_t for VBLK & VCHR files */
+	uint64_t zp_flags;		/* 120 - persistent flags */
+	uint64_t zp_uid;		/* 128 - file owner */
+	uint64_t zp_gid;		/* 136 - owning group */
+	uint64_t zp_pad[4];		/* 144 - future */
+	zfs_znode_acl_t zp_acl;		/* 176 - 263 ACL */
+	/*
+	 * Data may pad out any remaining bytes in the znode buffer, eg:
+	 *
+	 * |<---------------------- dnode_phys (512) ------------------------>|
+	 * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->|
+	 *			|<---- znode (264) ---->|<---- data (56) ---->|
+	 *
+	 * At present, we only use this space to store symbolic links.
+	 */
+} znode_phys_t;
+
+#endif	/* _SYS_FS_ZFS_ZNODE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/zil.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,53 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_ZIL_H
+#define	_SYS_ZIL_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Intent log format:
+ *
+ * Each objset has its own intent log.  The log header (zil_header_t)
+ * for objset N's intent log is kept in the Nth object of the SPA's
+ * intent_log objset.  The log header points to a chain of log blocks,
+ * each of which contains log records (i.e., transactions) followed by
+ * a log block trailer (zil_trailer_t).  The format of a log record
+ * depends on the record (or transaction) type, but all records begin
+ * with a common structure that defines the type, length, and txg.
+ */
+
+/*
+ * Intent log header - this on disk structure holds fields to manage
+ * the log.  All fields are 64 bit to easily handle cross architectures.
+ */
+typedef struct zil_header {
+	uint64_t zh_claim_txg;	/* txg in which log blocks were claimed */
+	uint64_t zh_replay_seq;	/* highest replayed sequence number */
+	blkptr_t zh_log;	/* log chain */
+	uint64_t zh_claim_seq;	/* highest claimed sequence number */
+	uint64_t zh_pad[5];
+} zil_header_t;
+
+#endif	/* _SYS_ZIL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/zio.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,83 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _ZIO_H
+#define	_ZIO_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#define	ZBT_MAGIC	0x210da7ab10c7a11ULL	/* zio data bloc tail */
+
+typedef struct zio_block_tail {
+	uint64_t	zbt_magic;	/* for validation, endianness	*/
+	zio_cksum_t	zbt_cksum;	/* 256-bit checksum		*/
+} zio_block_tail_t;
+
+/*
+ * Gang block headers are self-checksumming and contain an array
+ * of block pointers.
+ */
+#define	SPA_GANGBLOCKSIZE	SPA_MINBLOCKSIZE
+#define	SPA_GBH_NBLKPTRS	((SPA_GANGBLOCKSIZE - \
+	sizeof (zio_block_tail_t)) / sizeof (blkptr_t))
+#define	SPA_GBH_FILLER		((SPA_GANGBLOCKSIZE - \
+	sizeof (zio_block_tail_t) - \
+	(SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
+	sizeof (uint64_t))
+
+#define	ZIO_GET_IOSIZE(zio)	\
+	(BP_IS_GANG((zio)->io_bp) ? \
+	SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp))
+
+typedef struct zio_gbh {
+	blkptr_t		zg_blkptr[SPA_GBH_NBLKPTRS];
+	uint64_t		zg_filler[SPA_GBH_FILLER];
+	zio_block_tail_t	zg_tail;
+} zio_gbh_phys_t;
+
+enum zio_checksum {
+	ZIO_CHECKSUM_INHERIT = 0,
+	ZIO_CHECKSUM_ON,
+	ZIO_CHECKSUM_OFF,
+	ZIO_CHECKSUM_LABEL,
+	ZIO_CHECKSUM_GANG_HEADER,
+	ZIO_CHECKSUM_ZILOG,
+	ZIO_CHECKSUM_FLETCHER_2,
+	ZIO_CHECKSUM_FLETCHER_4,
+	ZIO_CHECKSUM_SHA256,
+	ZIO_CHECKSUM_FUNCTIONS
+};
+
+#define	ZIO_CHECKSUM_ON_VALUE	ZIO_CHECKSUM_FLETCHER_2
+#define	ZIO_CHECKSUM_DEFAULT	ZIO_CHECKSUM_ON
+
+enum zio_compress {
+	ZIO_COMPRESS_INHERIT = 0,
+	ZIO_COMPRESS_ON,
+	ZIO_COMPRESS_OFF,
+	ZIO_COMPRESS_LZJB,
+	ZIO_COMPRESS_EMPTY,
+	ZIO_COMPRESS_FUNCTIONS
+};
+
+#endif	/* _ZIO_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs-include/zio_checksum.h	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,44 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_ZIO_CHECKSUM_H
+#define	_SYS_ZIO_CHECKSUM_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Signature for checksum functions.
+ */
+typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp);
+
+/*
+ * Information about each checksum function.
+ */
+typedef struct zio_checksum_info {
+	zio_checksum_t	*ci_func[2]; /* checksum function for each byteorder */
+	int		ci_correctable;	/* number of correctable bits	*/
+	int		ci_zbt;		/* uses zio block tail?	*/
+	char		*ci_name;	/* descriptive name */
+} zio_checksum_info_t;
+
+#endif	/* _SYS_ZIO_CHECKSUM_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs_fletcher.c	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,95 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include "fsys_zfs.h"
+
+
+void
+fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
+{
+	const uint64_t *ip = buf;
+	const uint64_t *ipend = ip + (size / sizeof (uint64_t));
+	uint64_t a0, b0, a1, b1;
+
+	for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) {
+		a0 += ip[0];
+		a1 += ip[1];
+		b0 += a0;
+		b1 += a1;
+	}
+
+	ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1);
+}
+
+void
+fletcher_2_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp)
+{
+	const uint64_t *ip = buf;
+	const uint64_t *ipend = ip + (size / sizeof (uint64_t));
+	uint64_t a0, b0, a1, b1;
+
+	for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) {
+		a0 += BSWAP_64(ip[0]);
+		a1 += BSWAP_64(ip[1]);
+		b0 += a0;
+		b1 += a1;
+	}
+
+	ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1);
+}
+
+void
+fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp)
+{
+	const uint32_t *ip = buf;
+	const uint32_t *ipend = ip + (size / sizeof (uint32_t));
+	uint64_t a, b, c, d;
+
+	for (a = b = c = d = 0; ip < ipend; ip++) {
+		a += ip[0];
+		b += a;
+		c += b;
+		d += c;
+	}
+
+	ZIO_SET_CHECKSUM(zcp, a, b, c, d);
+}
+
+void
+fletcher_4_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp)
+{
+	const uint32_t *ip = buf;
+	const uint32_t *ipend = ip + (size / sizeof (uint32_t));
+	uint64_t a, b, c, d;
+
+	for (a = b = c = d = 0; ip < ipend; ip++) {
+		a += BSWAP_32(ip[0]);
+		b += a;
+		c += b;
+		d += c;
+	}
+
+	ZIO_SET_CHECKSUM(zcp, a, b, c, d);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs_lzjb.c	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,61 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include "fsys_zfs.h"
+
+#define	MATCH_BITS	6
+#define	MATCH_MIN	3
+#define	OFFSET_MASK	((1 << (16 - MATCH_BITS)) - 1)
+
+
+/*ARGSUSED*/
+int
+lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len)
+{
+	uchar_t *src = s_start;
+	uchar_t *dst = d_start;
+	uchar_t *d_end = (uchar_t *)d_start + d_len;
+	uchar_t *cpy, copymap;
+	int copymask = 1 << (NBBY - 1);
+
+	while (dst < d_end) {
+		if ((copymask <<= 1) == (1 << NBBY)) {
+			copymask = 1;
+			copymap = *src++;
+		}
+		if (copymap & copymask) {
+			int mlen = (src[0] >> (NBBY - MATCH_BITS)) + MATCH_MIN;
+			int offset = ((src[0] << NBBY) | src[1]) & OFFSET_MASK;
+			src += 2;
+			if ((cpy = dst - offset) < (uchar_t *)d_start)
+				return (-1);
+			while (--mlen >= 0 && dst < d_end)
+				*dst++ = *cpy++;
+		} else {
+			*dst++ = *src++;
+		}
+	}
+	return (0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/grub/grub-0.95/stage2/zfs_sha256.c	Wed Mar 28 12:48:13 2007 -0700
@@ -0,0 +1,126 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include "fsys_zfs.h"
+
+/*
+ * SHA-256 checksum, as specified in FIPS 180-2, available at:
+ * http://csrc.nist.gov/cryptval
+ *
+ * This is a very compact implementation of SHA-256.
+ * It is designed to be simple and portable, not to be fast.
+ */
+
+/*
+ * The literal definitions according to FIPS180-2 would be:
+ *
+ * 	Ch(x, y, z)     (((x) & (y)) ^ ((~(x)) & (z)))
+ * 	Maj(x, y, z)    (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
+ *
+ * We use logical equivalents which require one less op.
+ */
+#define	Ch(x, y, z)	((z) ^ ((x) & ((y) ^ (z))))
+#define	Maj(x, y, z)	(((x) & (y)) ^ ((z) & ((x) ^ (y))))
+#define	Rot32(x, s)	(((x) >> s) | ((x) << (32 - s)))
+#define	SIGMA0(x)	(Rot32(x, 2) ^ Rot32(x, 13) ^ Rot32(x, 22))
+#define	SIGMA1(x)	(Rot32(x, 6) ^ Rot32(x, 11) ^ Rot32(x, 25))
+#define	sigma0(x)	(Rot32(x, 7) ^ Rot32(x, 18) ^ ((x) >> 3))
+#define	sigma1(x)	(Rot32(x, 17) ^ Rot32(x, 19) ^ ((x) >> 10))
+
+static const uint32_t SHA256_K[64] = {
+	0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+	0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+	0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+	0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+	0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+	0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+	0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+	0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+	0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+	0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+	0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+	0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+	0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+	0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+	0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+	0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+};
+
+static void
+SHA256Transform(uint32_t *H, const uint8_t *cp)
+{
+	uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64];
+
+	for (t = 0; t < 16; t++, cp += 4)
+		W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | cp[3];
+
+	for (t = 16; t < 64; t++)
+		W[t] = sigma1(W[t - 2]) + W[t - 7] +
+		    sigma0(W[t - 15]) + W[t - 16];
+
+	a = H[0]; b = H[1]; c = H[2]; d = H[3];
+	e = H[4]; f = H[5]; g = H[6]; h = H[7];
+
+	for (t = 0; t < 64; t++) {
+		T1 = h + SIGMA1(e) + Ch(e, f, g) + SHA256_K[t] + W[t];
+		T2 = SIGMA0(a) + Maj(a, b, c);
+		h = g; g = f; f = e; e = d + T1;
+		d = c; c = b; b = a; a = T1 + T2;
+	}
+
+	H[0] += a; H[1] += b; H[2] += c; H[3] += d;
+	H[4] += e; H[5] += f; H[6] += g; H[7] += h;
+}
+
+void
+zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp)
+{
+	uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
+	    0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 };
+	uint8_t pad[128];
+	int padsize = size & 63;
+	int i;
+
+	for (i = 0; i < size - padsize; i += 64)
+		SHA256Transform(H, (uint8_t *)buf + i);
+
+	for (i = 0; i < padsize; i++)
+		pad[i] = ((uint8_t *)buf)[i];
+
+	for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++)
+		pad[padsize] = 0;
+
+	for (i = 0; i < 8; i++)
+		pad[padsize++] = (size << 3) >> (56 - 8 * i);
+
+	for (i = 0; i < padsize; i += 64)
+		SHA256Transform(H, pad + i);
+
+	ZIO_SET_CHECKSUM(zcp,
+	    (uint64_t)H[0] << 32 | H[1],
+	    (uint64_t)H[2] << 32 | H[3],
+	    (uint64_t)H[4] << 32 | H[5],
+	    (uint64_t)H[6] << 32 | H[7]);
+}
--- a/usr/src/lib/libzfs/common/libzfs.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/lib/libzfs/common/libzfs.h	Wed Mar 28 12:48:13 2007 -0700
@@ -94,7 +94,10 @@
 	EZFS_NOHISTORY,		/* no history object */
 	EZFS_UNSHAREISCSIFAILED, /* iscsitgtd failed request to unshare */
 	EZFS_SHAREISCSIFAILED,	/* iscsitgtd failed request to share */
-	EZFS_UNKNOWN		/* unknown error */
+	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_UNKNOWN
 };
 
 /*
@@ -162,6 +165,15 @@
 extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *);
 
 /*
+ * Functions to manage pool properties
+ */
+extern int zpool_set_prop(zpool_handle_t *, const char *, const char *);
+extern int zpool_get_prop(zpool_handle_t *, zfs_prop_t, char *,
+	size_t proplen, zfs_source_t *);
+extern const char *zpool_prop_to_name(zpool_prop_t);
+extern const char *zpool_prop_values(zpool_prop_t);
+
+/*
  * Pool health statistics.
  */
 typedef enum {
@@ -237,16 +249,6 @@
 extern zfs_type_t zfs_get_type(const zfs_handle_t *);
 extern const char *zfs_get_name(const zfs_handle_t *);
 
-typedef enum {
-	ZFS_SRC_NONE = 0x1,
-	ZFS_SRC_DEFAULT = 0x2,
-	ZFS_SRC_TEMPORARY = 0x4,
-	ZFS_SRC_LOCAL = 0x8,
-	ZFS_SRC_INHERITED = 0x10
-} zfs_source_t;
-
-#define	ZFS_SRC_ALL	0x1f
-
 /*
  * Property management functions.  Some functions are shared with the kernel,
  * and are found in sys/fs/zfs.h.
@@ -267,6 +269,7 @@
 extern int zfs_prop_is_string(zfs_prop_t prop);
 extern const char *zfs_prop_column_name(zfs_prop_t);
 extern boolean_t zfs_prop_align_right(zfs_prop_t);
+extern void nicebool(int value, char *buf, size_t buflen);
 
 typedef struct zfs_proplist {
 	zfs_prop_t	pl_prop;
@@ -277,15 +280,40 @@
 	boolean_t	pl_fixed;
 } zfs_proplist_t;
 
+typedef zfs_proplist_t zpool_proplist_t;
+
 extern int zfs_get_proplist(libzfs_handle_t *, char *, zfs_proplist_t **);
+extern int zpool_get_proplist(libzfs_handle_t *, char *, zpool_proplist_t **);
+extern int zfs_expand_proplist(zfs_handle_t *, zfs_proplist_t **);
+extern int zpool_expand_proplist(zpool_handle_t *, zpool_proplist_t **);
 extern void zfs_free_proplist(zfs_proplist_t *);
-extern int zfs_expand_proplist(zfs_handle_t *, zfs_proplist_t **);
 extern nvlist_t *zfs_get_user_props(zfs_handle_t *);
 
 #define	ZFS_MOUNTPOINT_NONE	"none"
 #define	ZFS_MOUNTPOINT_LEGACY	"legacy"
 
 /*
+ * Functions for printing properties from zfs/zpool
+ */
+typedef struct libzfs_get_cbdata {
+	int cb_sources;
+	int cb_columns[4];
+	int cb_colwidths[5];
+	boolean_t cb_scripted;
+	boolean_t cb_literal;
+	boolean_t cb_first;
+	zfs_proplist_t *cb_proplist;
+} libzfs_get_cbdata_t;
+
+void libzfs_print_one_property(const char *, libzfs_get_cbdata_t *,
+    const char *, const char *, zfs_source_t, const char *);
+
+#define	GET_COL_NAME		1
+#define	GET_COL_PROPERTY	2
+#define	GET_COL_VALUE		3
+#define	GET_COL_SOURCE		4
+
+/*
  * Iterator functions.
  */
 typedef int (*zfs_iter_f)(zfs_handle_t *, void *);
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c	Wed Mar 28 12:48:13 2007 -0700
@@ -680,13 +680,39 @@
 }
 
 /*
+ * Check if the bootfs name has the same pool name as it is set to.
+ * Assuming bootfs is a valid dataset name.
+ */
+static boolean_t
+bootfs_poolname_valid(char *pool, char *bootfs)
+{
+	char ch, *pname;
+
+	/* get the pool name from the bootfs name */
+	pname = bootfs;
+	while (*bootfs && !isspace(*bootfs) && *bootfs != '/')
+		bootfs++;
+
+	ch = *bootfs;
+	*bootfs = 0;
+
+	if (strcmp(pool, pname) == 0) {
+		*bootfs = ch;
+		return (B_TRUE);
+	}
+
+	*bootfs = ch;
+	return (B_FALSE);
+}
+
+/*
  * Given an nvlist of properties to set, validates that they are correct, and
  * parses any numeric properties (index, boolean, etc) if they are specified as
  * strings.
  */
-static nvlist_t *
-zfs_validate_properties(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
-    uint64_t zoned, zfs_handle_t *zhp, const char *errbuf)
+nvlist_t *
+zfs_validate_properties(libzfs_handle_t *hdl, zfs_type_t type, char *pool_name,
+    nvlist_t *nvl, uint64_t zoned, zfs_handle_t *zhp, const char *errbuf)
 {
 	nvpair_t *elem;
 	const char *propname;
@@ -694,6 +720,7 @@
 	uint64_t intval;
 	char *strval;
 	nvlist_t *ret;
+	int isuser;
 
 	if (nvlist_alloc(&ret, NV_UNIQUE_NAME, 0) != 0) {
 		(void) no_memory(hdl);
@@ -714,8 +741,10 @@
 		/*
 		 * Make sure this property is valid and applies to this type.
 		 */
-		if ((prop = zfs_name_to_prop(propname)) == ZFS_PROP_INVAL) {
-			if (!zfs_prop_user(propname)) {
+		if ((prop = zfs_name_to_prop_common(propname, type))
+		    == ZFS_PROP_INVAL) {
+			isuser = zfs_prop_user(propname);
+			if (!isuser || (isuser && (type & ZFS_TYPE_POOL))) {
 				zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
 				    "invalid property '%s'"),
 				    propname);
@@ -927,6 +956,22 @@
 			}
 
 			break;
+
+		case ZFS_PROP_BOOTFS:
+			/*
+			 * bootfs property value has to be a dataset name and
+			 * the dataset has to be in the same pool as it sets to.
+			 */
+			if (strval[0] != '\0' && (!zfs_name_valid(strval,
+			    ZFS_TYPE_FILESYSTEM) || !bootfs_poolname_valid(
+			    pool_name, strval))) {
+
+				zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "'%s' "
+				    "is an invalid name"), strval);
+				(void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf);
+				goto error;
+			}
+			break;
 		}
 
 		/*
@@ -1035,7 +1080,7 @@
 		goto error;
 	}
 
-	if ((realprops = zfs_validate_properties(hdl, zhp->zfs_type, nvl,
+	if ((realprops = zfs_validate_properties(hdl, zhp->zfs_type, NULL, nvl,
 	    zfs_prop_get_int(zhp, ZFS_PROP_ZONED), zhp, errbuf)) == NULL)
 		goto error;
 	nvlist_free(nvl);
@@ -1246,7 +1291,7 @@
 	return (ret);
 }
 
-static void
+void
 nicebool(int value, char *buf, size_t buflen)
 {
 	if (value)
@@ -1533,7 +1578,7 @@
 			return (-1);
 		if (literal)
 			(void) snprintf(propbuf, proplen, "%llu",
-			(u_longlong_t)val);
+			    (u_longlong_t)val);
 		else
 			zfs_nicenum(val, propbuf, proplen);
 		break;
@@ -1644,7 +1689,7 @@
 		} else {
 			if (literal)
 				(void) snprintf(propbuf, proplen, "%llu",
-				(u_longlong_t)val);
+				    (u_longlong_t)val);
 			else
 				zfs_nicenum(val, propbuf, proplen);
 		}
@@ -1995,8 +2040,8 @@
 	else
 		zc.zc_objset_type = DMU_OST_ZFS;
 
-	if (props && (props = zfs_validate_properties(hdl, type, props, zoned,
-	    NULL, errbuf)) == 0)
+	if (props && (props = zfs_validate_properties(hdl, type, NULL, props,
+	    zoned, NULL, errbuf)) == 0)
 		return (-1);
 
 	if (type == ZFS_TYPE_VOLUME) {
@@ -2053,8 +2098,17 @@
 	/* create the dataset */
 	ret = ioctl(hdl->libzfs_fd, ZFS_IOC_CREATE, &zc);
 
-	if (ret == 0 && type == ZFS_TYPE_VOLUME)
+	if (ret == 0 && type == ZFS_TYPE_VOLUME) {
 		ret = zvol_create_link(hdl, path);
+		if (ret) {
+			(void) zfs_standard_error(hdl, errno,
+			    dgettext(TEXT_DOMAIN,
+			    "Volume successfully created, but device links "
+			    "were not created"));
+			zcmd_free_nvlists(&zc);
+			return (-1);
+		}
+	}
 
 	zcmd_free_nvlists(&zc);
 
@@ -2262,8 +2316,8 @@
 	}
 
 	if (props) {
-		if ((props = zfs_validate_properties(hdl, type, props, zoned,
-		    zhp, errbuf)) == NULL)
+		if ((props = zfs_validate_properties(hdl, type, NULL, props,
+		    zoned, zhp, errbuf)) == NULL)
 			return (-1);
 
 		if (zcmd_write_src_nvlist(hdl, &zc, props, NULL) != 0) {
@@ -2724,7 +2778,7 @@
 
 	if (strchr(drr.drr_u.drr_begin.drr_toname, '@') == NULL) {
 		zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "invalid "
-			    "stream (bad snapshot name)"));
+		    "stream (bad snapshot name)"));
 		return (zfs_error(hdl, EZFS_BADSTREAM, errbuf));
 	}
 	/*
@@ -3174,7 +3228,7 @@
 				    "snapshots must be part of same "
 				    "dataset"));
 				return (zfs_error(hdl, EZFS_CROSSTARGET,
-					    errbuf));
+				    errbuf));
 			}
 		}
 		if (!zfs_validate_name(hdl, target, zhp->zfs_type))
@@ -3201,7 +3255,7 @@
 
 		/* new name cannot be a child of the current dataset name */
 		if (strncmp(parent, zhp->zfs_name,
-			    strlen(zhp->zfs_name)) == 0) {
+		    strlen(zhp->zfs_name)) == 0) {
 			zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
 			    "New dataset name cannot be a descendent of "
 			    "current dataset name"));
@@ -3352,7 +3406,8 @@
  * per-dataset basis by zfs_expand_proplist().
  */
 int
-zfs_get_proplist(libzfs_handle_t *hdl, char *fields, zfs_proplist_t **listp)
+zfs_get_proplist_common(libzfs_handle_t *hdl, char *fields,
+    zfs_proplist_t **listp, zfs_type_t type)
 {
 	size_t len;
 	char *s, *p;
@@ -3408,13 +3463,19 @@
 		 */
 		c = s[len];
 		s[len] = '\0';
-		prop = zfs_name_to_prop(s);
+		prop = zfs_name_to_prop_common(s, type);
+
+		if (prop != ZFS_PROP_INVAL &&
+		    !zfs_prop_valid_for_type(prop, type))
+			prop = ZFS_PROP_INVAL;
 
 		/*
-		 * If no column is specified, and this isn't a user property,
-		 * return failure.
+		 * When no property table entry can be found, return failure if
+		 * this is a pool property or if this isn't a user-defined
+		 * dataset property,
 		 */
-		if (prop == ZFS_PROP_INVAL && !zfs_prop_user(s)) {
+		if (prop == ZFS_PROP_INVAL &&
+		    (type & ZFS_TYPE_POOL || !zfs_prop_user(s))) {
 			zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
 			    "invalid property '%s'"), s);
 			return (zfs_error(hdl, EZFS_BADPROP,
@@ -3448,6 +3509,12 @@
 	return (0);
 }
 
+int
+zfs_get_proplist(libzfs_handle_t *hdl, char *fields, zfs_proplist_t **listp)
+{
+	return (zfs_get_proplist_common(hdl, fields, listp, ZFS_TYPE_ANY));
+}
+
 void
 zfs_free_proplist(zfs_proplist_t *pl)
 {
@@ -3485,27 +3552,12 @@
 	return (ZFS_PROP_CONT);
 }
 
-/*
- * This function is used by 'zfs list' to determine the exact set of columns to
- * display, and their maximum widths.  This does two main things:
- *
- * 	- If this is a list of all properties, then expand the list to include
- *	  all native properties, and set a flag so that for each dataset we look
- *	  for new unique user properties and add them to the list.
- *
- * 	- For non fixed-width properties, keep track of the maximum width seen
- *	  so that we can size the column appropriately.
- */
 int
-zfs_expand_proplist(zfs_handle_t *zhp, zfs_proplist_t **plp)
+zfs_expand_proplist_common(libzfs_handle_t *hdl, zfs_proplist_t **plp,
+	zfs_type_t type)
 {
-	libzfs_handle_t *hdl = zhp->zfs_hdl;
 	zfs_proplist_t *entry;
-	zfs_proplist_t **last, **start;
-	nvlist_t *userprops, *propval;
-	nvpair_t *elem;
-	char *strval;
-	char buf[ZFS_MAXPROPLEN];
+	zfs_proplist_t **last;
 	expand_data_t exp;
 
 	if (*plp == NULL) {
@@ -3519,7 +3571,7 @@
 		exp.last = last;
 		exp.hdl = hdl;
 
-		if (zfs_prop_iter(zfs_expand_proplist_cb, &exp,
+		if (zfs_prop_iter_common(zfs_expand_proplist_cb, &exp, type,
 		    B_FALSE) == ZFS_PROP_INVAL)
 			return (-1);
 
@@ -3538,6 +3590,33 @@
 		entry->pl_next = *plp;
 		*plp = entry;
 	}
+	return (0);
+}
+
+/*
+ * This function is used by 'zfs list' to determine the exact set of columns to
+ * display, and their maximum widths.  This does two main things:
+ *
+ *      - If this is a list of all properties, then expand the list to include
+ *        all native properties, and set a flag so that for each dataset we look
+ *        for new unique user properties and add them to the list.
+ *
+ *      - For non fixed-width properties, keep track of the maximum width seen
+ *        so that we can size the column appropriately.
+ */
+int
+zfs_expand_proplist(zfs_handle_t *zhp, zfs_proplist_t **plp)
+{
+	libzfs_handle_t *hdl = zhp->zfs_hdl;
+	zfs_proplist_t *entry;
+	zfs_proplist_t **last, **start;
+	nvlist_t *userprops, *propval;
+	nvpair_t *elem;
+	char *strval;
+	char buf[ZFS_MAXPROPLEN];
+
+	if (zfs_expand_proplist_common(hdl, plp, ZFS_TYPE_ANY) != 0)
+		return (-1);
 
 	userprops = zfs_get_user_props(zhp);
 
--- a/usr/src/lib/libzfs/common/libzfs_impl.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/lib/libzfs/common/libzfs_impl.h	Wed Mar 28 12:48:13 2007 -0700
@@ -82,6 +82,7 @@
 	size_t zpool_config_size;
 	nvlist_t *zpool_config;
 	nvlist_t *zpool_old_config;
+	nvlist_t *zpool_props;
 };
 
 int zfs_error(libzfs_handle_t *, int, const char *);
@@ -100,6 +101,16 @@
 int get_dependents(libzfs_handle_t *, boolean_t, const char *, char ***,
     size_t *);
 
+int zfs_expand_proplist_common(libzfs_handle_t *, zfs_proplist_t **,
+    zfs_type_t);
+int zfs_get_proplist_common(libzfs_handle_t *, char *, zfs_proplist_t **,
+    zfs_type_t);
+zfs_prop_t zfs_prop_iter_common(zfs_prop_f, void *, zfs_type_t, boolean_t);
+zfs_prop_t zfs_name_to_prop_common(const char *, zfs_type_t);
+
+nvlist_t *zfs_validate_properties(libzfs_handle_t *, zfs_type_t, char *,
+	nvlist_t *, uint64_t, zfs_handle_t *zhp, const char *errbuf);
+
 typedef struct prop_changelist prop_changelist_t;
 
 int zcmd_alloc_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *, size_t);
--- a/usr/src/lib/libzfs/common/libzfs_pool.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/lib/libzfs/common/libzfs_pool.c	Wed Mar 28 12:48:13 2007 -0700
@@ -43,6 +43,7 @@
 #include <strings.h>
 
 #include "zfs_namecheck.h"
+#include "zfs_prop.h"
 #include "libzfs_impl.h"
 
 /*
@@ -131,6 +132,39 @@
 	return (B_TRUE);
 }
 
+static int
+zpool_get_all_props(zpool_handle_t *zhp)
+{
+	zfs_cmd_t zc = { 0 };
+	libzfs_handle_t *hdl = zhp->zpool_hdl;
+
+	(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
+
+	if (zcmd_alloc_dst_nvlist(hdl, &zc, 0) != 0)
+		return (-1);
+
+	while (ioctl(hdl->libzfs_fd, ZFS_IOC_POOL_GET_PROPS, &zc) != 0) {
+		if (errno == ENOMEM) {
+			if (zcmd_expand_dst_nvlist(hdl, &zc) != 0) {
+				zcmd_free_nvlists(&zc);
+				return (-1);
+			}
+		} else {
+			zcmd_free_nvlists(&zc);
+			return (-1);
+		}
+	}
+
+	if (zcmd_read_dst_nvlist(hdl, &zc, &zhp->zpool_props) != 0) {
+		zcmd_free_nvlists(&zc);
+		return (-1);
+	}
+
+	zcmd_free_nvlists(&zc);
+
+	return (0);
+}
+
 /*
  * Open a handle to the given pool, even if the pool is currently in the FAULTED
  * state.
@@ -238,6 +272,8 @@
 		nvlist_free(zhp->zpool_config);
 	if (zhp->zpool_old_config)
 		nvlist_free(zhp->zpool_old_config);
+	if (zhp->zpool_props)
+		nvlist_free(zhp->zpool_props);
 	free(zhp);
 }
 
@@ -547,6 +583,12 @@
 			(void) zfs_error(hdl, EZFS_BADVERSION, msg);
 			break;
 
+		case EDOM:
+			zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+			    "root pool can not have concatenated devices"));
+			(void) zfs_error(hdl, EZFS_POOL_NOTSUP, msg);
+			break;
+
 		default:
 			(void) zpool_standard_error(hdl, errno, msg);
 		}
@@ -579,7 +621,6 @@
 		return (zpool_standard_error_fmt(zhp->zpool_hdl, errno,
 		    dgettext(TEXT_DOMAIN, "cannot export '%s'"),
 		    zhp->zpool_name));
-
 	return (0);
 }
 
@@ -1646,7 +1687,7 @@
  */
 void
 zpool_log_history(libzfs_handle_t *hdl, int argc, char **argv, const char *path,
-    boolean_t pool, boolean_t pool_create)
+	boolean_t pool, boolean_t pool_create)
 {
 	char cmd_buf[HIS_MAX_RECORD_LEN];
 	char *dspath;
@@ -1862,3 +1903,151 @@
 	}
 	free(mntpnt);
 }
+
+int
+zpool_set_prop(zpool_handle_t *zhp, const char *propname, const char *propval)
+{
+	zfs_cmd_t zc = { 0 };
+	int ret = -1;
+	char errbuf[1024];
+	nvlist_t *nvl = NULL;
+	nvlist_t *realprops;
+
+	(void) snprintf(errbuf, sizeof (errbuf),
+	    dgettext(TEXT_DOMAIN, "cannot set property for '%s'"),
+	    zhp->zpool_name);
+
+	if (zpool_get_version(zhp) < ZFS_VERSION_BOOTFS) {
+		zfs_error_aux(zhp->zpool_hdl,
+		    dgettext(TEXT_DOMAIN, "pool must be "
+		    "upgraded to support pool properties"));
+		return (zfs_error(zhp->zpool_hdl, EZFS_BADVERSION, errbuf));
+	}
+
+	if (zhp->zpool_props == NULL && zpool_get_all_props(zhp))
+		return (zfs_error(zhp->zpool_hdl, EZFS_POOLPROPS, errbuf));
+
+	if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0 ||
+	    nvlist_add_string(nvl, propname, propval) != 0) {
+		return (no_memory(zhp->zpool_hdl));
+	}
+
+	if ((realprops = zfs_validate_properties(zhp->zpool_hdl, ZFS_TYPE_POOL,
+	    zhp->zpool_name, nvl, 0, NULL, errbuf)) == NULL) {
+		nvlist_free(nvl);
+		return (-1);
+	}
+
+	nvlist_free(nvl);
+	nvl = realprops;
+
+	/*
+	 * Execute the corresponding ioctl() to set this property.
+	 */
+	(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
+
+	if (zcmd_write_src_nvlist(zhp->zpool_hdl, &zc, nvl, NULL) != 0)
+		return (-1);
+
+	ret = ioctl(zhp->zpool_hdl->libzfs_fd, ZFS_IOC_POOL_SET_PROPS, &zc);
+	zcmd_free_nvlists(&zc);
+
+	if (ret)
+		(void) zpool_standard_error(zhp->zpool_hdl, errno, errbuf);
+
+	return (ret);
+}
+
+int
+zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *propbuf,
+    size_t proplen, zfs_source_t *srctype)
+{
+	uint64_t value;
+	char msg[1024], *strvalue;
+	nvlist_t *nvp;
+	zfs_source_t src = ZFS_SRC_NONE;
+
+	(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
+	    "cannot get property '%s'"), zpool_prop_to_name(prop));
+
+	if (zpool_get_version(zhp) < ZFS_VERSION_BOOTFS) {
+		zfs_error_aux(zhp->zpool_hdl,
+		    dgettext(TEXT_DOMAIN, "pool must be "
+		    "upgraded to support pool properties"));
+		return (zfs_error(zhp->zpool_hdl, EZFS_BADVERSION, msg));
+	}
+
+	if (zhp->zpool_props == NULL && zpool_get_all_props(zhp))
+		return (zfs_error(zhp->zpool_hdl, EZFS_POOLPROPS, msg));
+
+	/*
+	 * the "name" property is special cased
+	 */
+	if (!zfs_prop_valid_for_type(prop, ZFS_TYPE_POOL) &&
+	    prop != ZFS_PROP_NAME)
+		return (-1);
+
+	switch (prop) {
+	case ZFS_PROP_NAME:
+		(void) strlcpy(propbuf, zhp->zpool_name, proplen);
+		break;
+
+	case ZFS_PROP_BOOTFS:
+		if (nvlist_lookup_nvlist(zhp->zpool_props,
+		    zpool_prop_to_name(prop), &nvp) != 0) {
+			strvalue = (char *)zfs_prop_default_string(prop);
+			if (strvalue == NULL)
+				strvalue = "-";
+			src = ZFS_SRC_DEFAULT;
+		} else {
+			VERIFY(nvlist_lookup_uint64(nvp,
+			    ZFS_PROP_SOURCE, &value) == 0);
+			src = value;
+			VERIFY(nvlist_lookup_string(nvp, ZFS_PROP_VALUE,
+			    &strvalue) == 0);
+			if (strlen(strvalue) >= proplen)
+				return (-1);
+		}
+		(void) strcpy(propbuf, strvalue);
+		break;
+
+	default:
+		return (-1);
+	}
+	if (srctype)
+		*srctype = src;
+	return (0);
+}
+
+int
+zpool_get_proplist(libzfs_handle_t *hdl, char *fields, zpool_proplist_t **listp)
+{
+	return (zfs_get_proplist_common(hdl, fields, listp, ZFS_TYPE_POOL));
+}
+
+
+int
+zpool_expand_proplist(zpool_handle_t *zhp, zpool_proplist_t **plp)
+{
+	libzfs_handle_t *hdl = zhp->zpool_hdl;
+	zpool_proplist_t *entry;
+	char buf[ZFS_MAXPROPLEN];
+
+	if (zfs_expand_proplist_common(hdl, plp, ZFS_TYPE_POOL) != 0)
+		return (-1);
+
+	for (entry = *plp; entry != NULL; entry = entry->pl_next) {
+
+		if (entry->pl_fixed)
+			continue;
+
+		if (entry->pl_prop != ZFS_PROP_INVAL &&
+		    zpool_get_prop(zhp, entry->pl_prop, buf, sizeof (buf),
+		    NULL) == 0) {
+			if (strlen(buf) > entry->pl_width)
+				entry->pl_width = strlen(buf);
+		}
+	}
+
+	return (0);
+}
--- a/usr/src/lib/libzfs/common/libzfs_util.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/lib/libzfs/common/libzfs_util.c	Wed Mar 28 12:48:13 2007 -0700
@@ -158,6 +158,15 @@
 	case EZFS_SHAREISCSIFAILED:
 		return (dgettext(TEXT_DOMAIN,
 		    "iscsitgtd failed request to share"));
+	case EZFS_POOLPROPS:
+		return (dgettext(TEXT_DOMAIN, "failed to retrieve "
+		    "pool properties"));
+	case EZFS_POOL_NOTSUP:
+		return (dgettext(TEXT_DOMAIN, "operation not supported "
+		    "on this type of pool"));
+	case EZFS_POOL_INVALARG:
+		return (dgettext(TEXT_DOMAIN, "invalid argument for "
+		    "this pool operation"));
 	case EZFS_UNKNOWN:
 		return (dgettext(TEXT_DOMAIN, "unknown error"));
 	default:
@@ -201,7 +210,7 @@
 		}
 
 		(void) fprintf(stderr, "%s: %s\n", hdl->libzfs_action,
-			libzfs_error_description(hdl));
+		    libzfs_error_description(hdl));
 		if (error == EZFS_NOMEM)
 			exit(1);
 	}
@@ -297,7 +306,6 @@
 		    "dataset is busy"));
 		zfs_verror(hdl, EZFS_BUSY, fmt, ap);
 		break;
-
 	default:
 		zfs_error_aux(hdl, strerror(errno));
 		zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
@@ -333,7 +341,8 @@
 		break;
 
 	case ENOENT:
-		zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "no such pool"));
+		zfs_error_aux(hdl,
+		    dgettext(TEXT_DOMAIN, "no such pool or dataset"));
 		zfs_verror(hdl, EZFS_NOENT, fmt, ap);
 		break;
 
@@ -358,6 +367,14 @@
 		zfs_verror(hdl, EZFS_DEVOVERFLOW, fmt, ap);
 		break;
 
+	case ENOTSUP:
+		zfs_verror(hdl, EZFS_POOL_NOTSUP, fmt, ap);
+		break;
+
+	case EINVAL:
+		zfs_verror(hdl, EZFS_POOL_INVALARG, fmt, ap);
+		break;
+
 	default:
 		zfs_error_aux(hdl, strerror(error));
 		zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
@@ -645,3 +662,179 @@
 
 	return (0);
 }
+
+static void
+zfs_print_prop_headers(libzfs_get_cbdata_t *cbp)
+{
+	zfs_proplist_t *pl = cbp->cb_proplist;
+	int i;
+	char *title;
+	size_t len;
+
+	cbp->cb_first = B_FALSE;
+	if (cbp->cb_scripted)
+		return;
+
+	/*
+	 * Start with the length of the column headers.
+	 */
+	cbp->cb_colwidths[GET_COL_NAME] = strlen(dgettext(TEXT_DOMAIN, "NAME"));
+	cbp->cb_colwidths[GET_COL_PROPERTY] = strlen(dgettext(TEXT_DOMAIN,
+	    "PROPERTY"));
+	cbp->cb_colwidths[GET_COL_VALUE] = strlen(dgettext(TEXT_DOMAIN,
+	    "VALUE"));
+	cbp->cb_colwidths[GET_COL_SOURCE] = strlen(dgettext(TEXT_DOMAIN,
+	    "SOURCE"));
+
+	/*
+	 * Go through and calculate the widths for each column.  For the
+	 * 'source' column, we kludge it up by taking the worst-case scenario of
+	 * inheriting from the longest name.  This is acceptable because in the
+	 * majority of cases 'SOURCE' is the last column displayed, and we don't
+	 * use the width anyway.  Note that the 'VALUE' column can be oversized,
+	 * if the name of the property is much longer the any values we find.
+	 */
+	for (pl = cbp->cb_proplist; pl != NULL; pl = pl->pl_next) {
+		/*
+		 * 'PROPERTY' column
+		 */
+		if (pl->pl_prop != ZFS_PROP_INVAL) {
+			len = strlen(zfs_prop_to_name(pl->pl_prop));
+			if (len > cbp->cb_colwidths[GET_COL_PROPERTY])
+				cbp->cb_colwidths[GET_COL_PROPERTY] = len;
+		} else {
+			len = strlen(pl->pl_user_prop);
+			if (len > cbp->cb_colwidths[GET_COL_PROPERTY])
+				cbp->cb_colwidths[GET_COL_PROPERTY] = len;
+		}
+
+		/*
+		 * 'VALUE' column
+		 */
+		if ((pl->pl_prop != ZFS_PROP_NAME || !pl->pl_all) &&
+		    pl->pl_width > cbp->cb_colwidths[GET_COL_VALUE])
+			cbp->cb_colwidths[GET_COL_VALUE] = pl->pl_width;
+
+		/*
+		 * 'NAME' and 'SOURCE' columns
+		 */
+		if (pl->pl_prop == ZFS_PROP_NAME &&
+		    pl->pl_width > cbp->cb_colwidths[GET_COL_NAME]) {
+			cbp->cb_colwidths[GET_COL_NAME] = pl->pl_width;
+			cbp->cb_colwidths[GET_COL_SOURCE] = pl->pl_width +
+			    strlen(dgettext(TEXT_DOMAIN, "inherited from"));
+		}
+	}
+
+	/*
+	 * Now go through and print the headers.
+	 */
+	for (i = 0; i < 4; i++) {
+		switch (cbp->cb_columns[i]) {
+		case GET_COL_NAME:
+			title = dgettext(TEXT_DOMAIN, "NAME");
+			break;
+		case GET_COL_PROPERTY:
+			title = dgettext(TEXT_DOMAIN, "PROPERTY");
+			break;
+		case GET_COL_VALUE:
+			title = dgettext(TEXT_DOMAIN, "VALUE");
+			break;
+		case GET_COL_SOURCE:
+			title = dgettext(TEXT_DOMAIN, "SOURCE");
+			break;
+		default:
+			title = NULL;
+		}
+
+		if (title != NULL) {
+			if (i == 3 || cbp->cb_columns[i + 1] == 0)
+				(void) printf("%s", title);
+			else
+				(void) printf("%-*s  ",
+				    cbp->cb_colwidths[cbp->cb_columns[i]],
+				    title);
+		}
+	}
+	(void) printf("\n");
+}
+
+/*
+ * Display a single line of output, according to the settings in the callback
+ * structure.
+ */
+void
+libzfs_print_one_property(const char *name, libzfs_get_cbdata_t *cbp,
+    const char *propname, const char *value, zfs_source_t sourcetype,
+    const char *source)
+{
+	int i;
+	const char *str;
+	char buf[128];
+
+	/*
+	 * Ignore those source types that the user has chosen to ignore.
+	 */
+	if ((sourcetype & cbp->cb_sources) == 0)
+		return;
+
+	if (cbp->cb_first)
+		zfs_print_prop_headers(cbp);
+
+	for (i = 0; i < 4; i++) {
+		switch (cbp->cb_columns[i]) {
+		case GET_COL_NAME:
+			str = name;
+			break;
+
+		case GET_COL_PROPERTY:
+			str = propname;
+			break;
+
+		case GET_COL_VALUE:
+			str = value;
+			break;
+
+		case GET_COL_SOURCE:
+			switch (sourcetype) {
+			case ZFS_SRC_NONE:
+				str = "-";
+				break;
+
+			case ZFS_SRC_DEFAULT:
+				str = "default";
+				break;
+
+			case ZFS_SRC_LOCAL:
+				str = "local";
+				break;
+
+			case ZFS_SRC_TEMPORARY:
+				str = "temporary";
+				break;
+
+			case ZFS_SRC_INHERITED:
+				(void) snprintf(buf, sizeof (buf),
+				    "inherited from %s", source);
+				str = buf;
+				break;
+			}
+			break;
+
+		default:
+			continue;
+		}
+
+		if (cbp->cb_columns[i + 1] == 0)
+			(void) printf("%s", str);
+		else if (cbp->cb_scripted)
+			(void) printf("%s\t", str);
+		else
+			(void) printf("%-*s  ",
+			    cbp->cb_colwidths[cbp->cb_columns[i]],
+			    str);
+
+	}
+
+	(void) printf("\n");
+}
--- a/usr/src/lib/libzfs/common/mapfile-vers	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/lib/libzfs/common/mapfile-vers	Wed Mar 28 12:48:13 2007 -0700
@@ -33,6 +33,7 @@
 	libzfs_fini;
 	libzfs_init;
 	libzfs_print_on_error;
+	libzfs_print_one_property;
 	zfs_clone;
 	zfs_close;
 	zfs_create;
@@ -104,6 +105,7 @@
 	zpool_destroy;
 	zpool_disable_datasets;
 	zpool_enable_datasets;
+	zpool_expand_proplist;
 	zpool_export;
 	zpool_find_import;
 	zpool_find_vdev;
@@ -113,6 +115,8 @@
 	zpool_get_handle;
 	zpool_get_history;
 	zpool_get_name;
+	zpool_get_prop;
+	zpool_get_proplist;
 	zpool_get_root;
 	zpool_get_space_total;
 	zpool_get_space_used;
@@ -128,10 +132,14 @@
 	zpool_obj_to_path;
 	zpool_open;
 	zpool_open_canfail;
+	zpool_prop_iter;
+	zpool_prop_to_name;
+	zpool_prop_values;
 	zpool_read_label;
 	zpool_refresh_stats;
 	zpool_remove_zvol_links;
 	zpool_scrub;
+	zpool_set_prop;
 	zpool_unmount_datasets;
 	zpool_upgrade;
 	zpool_vdev_attach;
--- a/usr/src/lib/libzpool/common/kernel.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/lib/libzpool/common/kernel.c	Wed Mar 28 12:48:13 2007 -0700
@@ -619,7 +619,7 @@
 	vn_rdwr(UIO_READ, (vnode_t *)file->_fd, buf, size, (offset_t)off,
 	    UIO_SYSSPACE, 0, 0, 0, &resid);
 
-	return (0);
+	return (size - resid);
 }
 
 void
@@ -630,15 +630,16 @@
 }
 
 int
-kobj_fstat(intptr_t fd, struct bootstat *bst)
+kobj_get_filesize(struct _buf *file, uint64_t *size)
 {
 	struct stat64 st;
-	vnode_t *vp = (vnode_t *)fd;
+	vnode_t *vp = (vnode_t *)file->_fd;
+
 	if (fstat64(vp->v_fd, &st) == -1) {
 		vn_close(vp);
 		return (errno);
 	}
-	bst->st_size = (uint64_t)st.st_size;
+	*size = st.st_size;
 	return (0);
 }
 
--- a/usr/src/lib/libzpool/common/sys/zfs_context.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/lib/libzpool/common/sys/zfs_context.h	Wed Mar 28 12:48:13 2007 -0700
@@ -443,7 +443,6 @@
 extern int kobj_read_file(struct _buf *file, char *buf, unsigned size,
     unsigned off);
 extern void kobj_close_file(struct _buf *file);
-extern int kobj_fstat(intptr_t, struct bootstat *);
-
+extern int kobj_get_filesize(struct _buf *file, uint64_t *size);
 
 #endif	/* _SYS_ZFS_CONTEXT_H */
--- a/usr/src/pkgdefs/SUNWgrub/prototype_i386	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/pkgdefs/SUNWgrub/prototype_i386	Wed Mar 28 12:48:13 2007 -0700
@@ -2,9 +2,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
 #
 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 # or http://www.opensolaris.org/os/licensing.
@@ -19,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -59,6 +58,7 @@
 f none boot/grub/stage2_eltorito 0644 root sys
 f none boot/grub/ufs2_stage1_5 0644 root sys
 f none boot/grub/ufs_stage1_5 0644 root sys
+f none boot/grub/zfs_stage1_5 0644 root sys
 f none boot/grub/vstafs_stage1_5 0644 root sys
 f none boot/grub/xfs_stage1_5 0644 root sys
 f none boot/grub/stage1 0644 root sys
--- a/usr/src/pkgdefs/SUNWgrubS/prototype_i386	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/pkgdefs/SUNWgrubS/prototype_i386	Wed Mar 28 12:48:13 2007 -0700
@@ -2,9 +2,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
 #
 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 # or http://www.opensolaris.org/os/licensing.
@@ -19,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -154,6 +153,7 @@
 f none usr/share/src/grub/stage2/fsys_reiserfs.c 0644 root bin
 f none usr/share/src/grub/stage2/fsys_ufs.c 0644 root bin
 f none usr/share/src/grub/stage2/fsys_ufs2.c 0644 root bin
+f none usr/share/src/grub/stage2/fsys_zfs.c 0644 root bin
 f none usr/share/src/grub/stage2/fsys_vstafs.c 0644 root bin
 f none usr/share/src/grub/stage2/fsys_xfs.c 0644 root bin
 f none usr/share/src/grub/stage2/graphics.c 0644 root bin
@@ -189,10 +189,32 @@
 f none usr/share/src/grub/stage2/terminfo.h 0644 root bin
 f none usr/share/src/grub/stage2/tparm.c 0644 root bin
 f none usr/share/src/grub/stage2/tparm.h 0644 root bin
+f none usr/share/src/grub/stage2/fsys_zfs.h 0644 root bin
 f none usr/share/src/grub/stage2/ufs.h 0644 root bin
 f none usr/share/src/grub/stage2/ufs2.h 0644 root bin
 f none usr/share/src/grub/stage2/vstafs.h 0644 root bin
 f none usr/share/src/grub/stage2/xfs.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs_sha256.c 0644 root bin
+f none usr/share/src/grub/stage2/zfs_lzjb.c 0644 root bin
+f none usr/share/src/grub/stage2/zfs_fletcher.c 0644 root bin
+
+d none usr/share/src/grub/stage2/zfs-include 0755 root bin
+f none usr/share/src/grub/stage2/zfs-include/dmu.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/dmu_objset.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/dnode.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/dsl_dataset.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/dsl_dir.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/spa.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/uberblock_impl.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/vdev_impl.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/zap_impl.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/zap_leaf.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/zfs.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/zfs_acl.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/zfs_znode.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/zil.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/zio.h 0644 root bin
+f none usr/share/src/grub/stage2/zfs-include/zio_checksum.h 0644 root bin
 
 d none usr/share/src/grub/stage1 0755 root bin
 f none usr/share/src/grub/stage1/Makefile.am 0644 root bin
--- a/usr/src/uts/common/fs/vfs.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/vfs.c	Wed Mar 28 12:48:13 2007 -0700
@@ -990,7 +990,7 @@
 	int		addmip = 0;
 	int		splice = ((uap->flags & MS_NOSPLICE) == 0);
 	int		fromspace = (uap->flags & MS_SYSSPACE) ?
-				UIO_SYSSPACE : UIO_USERSPACE;
+	    UIO_SYSSPACE : UIO_USERSPACE;
 	char		*resource = NULL, *mountpt = NULL;
 	refstr_t	*oldresource, *oldmntpt;
 	struct pathname	pn, rpn;
@@ -1092,7 +1092,7 @@
 			inargs[0] = '\0';
 			if (optlen) {
 				error = copyinstr(opts, inargs, (size_t)optlen,
-					NULL);
+				    NULL);
 				if (error) {
 					goto errout;
 				}
@@ -1165,7 +1165,7 @@
 		 */
 		if ((uap->flags & MS_GLOBAL) == 0 &&
 		    lookupname(uap->spec, fromspace,
-			    FOLLOW, NULL, &bvp) == 0) {
+		    FOLLOW, NULL, &bvp) == 0) {
 			addmip = 1;
 		}
 
@@ -1359,8 +1359,8 @@
 	 * wlock above. This case is for a non-spliced, non-global filesystem.
 	 */
 	if (!addmip) {
-	    if ((uap->flags & MS_GLOBAL) == 0 &&
-		lookupname(uap->spec, fromspace, FOLLOW, NULL, &bvp) == 0) {
+		if ((uap->flags & MS_GLOBAL) == 0 &&
+		    lookupname(uap->spec, fromspace, FOLLOW, NULL, &bvp) == 0) {
 			addmip = 1;
 		}
 	}
@@ -1447,11 +1447,11 @@
 			/* put back pre-remount options */
 			vfs_swapopttbl(&mnt_mntopts, &vfsp->vfs_mntopts);
 			vfs_setmntpoint(vfsp, (stripzonepath(
-					refstr_value(oldmntpt))));
+			    refstr_value(oldmntpt))));
 			if (oldmntpt)
 				refstr_rele(oldmntpt);
 			vfs_setresource(vfsp, (stripzonepath(
-					refstr_value(oldresource))));
+			    refstr_value(oldresource))));
 			if (oldresource)
 				refstr_rele(oldresource);
 			vfsp->vfs_flag = ovflags;
@@ -1533,7 +1533,7 @@
 		if (uap->flags & MS_OPTIONSTR) {
 			vfs_list_read_lock();
 			copyout_error = vfs_buildoptionstr(
-				&vfsp->vfs_mntopts, inargs, optlen);
+			    &vfsp->vfs_mntopts, inargs, optlen);
 			vfs_list_unlock();
 			if (copyout_error == 0 &&
 			    (uap->flags & MS_SYSSPACE) == 0) {
@@ -2746,7 +2746,7 @@
 		 */
 		vfs_list_lock();
 		for (vfsp = rootvfs->vfs_prev;
-			vfsp != rootvfs; vfsp = vfsp->vfs_prev)
+		    vfsp != rootvfs; vfsp = vfsp->vfs_prev)
 			if (vfsp == prev_vfsp)
 				break;
 		if (vfsp == rootvfs && prev_vfsp != rootvfs)
@@ -2788,7 +2788,7 @@
 	mutex_enter(&vfs_miplist_mutex);
 	mipprev = NULL;
 	for (mipp = vfs_miplist;
-		mipp && mipp->mip_vfsp != vfsp; mipp = mipp->mip_next) {
+	    mipp && mipp->mip_vfsp != vfsp; mipp = mipp->mip_next) {
 		mipprev = mipp;
 	}
 	if (mipp == NULL)
@@ -4162,6 +4162,16 @@
 	    == DDI_SUCCESS) {
 		(void) strncpy(rootfs.bo_fstype, propstr, BO_MAXFSNAME);
 		ddi_prop_free(propstr);
+
+	/*
+	 * if the boot property 'fstype' is not set, but 'zfs-bootfs' is set,
+	 * assume the type of this root filesystem is 'zfs'.
+	 */
+	} else if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
+	    DDI_PROP_DONTPASS, "zfs-bootfs", &propstr)
+	    == DDI_SUCCESS) {
+		(void) strncpy(rootfs.bo_fstype, "zfs", BO_MAXFSNAME);
+		ddi_prop_free(propstr);
 	}
 
 	if (strncmp(rootfs.bo_fstype, "nfs", 3) != 0)
--- a/usr/src/uts/common/fs/zfs/dmu.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/dmu.c	Wed Mar 28 12:48:13 2007 -0700
@@ -78,6 +78,7 @@
 	{	zap_byteswap,		TRUE,	"persistent error log"	},
 	{	byteswap_uint8_array,	TRUE,	"SPA history"		},
 	{	byteswap_uint64_array,	TRUE,	"SPA history offsets"	},
+	{	zap_byteswap,	TRUE,	"Pool properties"	},
 };
 
 int
@@ -179,7 +180,7 @@
 	if (dn->dn_datablkshift) {
 		int blkshift = dn->dn_datablkshift;
 		nblks = (P2ROUNDUP(offset+length, 1ULL<<blkshift) -
-			P2ALIGN(offset, 1ULL<<blkshift)) >> blkshift;
+		    P2ALIGN(offset, 1ULL<<blkshift)) >> blkshift;
 	} else {
 		if (offset + length > dn->dn_datablksz) {
 			zfs_panic_recover("zfs: accessing past end of object "
@@ -329,7 +330,7 @@
 	if (dn->dn_datablkshift) {
 		int blkshift = dn->dn_datablkshift;
 		nblks = (P2ROUNDUP(offset+len, 1<<blkshift) -
-			P2ALIGN(offset, 1<<blkshift)) >> blkshift;
+		    P2ALIGN(offset, 1<<blkshift)) >> blkshift;
 	} else {
 		nblks = (offset < dn->dn_datablksz);
 	}
--- a/usr/src/uts/common/fs/zfs/dsl_dataset.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/dsl_dataset.c	Wed Mar 28 12:48:13 2007 -0700
@@ -1294,8 +1294,10 @@
 	if (ds_prev && ds->ds_prev != ds_prev)
 		dsl_dataset_close(ds_prev, DS_MODE_NONE, FTAG);
 
+	spa_clear_bootfs(dp->dp_spa, ds->ds_object, tx);
 	dsl_dataset_close(ds, DS_MODE_EXCLUSIVE, tag);
 	VERIFY(0 == dmu_object_free(mos, obj, tx));
+
 }
 
 /* ARGSUSED */
@@ -1855,3 +1857,33 @@
 	dsl_dataset_close(ds, DS_MODE_NONE, FTAG);
 	return (err);
 }
+
+/*
+ * Given a pool name and a dataset object number in that pool,
+ * return the name of that dataset.
+ */
+int
+dsl_dsobj_to_dsname(char *pname, uint64_t obj, char *buf)
+{
+	spa_t *spa;
+	dsl_pool_t *dp;
+	dsl_dataset_t *ds = NULL;
+	int error;
+
+	if ((error = spa_open(pname, &spa, FTAG)) != 0)
+		return (error);
+	dp = spa_get_dsl(spa);
+	rw_enter(&dp->dp_config_rwlock, RW_READER);
+	if ((error = dsl_dataset_open_obj(dp, obj,
+	    NULL, DS_MODE_NONE, FTAG, &ds)) != 0) {
+		rw_exit(&dp->dp_config_rwlock);
+		spa_close(spa, FTAG);
+		return (error);
+	}
+	dsl_dataset_name(ds, buf);
+	dsl_dataset_close(ds, DS_MODE_NONE, FTAG);
+	rw_exit(&dp->dp_config_rwlock);
+	spa_close(spa, FTAG);
+
+	return (0);
+}
--- a/usr/src/uts/common/fs/zfs/spa.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/spa.c	Wed Mar 28 12:48:13 2007 -0700
@@ -48,10 +48,13 @@
 #include <sys/txg.h>
 #include <sys/avl.h>
 #include <sys/dmu_traverse.h>
+#include <sys/dmu_objset.h>
 #include <sys/unique.h>
 #include <sys/dsl_pool.h>
+#include <sys/dsl_dataset.h>
 #include <sys/dsl_dir.h>
 #include <sys/dsl_prop.h>
+#include <sys/dsl_synctask.h>
 #include <sys/fs/zfs.h>
 #include <sys/callb.h>
 
@@ -134,6 +137,7 @@
 	mutex_init(&spa->spa_config_lock.scl_lock, NULL, MUTEX_DEFAULT, NULL);
 	mutex_init(&spa->spa_sync_bplist.bpl_lock, NULL, MUTEX_DEFAULT, NULL);
 	mutex_init(&spa->spa_history_lock, NULL, MUTEX_DEFAULT, NULL);
+	mutex_init(&spa->spa_props_lock, NULL, MUTEX_DEFAULT, NULL);
 
 	list_create(&spa->spa_dirty_list, sizeof (vdev_t),
 	    offsetof(vdev_t, vdev_dirty_node));
@@ -672,6 +676,23 @@
 		spa_config_exit(spa, FTAG);
 	}
 
+	error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
+	    DMU_POOL_PROPS, sizeof (uint64_t), 1, &spa->spa_pool_props_object);
+
+	if (error && error != ENOENT) {
+		vdev_set_state(rvd, B_TRUE, VDEV_STATE_CANT_OPEN,
+		    VDEV_AUX_CORRUPT_DATA);
+		error = EIO;
+		goto out;
+	}
+
+	if (error == 0) {
+		(void) zap_lookup(spa->spa_meta_objset,
+		    spa->spa_pool_props_object,
+		    zpool_prop_to_name(ZFS_PROP_BOOTFS),
+		    sizeof (uint64_t), 1, &spa->spa_bootfs);
+	}
+
 	/*
 	 * Load the vdev state for all toplevel vdevs.
 	 */
@@ -1176,6 +1197,7 @@
 
 	dmu_tx_commit(tx);
 
+	spa->spa_bootfs = zfs_prop_default_numeric(ZFS_PROP_BOOTFS);
 	spa->spa_sync_on = B_TRUE;
 	txg_sync_start(spa->spa_dsl_pool);
 
@@ -2815,6 +2837,43 @@
 	spa_sync_nvlist(spa, spa->spa_config_object, config, tx);
 }
 
+static void
+spa_sync_props(void *arg1, void *arg2, dmu_tx_t *tx)
+{
+	spa_t *spa = arg1;
+	nvlist_t *nvp = arg2;
+	nvpair_t *nvpair;
+	objset_t *mos = spa->spa_meta_objset;
+	uint64_t zapobj;
+
+	mutex_enter(&spa->spa_props_lock);
+	if (spa->spa_pool_props_object == 0) {
+		zapobj = zap_create(mos, DMU_OT_POOL_PROPS, DMU_OT_NONE, 0, tx);
+		VERIFY(zapobj > 0);
+
+		spa->spa_pool_props_object = zapobj;
+
+		VERIFY(zap_update(mos, DMU_POOL_DIRECTORY_OBJECT,
+		    DMU_POOL_PROPS, 8, 1,
+		    &spa->spa_pool_props_object, tx) == 0);
+	}
+	mutex_exit(&spa->spa_props_lock);
+
+	nvpair = NULL;
+	while ((nvpair = nvlist_next_nvpair(nvp, nvpair))) {
+		switch (zpool_name_to_prop(nvpair_name(nvpair))) {
+		case ZFS_PROP_BOOTFS:
+			VERIFY(nvlist_lookup_uint64(nvp,
+			    nvpair_name(nvpair), &spa->spa_bootfs) == 0);
+			VERIFY(zap_update(mos,
+			    spa->spa_pool_props_object,
+			    zpool_prop_to_name(ZFS_PROP_BOOTFS), 8, 1,
+			    &spa->spa_bootfs, tx) == 0);
+			break;
+		}
+	}
+}
+
 /*
  * Sync the specified transaction group.  New blocks may be dirtied as
  * part of the process, so we iterate until it converges.
@@ -3093,3 +3152,105 @@
 
 	return (B_FALSE);
 }
+
+int
+spa_set_props(spa_t *spa, nvlist_t *nvp)
+{
+	return (dsl_sync_task_do(spa_get_dsl(spa), NULL, spa_sync_props,
+	    spa, nvp, 3));
+}
+
+int
+spa_get_props(spa_t *spa, nvlist_t **nvp)
+{
+	zap_cursor_t zc;
+	zap_attribute_t za;
+	objset_t *mos = spa->spa_meta_objset;
+	zfs_source_t src;
+	zfs_prop_t prop;
+	nvlist_t *propval;
+	uint64_t value;
+	int err;
+
+	VERIFY(nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP) == 0);
+
+	mutex_enter(&spa->spa_props_lock);
+	/* If no props object, then just return empty nvlist */
+	if (spa->spa_pool_props_object == 0) {
+		mutex_exit(&spa->spa_props_lock);
+		return (0);
+	}
+
+	for (zap_cursor_init(&zc, mos, spa->spa_pool_props_object);
+	    (err = zap_cursor_retrieve(&zc, &za)) == 0;
+	    zap_cursor_advance(&zc)) {
+
+		if ((prop = zpool_name_to_prop(za.za_name)) == ZFS_PROP_INVAL)
+			continue;
+
+		VERIFY(nvlist_alloc(&propval, NV_UNIQUE_NAME, KM_SLEEP) == 0);
+		switch (za.za_integer_length) {
+		case 8:
+			if (zfs_prop_default_numeric(prop) ==
+			    za.za_first_integer)
+				src = ZFS_SRC_DEFAULT;
+			else
+				src = ZFS_SRC_LOCAL;
+			value = za.za_first_integer;
+
+			if (prop == ZFS_PROP_BOOTFS) {
+				dsl_pool_t *dp;
+				dsl_dataset_t *ds = NULL;
+				char strval[MAXPATHLEN];
+
+				dp = spa_get_dsl(spa);
+				rw_enter(&dp->dp_config_rwlock, RW_READER);
+				if ((err = dsl_dataset_open_obj(dp,
+				    za.za_first_integer, NULL, DS_MODE_NONE,
+				    FTAG, &ds)) != 0) {
+					rw_exit(&dp->dp_config_rwlock);
+					break;
+				}
+				dsl_dataset_name(ds, strval);
+				dsl_dataset_close(ds, DS_MODE_NONE, FTAG);
+				rw_exit(&dp->dp_config_rwlock);
+
+				VERIFY(nvlist_add_uint64(propval,
+				    ZFS_PROP_SOURCE, src) == 0);
+				VERIFY(nvlist_add_string(propval,
+				    ZFS_PROP_VALUE, strval) == 0);
+			} else {
+				VERIFY(nvlist_add_uint64(propval,
+				    ZFS_PROP_SOURCE, src) == 0);
+				VERIFY(nvlist_add_uint64(propval,
+				    ZFS_PROP_VALUE, value) == 0);
+			}
+			VERIFY(nvlist_add_nvlist(*nvp, za.za_name,
+			    propval) == 0);
+			break;
+		}
+		nvlist_free(propval);
+	}
+	zap_cursor_fini(&zc);
+	mutex_exit(&spa->spa_props_lock);
+	if (err && err != ENOENT) {
+		nvlist_free(*nvp);
+		return (err);
+	}
+
+	return (0);
+}
+
+/*
+ * If the bootfs property value is dsobj, clear it.
+ */
+void
+spa_clear_bootfs(spa_t *spa, uint64_t dsobj, dmu_tx_t *tx)
+{
+	if (spa->spa_bootfs == dsobj && spa->spa_pool_props_object != 0) {
+		VERIFY(zap_remove(spa->spa_meta_objset,
+		    spa->spa_pool_props_object,
+		    zpool_prop_to_name(ZFS_PROP_BOOTFS), tx) == 0);
+		spa->spa_bootfs = 0;
+	}
+}
--- a/usr/src/uts/common/fs/zfs/spa_config.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/spa_config.c	Wed Mar 28 12:48:13 2007 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -74,7 +74,7 @@
 	spa_t *spa;
 	char pathname[128];
 	struct _buf *file;
-	struct bootstat bst;
+	uint64_t fsize;
 
 	/*
 	 * Open the configuration file.
@@ -86,21 +86,21 @@
 	if (file == (struct _buf *)-1)
 		return;
 
-	if (kobj_fstat(file->_fd, &bst) != 0)
+	if (kobj_get_filesize(file, &fsize) != 0)
 		goto out;
 
-	buf = kmem_alloc(bst.st_size, KM_SLEEP);
+	buf = kmem_alloc(fsize, KM_SLEEP);
 
 	/*
 	 * Read the nvlist from the file.
 	 */
-	if (kobj_read_file(file, buf, bst.st_size, 0) < 0)
+	if (kobj_read_file(file, buf, fsize, 0) < 0)
 		goto out;
 
 	/*
 	 * Unpack the nvlist.
 	 */
-	if (nvlist_unpack(buf, bst.st_size, &nvlist, KM_SLEEP) != 0)
+	if (nvlist_unpack(buf, fsize, &nvlist, KM_SLEEP) != 0)
 		goto out;
 
 	/*
@@ -132,7 +132,7 @@
 
 out:
 	if (buf != NULL)
-		kmem_free(buf, bst.st_size);
+		kmem_free(buf, fsize);
 
 	kobj_close_file(file);
 }
--- a/usr/src/uts/common/fs/zfs/spa_misc.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/spa_misc.c	Wed Mar 28 12:48:13 2007 -0700
@@ -291,6 +291,7 @@
 	mutex_destroy(&spa->spa_config_cache_lock);
 	mutex_destroy(&spa->spa_async_lock);
 	mutex_destroy(&spa->spa_history_lock);
+	mutex_destroy(&spa->spa_props_lock);
 
 	kmem_free(spa, sizeof (spa_t));
 }
--- a/usr/src/uts/common/fs/zfs/sys/dmu.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/sys/dmu.h	Wed Mar 28 12:48:13 2007 -0700
@@ -107,6 +107,7 @@
 	DMU_OT_ERROR_LOG,		/* ZAP */
 	DMU_OT_SPA_HISTORY,		/* UINT8 */
 	DMU_OT_SPA_HISTORY_OFFSETS,	/* spa_his_phys_t */
+	DMU_OT_POOL_PROPS,		/* ZAP */
 
 	DMU_OT_NUMTYPES
 } dmu_object_type_t;
@@ -194,6 +195,7 @@
 #define	DMU_POOL_SPARES			"spares"
 #define	DMU_POOL_DEFLATE		"deflate"
 #define	DMU_POOL_HISTORY		"history"
+#define	DMU_POOL_PROPS			"pool_props"
 
 /*
  * Allocate an object from this objset.  The range of object numbers
--- a/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h	Wed Mar 28 12:48:13 2007 -0700
@@ -163,6 +163,8 @@
 void dsl_dataset_create_root(struct dsl_pool *dp, uint64_t *ddobjp,
     dmu_tx_t *tx);
 
+int dsl_dsobj_to_dsname(char *pname, uint64_t obj, char *buf);
+
 #ifdef ZFS_DEBUG
 #define	dprintf_ds(ds, fmt, ...) do { \
 	if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
--- a/usr/src/uts/common/fs/zfs/sys/spa.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/sys/spa.h	Wed Mar 28 12:48:13 2007 -0700
@@ -463,6 +463,12 @@
 extern void spa_init(int flags);
 extern void spa_fini(void);
 
+/* properties */
+extern int spa_set_props(spa_t *spa, nvlist_t *nvp);
+extern int spa_get_props(spa_t *spa, nvlist_t **nvp);
+extern void spa_clear_bootfs(spa_t *spa, uint64_t obj, dmu_tx_t *tx);
+extern boolean_t spa_has_bootfs(spa_t *spa);
+
 #ifdef ZFS_DEBUG
 #define	dprintf_bp(bp, fmt, ...) do {				\
 	if (zfs_flags & ZFS_DEBUG_DPRINTF) { 			\
--- a/usr/src/uts/common/fs/zfs/sys/spa_impl.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/sys/spa_impl.h	Wed Mar 28 12:48:13 2007 -0700
@@ -64,6 +64,11 @@
 	uint64_t sh_records_lost;	/* num of records overwritten */
 } spa_history_phys_t;
 
+typedef struct spa_props {
+	nvlist_t	*spa_props_nvp;
+	list_node_t	spa_list_node;
+} spa_props_t;
+
 struct spa {
 	/*
 	 * Fields protected by spa_namespace_lock.
@@ -141,6 +146,9 @@
 	vdev_t		*spa_pending_vdev;	/* pending vdev additions */
 	nvlist_t	**spa_pending_spares;	/* pending spare additions */
 	uint_t		spa_pending_nspares;	/* # pending spares */
+	kmutex_t	spa_props_lock;		/* property lock */
+	uint64_t	spa_pool_props_object;	/* object for properties */
+	uint64_t	spa_bootfs;		/* default boot filesystem */
 	/*
 	 * spa_refcnt must be the last element because it changes size based on
 	 * compilation options.  In order for the MDB module to function
--- a/usr/src/uts/common/fs/zfs/sys/zfs_znode.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/sys/zfs_znode.h	Wed Mar 28 12:48:13 2007 -0700
@@ -85,6 +85,16 @@
 #define	ZFS_MAXNAMELEN	(MAXNAMELEN - 1)
 
 /*
+ * The directory entry has the type (currently unused on Solaris) in the
+ * top 4 bits, and the object number in the low 48 bits.  The "middle"
+ * 12 bits are unused.
+ */
+#define	ZFS_DIRENT_TYPE(de) BF64_GET(de, 60, 4)
+#define	ZFS_DIRENT_OBJ(de) BF64_GET(de, 0, 48)
+#define	ZFS_DIRENT_MAKE(type, obj) (((uint64_t)type << 60) | obj)
+
+
+/*
  * This is the persistent portion of the znode.  It is stored
  * in the "bonus buffer" of the file.  Short symbolic links
  * are also stored in the bonus buffer.
--- a/usr/src/uts/common/fs/zfs/zfs_dir.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_dir.c	Wed Mar 28 12:48:13 2007 -0700
@@ -172,6 +172,7 @@
 		} else {
 			error = zap_lookup(zfsvfs->z_os, dzp->z_id, name,
 			    8, 1, &zoid);
+			zoid = ZFS_DIRENT_OBJ(zoid);
 			if (error == ENOENT)
 				dnlc_update(ZTOV(dzp), name, DNLC_NO_VNODE);
 		}
@@ -398,7 +399,8 @@
 	for (zap_cursor_init(&zc, zfsvfs->z_os, dzp->z_id);
 	    (error = zap_cursor_retrieve(&zc, &zap)) == 0;
 	    zap_cursor_advance(&zc)) {
-		error = zfs_zget(zfsvfs, zap.za_first_integer, &xzp);
+		error = zfs_zget(zfsvfs,
+		    ZFS_DIRENT_OBJ(zap.za_first_integer), &xzp);
 		ASSERT3U(error, ==, 0);
 
 		ASSERT((ZTOV(xzp)->v_type == VREG) ||
@@ -522,6 +524,7 @@
 {
 	znode_t *dzp = dl->dl_dzp;
 	vnode_t *vp = ZTOV(zp);
+	uint64_t value;
 	int zp_is_dir = (vp->v_type == VDIR);
 	int error;
 
@@ -549,8 +552,12 @@
 	zfs_time_stamper_locked(dzp, CONTENT_MODIFIED, tx);
 	mutex_exit(&dzp->z_lock);
 
+	/*
+	 * MacOS X will fill in the 4-bit object type here.
+	 */
+	value = ZFS_DIRENT_MAKE(0, zp->z_id);
 	error = zap_add(zp->z_zfsvfs->z_os, dzp->z_id, dl->dl_name,
-	    8, 1, &zp->z_id, tx);
+	    8, 1, &value, tx);
 	ASSERT(error == 0);
 
 	dnlc_update(ZTOV(dzp), dl->dl_name, vp);
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Wed Mar 28 12:48:13 2007 -0700
@@ -40,7 +40,9 @@
 #include <sys/zfs_ioctl.h>
 #include <sys/zap.h>
 #include <sys/spa.h>
+#include <sys/spa_impl.h>
 #include <sys/vdev.h>
+#include <sys/vdev_impl.h>
 #include <sys/dmu.h>
 #include <sys/dsl_dir.h>
 #include <sys/dsl_dataset.h>
@@ -547,25 +549,10 @@
 static int
 zfs_ioc_dsobj_to_dsname(zfs_cmd_t *zc)
 {
-	spa_t *spa;
-	dsl_pool_t *dp;
-	dsl_dataset_t *ds = NULL;
 	int error;
 
-	if ((error = spa_open(zc->zc_name, &spa, FTAG)) != 0)
+	if (error = dsl_dsobj_to_dsname(zc->zc_name, zc->zc_obj, zc->zc_value))
 		return (error);
-	dp = spa_get_dsl(spa);
-	rw_enter(&dp->dp_config_rwlock, RW_READER);
-	if ((error = dsl_dataset_open_obj(dp, zc->zc_obj,
-	    NULL, DS_MODE_NONE, FTAG, &ds)) != 0) {
-		rw_exit(&dp->dp_config_rwlock);
-		spa_close(spa, FTAG);
-		return (error);
-	}
-	dsl_dataset_name(ds, zc->zc_value);
-	dsl_dataset_close(ds, DS_MODE_NONE, FTAG);
-	rw_exit(&dp->dp_config_rwlock);
-	spa_close(spa, FTAG);
 
 	return (0);
 }
@@ -598,6 +585,15 @@
 	if (error != 0)
 		return (error);
 
+	/*
+	 * A root pool with concatenated devices is not supported.
+	 * Thus, can not add a device to a root pool with one device.
+	 */
+	if (spa->spa_root_vdev->vdev_children == 1 && spa->spa_bootfs != 0) {
+		spa_close(spa, FTAG);
+		return (EDOM);
+	}
+
 	if ((error = get_nvlist(zc, &config)) == 0) {
 		error = spa_vdev_add(spa, config);
 		nvlist_free(config);
@@ -1060,6 +1056,126 @@
 }
 
 static int
+zfs_ioc_pool_props_set(zfs_cmd_t *zc)
+{
+	nvlist_t *nvl;
+	int error, reset_bootfs = 0;
+	uint64_t objnum;
+	zpool_prop_t prop;
+	nvpair_t *elem;
+	char *propname, *strval;
+	spa_t *spa;
+	vdev_t *rvdev;
+	char *vdev_type;
+	objset_t *os;
+
+	if ((error = get_nvlist(zc, &nvl)) != 0)
+		return (error);
+
+	if ((error = spa_open(zc->zc_name, &spa, FTAG)) != 0) {
+		nvlist_free(nvl);
+		return (error);
+	}
+
+	if (spa_version(spa) < ZFS_VERSION_BOOTFS) {
+		nvlist_free(nvl);
+		spa_close(spa, FTAG);
+		return (ENOTSUP);
+	}
+
+	elem = NULL;
+	while ((elem = nvlist_next_nvpair(nvl, elem)) != NULL) {
+
+		propname = nvpair_name(elem);
+
+		if ((prop = zpool_name_to_prop(propname)) ==
+		    ZFS_PROP_INVAL) {
+			nvlist_free(nvl);
+			spa_close(spa, FTAG);
+			return (EINVAL);
+		}
+
+		switch (prop) {
+		case ZFS_PROP_BOOTFS:
+			/*
+			 * A bootable filesystem can not be on a RAIDZ pool
+			 * nor a striped pool with more than 1 device.
+			 */
+			rvdev = spa->spa_root_vdev;
+			vdev_type =
+			    rvdev->vdev_child[0]->vdev_ops->vdev_op_type;
+			if (strcmp(vdev_type, VDEV_TYPE_RAIDZ) == 0 ||
+			    (strcmp(vdev_type, VDEV_TYPE_MIRROR) != 0 &&
+			    rvdev->vdev_children > 1)) {
+				error = ENOTSUP;
+				break;
+			}
+
+			reset_bootfs = 1;
+
+			VERIFY(nvpair_value_string(elem, &strval) == 0);
+			if (strval == NULL || strval[0] == '\0') {
+				objnum =
+				    zfs_prop_default_numeric(ZFS_PROP_BOOTFS);
+				break;
+			}
+
+			if (error = dmu_objset_open(strval, DMU_OST_ZFS,
+			    DS_MODE_STANDARD | DS_MODE_READONLY, &os))
+				break;
+			objnum = dmu_objset_id(os);
+			dmu_objset_close(os);
+			break;
+
+		default:
+			error = EINVAL;
+		}
+
+		if (error)
+			break;
+	}
+	if (error == 0) {
+		if (reset_bootfs) {
+			VERIFY(nvlist_remove(nvl,
+			    zpool_prop_to_name(ZFS_PROP_BOOTFS),
+			    DATA_TYPE_STRING) == 0);
+			VERIFY(nvlist_add_uint64(nvl,
+			    zpool_prop_to_name(ZFS_PROP_BOOTFS), objnum) == 0);
+		}
+		error = spa_set_props(spa, nvl);
+	}
+
+	nvlist_free(nvl);
+	spa_close(spa, FTAG);
+
+	return (error);
+}
+
+static int
+zfs_ioc_pool_props_get(zfs_cmd_t *zc)
+{
+	spa_t *spa;
+	int error;
+	nvlist_t *nvp = NULL;
+
+	if ((error = spa_open(zc->zc_name, &spa, FTAG)) != 0)
+		return (error);
+
+	error = spa_get_props(spa, &nvp);
+
+	if (error == 0 && zc->zc_nvlist_dst != NULL)
+		error = put_nvlist(zc, nvp);
+	else
+		error = EFAULT;
+
+	spa_close(spa, FTAG);
+
+	if (nvp)
+		nvlist_free(nvp);
+	return (error);
+}
+
+static int
 zfs_ioc_create_minor(zfs_cmd_t *zc)
 {
 	return (zvol_create_minor(zc->zc_name, zc->zc_dev));
@@ -1523,7 +1639,9 @@
 	{ zfs_ioc_destroy_snaps,	zfs_secpolicy_write,	dataset_name },
 	{ zfs_ioc_snapshot,		zfs_secpolicy_write,	dataset_name },
 	{ zfs_ioc_dsobj_to_dsname,	zfs_secpolicy_config,	pool_name },
-	{ zfs_ioc_obj_to_path,		zfs_secpolicy_config,	no_name }
+	{ zfs_ioc_obj_to_path,		zfs_secpolicy_config,	no_name },
+	{ zfs_ioc_pool_props_set,	zfs_secpolicy_config,	pool_name },
+	{ zfs_ioc_pool_props_get,	zfs_secpolicy_read,	pool_name },
 };
 
 static int
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c	Wed Mar 28 12:48:13 2007 -0700
@@ -45,6 +45,7 @@
 #include <sys/fs/zfs.h>
 #include <sys/dmu.h>
 #include <sys/dsl_prop.h>
+#include <sys/dsl_dataset.h>
 #include <sys/spa.h>
 #include <sys/zap.h>
 #include <sys/varargs.h>
@@ -64,8 +65,6 @@
 static minor_t zfs_minor;
 static kmutex_t	zfs_dev_mtx;
 
-extern char zfs_bootpath[BO_MAXOBJNAME];
-
 static int zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr);
 static int zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr);
 static int zfs_mountroot(vfs_t *vfsp, enum whymountroot);
@@ -368,7 +367,7 @@
 		if (!dmu_objset_is_snapshot(zfsvfs->z_os))
 			readonly_changed_cb(zfsvfs, B_FALSE);
 		else if (vfs_optionisset(vfsp, MNTOPT_RW, NULL))
-			    return (EROFS);
+			return (EROFS);
 	}
 
 	if (vfs_optionisset(vfsp, MNTOPT_NOSUID, NULL)) {
@@ -444,8 +443,7 @@
 		if (vfs_optionisset(vfsp, MNTOPT_NODEVICES, NULL)) {
 			devices = B_FALSE;
 			do_devices = B_TRUE;
-		} else if (vfs_optionisset(vfsp,
-			    MNTOPT_DEVICES, NULL)) {
+		} else if (vfs_optionisset(vfsp, MNTOPT_DEVICES, NULL)) {
 			devices = B_TRUE;
 			do_devices = B_TRUE;
 		}
@@ -699,6 +697,59 @@
 	}
 }
 
+/*
+ * Convert a decimal digit string to a uint64_t integer.
+ */
+static int
+str_to_uint64(char *str, uint64_t *objnum)
+{
+	uint64_t num = 0;
+
+	while (*str) {
+		if (*str < '0' || *str > '9')
+			return (EINVAL);
+
+		num = num*10 + *str++ - '0';
+	}
+
+	*objnum = num;
+	return (0);
+}
+
+
+/*
+ * The boot path passed from the boot loader is in the form of
+ * "rootpool-name/root-filesystem-object-number'. Convert this
+ * string to a dataset name: "rootpool-name/root-filesystem-name".
+ */
+static int
+parse_bootpath(char *bpath, char *outpath)
+{
+	char *slashp;
+	uint64_t objnum;
+	int error;
+
+	if (*bpath == 0 || *bpath == '/')
+		return (EINVAL);
+
+	slashp = strchr(bpath, '/');
+
+	/* if no '/', just return the pool name */
+	if (slashp == NULL) {
+		(void) strcpy(outpath, bpath);
+		return (0);
+	}
+
+	if (error = str_to_uint64(slashp+1, &objnum))
+		return (error);
+
+	*slashp = '\0';
+	error = dsl_dsobj_to_dsname(bpath, objnum, outpath);
+	*slashp = '/';
+
+	return (error);
+}
+
 static int
 zfs_mountroot(vfs_t *vfsp, enum whymountroot why)
 {
@@ -708,31 +759,33 @@
 	zfsvfs_t *zfsvfs = NULL;
 	znode_t *zp = NULL;
 	vnode_t *vp = NULL;
+	char *zfs_bootpath;
 
 	ASSERT(vfsp);
 
 	/*
-	 * The filesystem that we mount as root is defined in
-	 * /etc/system using the zfsroot variable.  The value defined
-	 * there is copied early in startup code to zfs_bootpath
-	 * (defined in modsysfile.c).
+	 * The filesystem that we mount as root is defined in the
+	 * "zfs-bootfs" property.
 	 */
 	if (why == ROOT_INIT) {
 		if (zfsrootdone++)
 			return (EBUSY);
 
-		/*
-		 * This needs to be done here, so that when we return from
-		 * mountroot, the vfs resource name will be set correctly.
-		 */
-		if (snprintf(rootfs.bo_name, BO_MAXOBJNAME, "%s", zfs_bootpath)
-		    >= BO_MAXOBJNAME)
-			return (ENAMETOOLONG);
+		if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
+		    DDI_PROP_DONTPASS, "zfs-bootfs", &zfs_bootpath) !=
+		    DDI_SUCCESS)
+			return (EIO);
+
+		error = parse_bootpath(zfs_bootpath, rootfs.bo_name);
+		ddi_prop_free(zfs_bootpath);
+
+		if (error)
+			return (error);
 
 		if (error = vfs_lock(vfsp))
 			return (error);
 
-		if (error = zfs_domount(vfsp, zfs_bootpath, CRED()))
+		if (error = zfs_domount(vfsp, rootfs.bo_name, CRED()))
 			goto out;
 
 		zfsvfs = (zfsvfs_t *)vfsp->vfs_data;
@@ -791,7 +844,7 @@
 	pathname_t	spn;
 	int		error = 0;
 	uio_seg_t	fromspace = (uap->flags & MS_SYSSPACE) ?
-				UIO_SYSSPACE : UIO_USERSPACE;
+	    UIO_SYSSPACE : UIO_USERSPACE;
 	int		canwrite;
 
 	if (mvp->v_type != VDIR)
--- a/usr/src/uts/common/fs/zfs/zfs_vnops.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c	Wed Mar 28 12:48:13 2007 -0700
@@ -1601,9 +1601,7 @@
 	zap_cursor_t	zc;
 	zap_attribute_t	zap;
 	uint_t		bytes_wanted;
-	ushort_t	this_reclen;
 	uint64_t	offset; /* must be unsigned; checks for < 1 */
-	off64_t		*next;
 	int		local_eof;
 	int		outcount;
 	int		error;
@@ -1673,22 +1671,22 @@
 	 */
 	outcount = 0;
 	while (outcount < bytes_wanted) {
+		ino64_t objnum;
+		ushort_t reclen;
+		off64_t *next;
+
 		/*
 		 * Special case `.', `..', and `.zfs'.
 		 */
 		if (offset == 0) {
 			(void) strcpy(zap.za_name, ".");
-			zap.za_first_integer = zp->z_id;
-			this_reclen = DIRENT64_RECLEN(1);
+			objnum = zp->z_id;
 		} else if (offset == 1) {
 			(void) strcpy(zap.za_name, "..");
-			zap.za_first_integer = zp->z_phys->zp_parent;
-			this_reclen = DIRENT64_RECLEN(2);
+			objnum = zp->z_phys->zp_parent;
 		} else if (offset == 2 && zfs_show_ctldir(zp)) {
 			(void) strcpy(zap.za_name, ZFS_CTLDIR_NAME);
-			zap.za_first_integer = ZFSCTL_INO_ROOT;
-			this_reclen =
-			    DIRENT64_RECLEN(sizeof (ZFS_CTLDIR_NAME) - 1);
+			objnum = ZFSCTL_INO_ROOT;
 		} else {
 			/*
 			 * Grab next entry.
@@ -1709,13 +1707,19 @@
 				error = ENXIO;
 				goto update;
 			}
-			this_reclen = DIRENT64_RECLEN(strlen(zap.za_name));
+
+			objnum = ZFS_DIRENT_OBJ(zap.za_first_integer);
+			/*
+			 * MacOS X can extract the object type here such as:
+			 * uint8_t type = ZFS_DIRENT_TYPE(zap.za_first_integer);
+			 */
 		}
+		reclen = DIRENT64_RECLEN(strlen(zap.za_name));
 
 		/*
 		 * Will this entry fit in the buffer?
 		 */
-		if (outcount + this_reclen > bufsize) {
+		if (outcount + reclen > bufsize) {
 			/*
 			 * Did we manage to fit anything in the buffer?
 			 */
@@ -1728,20 +1732,20 @@
 		/*
 		 * Add this entry:
 		 */
-		odp->d_ino = (ino64_t)zap.za_first_integer;
-		odp->d_reclen = (ushort_t)this_reclen;
+		odp->d_ino = objnum;
+		odp->d_reclen = reclen;
 		/* NOTE: d_off is the offset for the *next* entry */
 		next = &(odp->d_off);
 		(void) strncpy(odp->d_name, zap.za_name,
-		    DIRENT64_NAMELEN(this_reclen));
-		outcount += this_reclen;
-		odp = (dirent64_t *)((intptr_t)odp + this_reclen);
+		    DIRENT64_NAMELEN(reclen));
+		outcount += reclen;
+		odp = (dirent64_t *)((intptr_t)odp + reclen);
 
 		ASSERT(outcount <= bufsize);
 
 		/* Prefetch znode */
 		if (prefetch)
-			dmu_prefetch(os, zap.za_first_integer, 0, 0);
+			dmu_prefetch(os, objnum, 0, 0);
 
 		/*
 		 * Move to the next entry, fill in the previous offset.
--- a/usr/src/uts/common/krtld/kobj.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/krtld/kobj.c	Wed Mar 28 12:48:13 2007 -0700
@@ -668,7 +668,7 @@
 			    strlen(bootaux[libmacros[i].lmi_ba_index].ba_ptr) +
 			    1, KM_WAIT);
 			(void) strcpy(libmacros[i].lmi_list,
-				bootaux[libmacros[i].lmi_ba_index].ba_ptr);
+			    bootaux[libmacros[i].lmi_ba_index].ba_ptr);
 		}
 		libmacros[i].lmi_macrolen = strlen(libmacros[i].lmi_macroname);
 	}
@@ -916,12 +916,12 @@
 	mp->nsyms = mp->symhdr->sh_size / mp->symhdr->sh_entsize;
 	mp->flags = KOBJ_INTERP|KOBJ_PRIM;
 	mp->strhdr = (Shdr *)
-		(mp->shdrs + mp->symhdr->sh_link * mp->hdr.e_shentsize);
+	    (mp->shdrs + mp->symhdr->sh_link * mp->hdr.e_shentsize);
 	mp->strings = (char *)mp->strhdr->sh_addr;
 	mp->hashsize = kobj_gethashsize(mp->nsyms);
 
 	mp->symsize = mp->symhdr->sh_size + mp->strhdr->sh_size + sizeof (int) +
-		(mp->hashsize + mp->nsyms) * sizeof (symid_t);
+	    (mp->hashsize + mp->nsyms) * sizeof (symid_t);
 
 	mp->chains = kobj_zalloc(mp->nsyms * sizeof (symid_t), KM_WAIT);
 	mp->buckets = kobj_zalloc(mp->hashsize * sizeof (symid_t), KM_WAIT);
@@ -1218,12 +1218,12 @@
 				case DT_RELA:
 					shtype = SHT_RELA;
 					rela = (char *)(dyn->d_un.d_ptr +
-						dynseg);
+					    dynseg);
 					break;
 				case DT_REL:
 					shtype = SHT_REL;
 					rela = (char *)(dyn->d_un.d_ptr +
-						dynseg);
+					    dynseg);
 					break;
 				}
 			}
@@ -1828,7 +1828,7 @@
 	if (!standalone) {
 		if (mp->ctfdata != NULL) {
 			if (vmem_contains(ctf_arena, mp->ctfdata,
-				mp->ctfsize)) {
+			    mp->ctfsize)) {
 				vmem_free(ctf_arena, mp->ctfdata, mp->ctfsize);
 			} else {
 				kobj_free(mp->ctfdata, mp->ctfsize);
@@ -2303,14 +2303,14 @@
 			limit = _text + lg_pagesize;
 
 		mp->text = kobj_segbrk(&_etext, mp->text_size,
-			tp->align, limit);
+		    tp->align, limit);
 		/*
 		 * If we can't grow the text segment, try the
 		 * data segment before failing.
 		 */
 		if (mp->text == NULL) {
 			mp->text = kobj_segbrk(&_edata, mp->text_size,
-					tp->align, 0);
+			    tp->align, 0);
 		}
 
 		mp->data = kobj_segbrk(&_edata, mp->data_size, dp->align, 0);
@@ -2530,7 +2530,7 @@
 		if (mp->flags & KOBJ_EXEC)
 			return (0);
 		_kobj_printf(ops, "krtld: get_syms: %s ",
-			mp->filename);
+		    mp->filename);
 		_kobj_printf(ops, "no SHT_SYMTAB symbol table found\n");
 		return (-1);
 	}
@@ -2541,7 +2541,7 @@
 	if ((mp->symhdr == 0) || (mp->symhdr->sh_link >= mp->hdr.e_shnum))
 		return (-1);
 	mp->strhdr = (Shdr *)
-		(mp->shdrs + mp->symhdr->sh_link * mp->hdr.e_shentsize);
+	    (mp->shdrs + mp->symhdr->sh_link * mp->hdr.e_shentsize);
 
 	mp->nsyms = mp->symhdr->sh_size / mp->symhdr->sh_entsize;
 	mp->hashsize = kobj_gethashsize(mp->nsyms);
@@ -2719,7 +2719,7 @@
 			_kobj_printf(ops,
 			    "krtld: crypto_es_hash: updating hash with"
 			    " %s data size=%d\n", shstrtab + shp->sh_name,
-				shp->sh_size);
+			    shp->sh_size);
 #endif
 		ASSERT(shp->sh_addr != NULL);
 		SHA1Update(&ctx, (const uint8_t *)shp->sh_addr, shp->sh_size);
@@ -3006,9 +3006,9 @@
 		if (ELF_ST_TYPE(sp->st_info) == STT_SPARC_REGISTER) {
 			if (*name != '\0') {
 				_kobj_printf(ops, "%s: named REGISTER symbol ",
-						mp->filename);
+				    mp->filename);
 				_kobj_printf(ops, "not supported '%s'\n",
-						name);
+				    name);
 				err = DOSYM_UNDEF;
 			}
 			continue;
@@ -3019,9 +3019,9 @@
 		 */
 		if (ELF_ST_TYPE(sp->st_info) == STT_TLS) {
 			_kobj_printf(ops, "%s: TLS symbol ",
-					mp->filename);
+			    mp->filename);
 			_kobj_printf(ops, "not supported '%s'\n",
-					name);
+			    name);
 			err = DOSYM_UNDEF;
 			continue;
 		}
@@ -3389,7 +3389,7 @@
 				lastmp = mp;
 			}
 			sp = (Sym *)(mp->symtbl +
-				index * mp->symhdr->sh_entsize);
+			    index * mp->symhdr->sh_entsize);
 			_kobj_printf(ops, "krtld:\t[%3d]", index);
 			_kobj_printf(ops, "\t0x%lx", sp->st_value);
 			_kobj_printf(ops, "\t%s\n", name);
@@ -3596,7 +3596,7 @@
 	mutex_init(&cpr_lk, NULL, MUTEX_DEFAULT, NULL);
 	CALLB_CPR_INIT(&cpr_i, &cpr_lk, callb_generic_cpr, "kobjopen");
 	ltp->Errno = vn_open(ltp->name, UIO_SYSSPACE, FREAD, 0, &(ltp->vp),
-									0, 0);
+	    0, 0);
 	sema_v(&ltp->sema);
 	mutex_enter(&cpr_lk);
 	CALLB_CPR_EXIT(&cpr_i);
@@ -3808,7 +3808,7 @@
 			if (page_addr == off &&
 			    (c_size = F_PAGE(size)) && buf) {
 				c_size = kobj_read(file->_fd, buf, c_size,
-					page_addr);
+				    page_addr);
 				if (c_size < 0) {
 					count = -1;
 					break;
@@ -3826,7 +3826,7 @@
 			} else {
 				file->_off = page_addr;
 				c_size = kobj_read(file->_fd, file->_base,
-						MAXBSIZE, page_addr);
+				    MAXBSIZE, page_addr);
 				file->_ptr = file->_base;
 				file->_cnt = c_size;
 				file->_size = c_size;
@@ -3987,7 +3987,7 @@
 		}
 
 		npva = (uintptr_t)BOP_ALLOC(ops, (caddr_t)pva,
-					alloc_size, alloc_align);
+		    alloc_size, alloc_align);
 
 		if (npva == NULL) {
 			_kobj_printf(ops, "BOP_ALLOC failed, 0x%lx bytes",
@@ -4021,6 +4021,45 @@
 	return (hsize);
 }
 
+/*
+ * Get the file size.
+ *
+ * Before root is mounted, files are compressed in the boot_archive ramdisk
+ * (in the memory). kobj_fstat would return the compressed file size.
+ * In order to get the uncompressed file size, read the file to the end and
+ * count its size.
+ */
+int
+kobj_get_filesize(struct _buf *file, uint64_t *size)
+{
+	if (_modrootloaded) {
+		struct bootstat bst;
+
+		if (kobj_fstat(file->_fd, &bst) != 0)
+			return (EIO);
+		*size = bst.st_size;
+	} else {
+		char *buf;
+		int count;
+		uint64_t offset = 0;
+
+		buf = kmem_alloc(MAXBSIZE, KM_SLEEP);
+		do {
+			count = kobj_read_file(file, buf, MAXBSIZE, offset);
+			if (count < 0) {
+				kmem_free(buf, MAXBSIZE);
+				return (EIO);
+			}
+			offset += count;
+		} while (count == MAXBSIZE);
+		kmem_free(buf, MAXBSIZE);
+
+		*size = offset;
+	}
+
+	return (0);
+}
+
 static char *
 basename(char *s)
 {
--- a/usr/src/uts/common/krtld/kobj_stubs.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/krtld/kobj_stubs.c	Wed Mar 28 12:48:13 2007 -0700
@@ -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.
  */
 
@@ -114,6 +114,13 @@
 
 /*ARGSUSED*/
 int
+kobj_get_filesize(struct _buf *file, uint64_t *size)
+{
+	return (-1);
+}
+
+/*ARGSUSED*/
+int
 kobj_filbuf(struct _buf *f)
 {
 	return (-1);
--- a/usr/src/uts/common/krtld/mapfile	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/krtld/mapfile	Wed Mar 28 12:48:13 2007 -0700
@@ -18,7 +18,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.
 #
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -36,6 +36,7 @@
 		kobj_filbuf;
 		kobj_free;
 		kobj_fstat;
+		kobj_get_filesize;
 		kobj_getelfsym;
 		kobj_getmodinfo;
 		kobj_getpagesize;
--- a/usr/src/uts/common/os/modsysfile.c	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/os/modsysfile.c	Wed Mar 28 12:48:13 2007 -0700
@@ -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.
  */
 
@@ -72,7 +72,6 @@
 
 char obp_bootpath[BO_MAXOBJNAME];	/* bootpath from obp */
 char svm_bootpath[BO_MAXOBJNAME];	/* bootpath redirected via rootdev */
-char zfs_bootpath[BO_MAXOBJNAME];	/* zfs bootpath, set via zfsroot */
 
 #if defined(_PSM_MODULES)
 
@@ -135,7 +134,7 @@
 		vprintf(fmt, adx);
 		if (file)
 			printf(" on line %d of %s\n", kobj_linenum(file),
-				kobj_filename(file));
+			    kobj_filename(file));
 		va_end(adx);
 	}
 }
@@ -489,8 +488,6 @@
 	{ "set32",	MOD_SET32	},
 	{ "SET64",	MOD_SET64	},
 	{ "set64",	MOD_SET64	},
-	{ "ZFSROOT", 	MOD_ZFSROOT	},
-	{ "zfsroot", 	MOD_ZFSROOT	},
 	{ NULL,		MOD_UNKNOWN	}
 };
 
@@ -530,7 +527,6 @@
 		 */
 	case MOD_ROOTFS:
 	case MOD_SWAPFS:
-	case MOD_ZFSROOT:
 		if ((token = kobj_lex(file, tok1, sizeof (tok1))) == COLON) {
 			token = kobj_lex(file, tok1, sizeof (tok1));
 		} else {
@@ -1182,9 +1178,9 @@
 		symaddr = kobj_getelfsym(sysp->sys_ptr, NULL, &size);
 	} else if (fcn == SYS_SET_MVAR) {
 		if (sysp->sys_modnam == (char *)NULL ||
-			strcmp(((struct modctl *)p)->mod_modname,
-			    sysp->sys_modnam) != 0)
-				return;
+		    strcmp(((struct modctl *)p)->mod_modname,
+		    sysp->sys_modnam) != 0)
+			return;
 		symaddr = kobj_getelfsym(sysp->sys_ptr,
 		    ((struct modctl *)p)->mod_mp, &size);
 	} else
@@ -1523,10 +1519,6 @@
 			(void) copystr(sysp->sys_ptr, bootobjp->bo_fstype,
 			    BO_MAXOBJNAME, NULL);
 			break;
-		case MOD_ZFSROOT:
-			(void) copystr(sysp->sys_ptr, zfs_bootpath,
-			    BO_MAXOBJNAME, NULL);
-			break;
 		default:
 			break;
 		}
@@ -1636,13 +1628,13 @@
 
 	for (i = 0; i < len; i++) {
 		if (name[i] < 0x21 ||
-			name[i] == '/' ||
-			name[i] == '\\' ||
-			name[i] == ':' ||
-			name[i] == '[' ||
-			name[i] == ']' ||
-			name[i] == '@')
-				return (0);
+		    name[i] == '/' ||
+		    name[i] == '\\' ||
+		    name[i] == ':' ||
+		    name[i] == '[' ||
+		    name[i] == ']' ||
+		    name[i] == '@')
+			return (0);
 	}
 	return (1);
 }
@@ -1817,12 +1809,12 @@
 				    strcmp(tokbuf, "class") == 0) {
 					state = drvclass;
 					prop_name = kmem_alloc(strlen(tokbuf) +
-						1, KM_SLEEP);
+					    1, KM_SLEEP);
 					(void) strcpy(prop_name, tokbuf);
 				} else {
 					state = prop;
 					prop_name = kmem_alloc(strlen(tokbuf) +
-						1, KM_SLEEP);
+					    1, KM_SLEEP);
 					(void) strcpy(prop_name, tokbuf);
 				}
 				break;
@@ -1853,7 +1845,7 @@
 			case name_equals:
 				if (ddi_get_name((dev_info_t *)devi)) {
 					kobj_file_err(CE_WARN, file, "%s %s",
-						nm_err, omit_err);
+					    nm_err, omit_err);
 					goto bad;
 				}
 				devi->devi_name = kmem_alloc(strlen(tokbuf) + 1,
@@ -1864,7 +1856,7 @@
 			case parent_equals:
 				if (hwcp->hwc_parent_name) {
 					kobj_file_err(CE_WARN, file, "%s %s",
-						prnt_err, omit_err);
+					    prnt_err, omit_err);
 					goto bad;
 				}
 				hwcp->hwc_parent_name = kmem_alloc(strlen
@@ -1940,7 +1932,7 @@
 	case prop_equals_string:
 	case prop_equals_integer:
 		make_prop(file, (dev_info_t *)devi,
-			prop_name, val_list);
+		    prop_name, val_list);
 		break;
 
 	case hwc_begin:
@@ -2769,7 +2761,7 @@
 	 */
 	if (ddi_name_to_major(exporter) >= devcnt) {
 		cmn_err(CE_WARN, "No major number for driver %s"
-				" in class %s", exporter, class);
+		    " in class %s", exporter, class);
 		return;
 	}
 	hcl = kmem_zalloc(sizeof (struct hwc_class), KM_SLEEP);
@@ -3022,7 +3014,7 @@
 		machp = pmach_head;
 		pmach_head = machp->m_next;
 		kmem_free(machp, sizeof (struct psm_mach) +
-			strlen(machp->m_machname) + 1);
+		    strlen(machp->m_machname) + 1);
 	}
 }
 #endif	/* _PSM_MODULES */
--- a/usr/src/uts/common/sys/fs/zfs.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/sys/fs/zfs.h	Wed Mar 28 12:48:13 2007 -0700
@@ -45,7 +45,8 @@
 typedef enum {
 	ZFS_TYPE_FILESYSTEM	= 0x1,
 	ZFS_TYPE_SNAPSHOT	= 0x2,
-	ZFS_TYPE_VOLUME		= 0x4
+	ZFS_TYPE_VOLUME		= 0x4,
+	ZFS_TYPE_POOL		= 0x8
 } zfs_type_t;
 
 #define	ZFS_TYPE_ANY	\
@@ -94,20 +95,35 @@
 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
 	ZFS_PROP_XATTR,
 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
-	ZFS_PROP_COPIES
+	ZFS_PROP_COPIES,
+	ZFS_PROP_BOOTFS
 } zfs_prop_t;
 
+typedef zfs_prop_t zpool_prop_t;
+
 #define	ZFS_PROP_VALUE		"value"
 #define	ZFS_PROP_SOURCE		"source"
 
+typedef enum {
+	ZFS_SRC_NONE = 0x1,
+	ZFS_SRC_DEFAULT = 0x2,
+	ZFS_SRC_TEMPORARY = 0x4,
+	ZFS_SRC_LOCAL = 0x8,
+	ZFS_SRC_INHERITED = 0x10
+} zfs_source_t;
+
+#define	ZFS_SRC_ALL	0x1f
+
 /*
  * The following functions are shared between libzfs and the kernel.
  */
 zfs_prop_t zfs_name_to_prop(const char *);
+zpool_prop_t zpool_name_to_prop(const char *);
 boolean_t zfs_prop_user(const char *);
 int zfs_prop_readonly(zfs_prop_t);
 const char *zfs_prop_default_string(zfs_prop_t);
 const char *zfs_prop_to_name(zfs_prop_t);
+const char *zpool_prop_to_name(zfs_prop_t);
 uint64_t zfs_prop_default_numeric(zfs_prop_t);
 int zfs_prop_inheritable(zfs_prop_t);
 int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
@@ -117,7 +133,9 @@
  * Property Iterator
  */
 typedef zfs_prop_t (*zfs_prop_f)(zfs_prop_t, void *);
+typedef zfs_prop_f zpool_prop_f;
 extern zfs_prop_t zfs_prop_iter(zfs_prop_f, void *, boolean_t);
+extern zpool_prop_t zpool_prop_iter(zpool_prop_f, void *, boolean_t);
 
 /*
  * On-disk version number.
@@ -127,8 +145,14 @@
 #define	ZFS_VERSION_3			3ULL
 #define	ZFS_VERSION_4			4ULL
 #define	ZFS_VERSION_5			5ULL
-#define	ZFS_VERSION			ZFS_VERSION_5
-#define	ZFS_VERSION_STRING		"5"
+#define	ZFS_VERSION_6			6ULL
+/*
+ * When bumping up ZFS_VERSION, make sure GRUB ZFS understand the on-disk
+ * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*},
+ * and do the appropriate changes.
+ */
+#define	ZFS_VERSION			ZFS_VERSION_6
+#define	ZFS_VERSION_STRING		"6"
 
 /*
  * Symbolic names for the changes that caused a ZFS_VERSION switch.
@@ -150,6 +174,7 @@
 #define	ZFS_VERSION_DNODE_BYTES		ZFS_VERSION_3
 #define	ZFS_VERSION_ZPOOL_HISTORY	ZFS_VERSION_4
 #define	ZFS_VERSION_GZIP_COMPRESSION	ZFS_VERSION_5
+#define	ZFS_VERSION_BOOTFS		ZFS_VERSION_6
 
 /*
  * The following are configuration names used in the nvlist describing a pool's
@@ -367,7 +392,9 @@
 	ZFS_IOC_DESTROY_SNAPS,
 	ZFS_IOC_SNAPSHOT,
 	ZFS_IOC_DSOBJ_TO_DSNAME,
-	ZFS_IOC_OBJ_TO_PATH
+	ZFS_IOC_OBJ_TO_PATH,
+	ZFS_IOC_POOL_SET_PROPS,
+	ZFS_IOC_POOL_GET_PROPS
 } zfs_ioc_t;
 
 /*
--- a/usr/src/uts/common/sys/kobj.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/sys/kobj.h	Wed Mar 28 12:48:13 2007 -0700
@@ -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.
  */
 
@@ -174,6 +174,7 @@
 extern struct _buf *kobj_open_file(char *);
 extern void kobj_close_file(struct _buf *);
 extern int kobj_read_file(struct _buf *, char *, unsigned, unsigned);
+extern int kobj_get_filesize(struct _buf *, uint64_t *size);
 extern uintptr_t kobj_getelfsym(char *, void *, int *);
 extern void kobj_set_ctf(struct module *, caddr_t data, size_t size);
 
--- a/usr/src/uts/common/sys/sysconf.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/common/sys/sysconf.h	Wed Mar 28 12:48:13 2007 -0700
@@ -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.
  */
 
@@ -71,7 +71,6 @@
 #define	MOD_UNKNOWN	9	/* unknown command */
 #define	MOD_SET32	10	/* like MOD_SET but -only- on 32-bit kernel */
 #define	MOD_SET64	11	/* like MOD_SET but -only- on 64-bit kernel */
-#define	MOD_ZFSROOT	12	/* use zfs as the root filesystem */
 
 /*
  * Commands for mod_sysctl()
--- a/usr/src/uts/intel/sys/bootconf.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/intel/sys/bootconf.h	Wed Mar 28 12:48:13 2007 -0700
@@ -184,7 +184,6 @@
 
 extern char obp_bootpath[BO_MAXOBJNAME];
 extern char svm_bootpath[BO_MAXOBJNAME];
-extern char zfs_bootpath[BO_MAXOBJNAME];
 
 extern dev_t getrootdev(void);
 extern void getfsname(char *, char *, size_t);
--- a/usr/src/uts/sparc/krtld/mapfile	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/sparc/krtld/mapfile	Wed Mar 28 12:48:13 2007 -0700
@@ -35,6 +35,7 @@
 		kobj_filbuf;
 		kobj_free;
 		kobj_fstat;
+		kobj_get_filesize;
 		kobj_getelfsym;
 		kobj_getmodinfo;
 		kobj_getpagesize;
--- a/usr/src/uts/sun/sys/bootconf.h	Wed Mar 28 12:00:22 2007 -0700
+++ b/usr/src/uts/sun/sys/bootconf.h	Wed Mar 28 12:48:13 2007 -0700
@@ -218,7 +218,6 @@
 
 extern char obp_bootpath[BO_MAXOBJNAME];
 extern char svm_bootpath[BO_MAXOBJNAME];
-extern char zfs_bootpath[BO_MAXOBJNAME];
 
 extern dev_t getrootdev(void);
 extern void getfsname(char *, char *, size_t);