summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386/loader
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2012-10-06 19:47:24 +0000
committeravg <avg@FreeBSD.org>2012-10-06 19:47:24 +0000
commitba598b122e294d2b8d300a73ad3f8e40ee6fe0c8 (patch)
treeaf95066f7b29983c0067cab81cdde661838fa951 /sys/boot/i386/loader
parent9e17baa574362b48400e993efd857fa97880b96a (diff)
downloadFreeBSD-src-ba598b122e294d2b8d300a73ad3f8e40ee6fe0c8.zip
FreeBSD-src-ba598b122e294d2b8d300a73ad3f8e40ee6fe0c8.tar.gz
zfs boot: export boot/primary pool and vdev guid all the way to kenv
This is work in progress to for znextboot and it also provides some convenient infrastructure. MFC after: 20 days
Diffstat (limited to 'sys/boot/i386/loader')
-rw-r--r--sys/boot/i386/loader/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c
index 73474cf..84ae713 100644
--- a/sys/boot/i386/loader/main.c
+++ b/sys/boot/i386/loader/main.c
@@ -209,6 +209,7 @@ extract_currdev(void)
{
struct i386_devdesc new_currdev;
#ifdef LOADER_ZFS_SUPPORT
+ char buf[20];
struct zfs_boot_args *zargs;
#endif
int biosdev = -1;
@@ -239,10 +240,17 @@ extract_currdev(void)
if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0)
zargs = (struct zfs_boot_args *)(kargs + 1);
- if (zargs != NULL && zargs->size >= sizeof(*zargs)) {
+ if (zargs != NULL &&
+ zargs->size >= offsetof(struct zfs_boot_args, primary_pool)) {
/* sufficient data is provided */
new_currdev.d_kind.zfs.pool_guid = zargs->pool;
new_currdev.d_kind.zfs.root_guid = zargs->root;
+ if (zargs->size >= sizeof(*zargs) && zargs->primary_vdev != 0) {
+ sprintf(buf, "%llu", zargs->primary_pool);
+ setenv("vfs.zfs.boot.primary_pool", buf, 1);
+ sprintf(buf, "%llu", zargs->primary_vdev);
+ setenv("vfs.zfs.boot.primary_vdev", buf, 1);
+ }
} else {
/* old style zfsboot block */
new_currdev.d_kind.zfs.pool_guid = kargs->zfspool;
OpenPOWER on IntegriCloud