diff options
| author | Allan Jude <allanjude@FreeBSD.org> | 2016-01-09 00:54:08 +0000 |
|---|---|---|
| committer | Allan Jude <allanjude@FreeBSD.org> | 2016-01-09 00:54:08 +0000 |
| commit | fce8d0e350a77330a34844fee43103cf163377bb (patch) | |
| tree | d4dc8d29ad4044c903dc83eaa477e6b3b5ec28ad /sys/boot/userboot | |
| parent | 1500eb213dd54c505d9860a3cd907049701c7854 (diff) | |
Notes
Diffstat (limited to 'sys/boot/userboot')
| -rw-r--r-- | sys/boot/userboot/userboot/main.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/boot/userboot/userboot/main.c b/sys/boot/userboot/userboot/main.c index 335c8fd05c15e..a52550cbaea88 100644 --- a/sys/boot/userboot/userboot/main.c +++ b/sys/boot/userboot/userboot/main.c @@ -168,6 +168,7 @@ extract_currdev(void) zdev.d_type = zdev.d_dev->dv_type; dev = *(struct disk_devdesc *)&zdev; + init_zfs_bootenv(zfs_fmtdev(&dev)); } else #endif @@ -191,10 +192,6 @@ extract_currdev(void) dev.d_unit = 0; } -#if defined(USERBOOT_ZFS_SUPPORT) - init_zfs_bootenv(zfs_fmtdev(&dev)); -#endif - env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev), userboot_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev), @@ -207,9 +204,14 @@ init_zfs_bootenv(char *currdev) { char *beroot; + if (strlen(currdev) == 0) + return; + if(strncmp(currdev, "zfs:", 4) != 0) + return; /* Remove the trailing : */ currdev[strlen(currdev) - 1] = '\0'; setenv("zfs_be_active", currdev, 1); + setenv("zfs_be_currpage", "1", 1); /* Do not overwrite if already set */ setenv("vfs.root.mountfrom", currdev, 0); /* Forward past zfs: */ @@ -219,9 +221,7 @@ init_zfs_bootenv(char *currdev) beroot = strrchr(currdev, '/'); if (beroot != NULL) beroot[0] = '\0'; - beroot = currdev; - setenv("zfs_be_root", beroot, 1); } @@ -273,6 +273,7 @@ static int command_reloadbe(int argc, char *argv[]) { int err; + char *root; if (argc > 2) { command_errmsg = "wrong number of arguments"; @@ -282,7 +283,11 @@ command_reloadbe(int argc, char *argv[]) if (argc == 2) { err = zfs_bootenv(argv[1]); } else { - err = zfs_bootenv(getenv("zfs_be_root")); + root = getenv("zfs_be_root"); + if (root == NULL) { + return (CMD_OK); + } + err = zfs_bootenv(root); } if (err != 0) { |
