Skip to content

Commit

Permalink
9955 loader: export boot pool and vdev GUID
Browse files Browse the repository at this point in the history
Reviewed by: Adam Števko <adam.stevko@gmail.com>
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
  • Loading branch information
tsoome authored and Dan McDonald committed Nov 9, 2018
1 parent 5b8f338 commit f6dea60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
7 changes: 0 additions & 7 deletions usr/src/boot/sys/boot/i386/loader/main.c
Expand Up @@ -216,7 +216,6 @@ extract_currdev(void)
{
struct i386_devdesc new_currdev;
#ifdef LOADER_ZFS_SUPPORT
char buf[20];
struct zfs_boot_args *zargs;
#endif
int biosdev = -1;
Expand Down Expand Up @@ -252,12 +251,6 @@ extract_currdev(void)
/* 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;
Expand Down
12 changes: 8 additions & 4 deletions usr/src/boot/sys/boot/zfs/zfs.c
Expand Up @@ -40,6 +40,7 @@
#include <string.h>
#include <stand.h>
#include <bootstrap.h>
#include <inttypes.h>

#include "libzfs.h"

Expand Down Expand Up @@ -724,8 +725,11 @@ zfs_bootfs(void *zdev)
}

/* Set the environment. */
snprintf(buf, sizeof (buf), "%s/%llu", spa->spa_name,
(unsigned long long)objnum);
snprintf(buf, sizeof (buf), "%" PRIu64, dev->pool_guid);
setenv("zfs-bootpool", buf, 1);
snprintf(buf, sizeof (buf), "%" PRIu64, spa->spa_boot_vdev->v_guid);
setenv("zfs-bootvdev", buf, 1);
snprintf(buf, sizeof (buf), "%s/%" PRIu64, spa->spa_name, objnum);
setenv("zfs-bootfs", buf, 1);
if (spa->spa_boot_vdev->v_phys_path != NULL)
setenv("bootpath", spa->spa_boot_vdev->v_phys_path, 1);
Expand All @@ -737,8 +741,8 @@ zfs_bootfs(void *zdev)
* the environment and we can stop caring about old kernels,
* we can remove this part.
*/
snprintf(buf, sizeof(buf), "zfs-bootfs=%s/%llu", spa->spa_name,
(unsigned long long)objnum);
snprintf(buf, sizeof(buf), "zfs-bootfs=%s/%" PRIu64, spa->spa_name,
objnum);
n = strlen(buf);
if (spa->spa_boot_vdev->v_phys_path != NULL) {
snprintf(buf+n, sizeof (buf) - n, ",bootpath=\"%s\"",
Expand Down

0 comments on commit f6dea60

Please sign in to comment.