Index: stand/i386/libi386/libi386.h =================================================================== --- stand/i386/libi386/libi386.h +++ stand/i386/libi386/libi386.h @@ -27,25 +27,23 @@ */ +#include "disk.h" +#ifdef LOADER_ZFS_SUPPORT +#include "libzfs.h" +#endif /* * i386 fully-qualified device descriptor. */ -struct i386_devdesc { - struct devdesc dd; /* Must be first. */ - union - { - struct +struct i386_devdesc +{ + union { - int slice; - int partition; - off_t offset; - } biosdisk; - struct - { - uint64_t pool_guid; - uint64_t root_guid; - } zfs; - } d_kind; + struct devdesc dd; + struct disk_devdesc ddd; +#ifdef LOADER_ZFS_SUPPORT + struct zfs_devdesc zdd; +#endif + }; }; /* Index: stand/i386/loader/main.c =================================================================== --- stand/i386/loader/main.c +++ stand/i386/loader/main.c @@ -308,8 +308,8 @@ new_currdev.dd.d_unit = 0; } else { /* we don't know what our boot device is */ - new_currdev.d_kind.biosdisk.slice = -1; - new_currdev.d_kind.biosdisk.partition = 0; + new_currdev.ddd.d_slice = -1; + new_currdev.ddd.d_partition = 0; biosdev = -1; } #ifdef LOADER_ZFS_SUPPORT @@ -322,8 +322,8 @@ 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; + new_currdev.zdd.pool_guid = zargs->pool; + new_currdev.zdd.root_guid = zargs->root; if (zargs->size >= sizeof(*zargs) && zargs->primary_vdev != 0) { sprintf(buf, "%llu", zargs->primary_pool); @@ -333,8 +333,8 @@ } } else { /* old style zfsboot block */ - new_currdev.d_kind.zfs.pool_guid = kargs->zfspool; - new_currdev.d_kind.zfs.root_guid = 0; + new_currdev.zdd.pool_guid = kargs->zfspool; + new_currdev.zdd.root_guid = 0; } new_currdev.dd.d_dev = &zfs_dev; @@ -350,14 +350,12 @@ #endif } else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) { /* The passed-in boot device is bad */ - new_currdev.d_kind.biosdisk.slice = -1; - new_currdev.d_kind.biosdisk.partition = 0; + new_currdev.ddd.d_slice = -1; + new_currdev.ddd.d_partition = 0; biosdev = -1; } else { - new_currdev.d_kind.biosdisk.slice = - B_SLICE(initial_bootdev) - 1; - new_currdev.d_kind.biosdisk.partition = - B_PARTITION(initial_bootdev); + new_currdev.ddd.d_slice = B_SLICE(initial_bootdev) - 1; + new_currdev.ddd.d_partition = B_PARTITION(initial_bootdev); biosdev = initial_bootinfo->bi_bios_dev; /* Index: stand/i386/zfsboot/zfsboot.c =================================================================== --- stand/i386/zfsboot/zfsboot.c +++ stand/i386/zfsboot/zfsboot.c @@ -467,8 +467,8 @@ if (bdev->dd.d_dev->dv_type == DEVT_ZFS) { zfsargs.size = sizeof(zfsargs); - zfsargs.pool = bdev->d_kind.zfs.pool_guid; - zfsargs.root = bdev->d_kind.zfs.root_guid; + zfsargs.pool = bdev->zdd.pool_guid; + zfsargs.root = bdev->zdd.root_guid; #ifdef LOADER_GELI_SUPPORT export_geli_boot_data(&zfsargs.gelidata); #endif @@ -481,8 +481,8 @@ __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), bootdev, KARGS_FLAGS_ZFS | KARGS_FLAGS_EXTARG, - (uint32_t)bdev->d_kind.zfs.pool_guid, - (uint32_t)(bdev->d_kind.zfs.pool_guid >> 32), + (uint32_t)bdev->zdd.pool_guid, + (uint32_t)(bdev->zdd.pool_guid >> 32), VTOP(&bootinfo), zfsargs); } else { @@ -528,13 +528,12 @@ free(bdev); bdev = ddesc; if (bdev->dd.d_dev->dv_type == DEVT_DISK) { - if (bdev->d_kind.biosdisk.partition == -1) + if (bdev->ddd.d_partition == -1) part = 0xff; else - part = bdev->d_kind.biosdisk.partition; + part = bdev->ddd.d_partition; bootdev = MAKEBOOTDEV(dev_maj[bdev->dd.d_dev->dv_type], - bdev->d_kind.biosdisk.slice + 1, - bdev->dd.d_unit, part); + bdev->ddd.d_slice + 1, bdev->dd.d_unit, part); bootinfo.bi_bios_dev = bd_unit2bios(bdev); } strncpy(boot_devname, root, sizeof (boot_devname)); @@ -714,8 +713,8 @@ if (pool_guid != 0 && bdev == NULL) { bdev = malloc(sizeof (struct i386_devdesc)); bzero(bdev, sizeof (struct i386_devdesc)); - bdev->dd.d_dev = &zfs_dev; - bdev->d_kind.zfs.pool_guid = pool_guid; + bdev->zdd.dd.d_dev = &zfs_dev; + bdev->zdd.pool_guid = pool_guid; } } }