Changeset View
Changeset View
Standalone View
Standalone View
stand/userboot/userboot/main.c
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | |||||
#if defined(USERBOOT_ZFS_SUPPORT) | #if defined(USERBOOT_ZFS_SUPPORT) | ||||
if (userboot_zfs_found) { | if (userboot_zfs_found) { | ||||
struct zfs_devdesc zdev; | struct zfs_devdesc zdev; | ||||
/* Leave the pool/root guid's unassigned */ | /* Leave the pool/root guid's unassigned */ | ||||
bzero(&zdev, sizeof(zdev)); | bzero(&zdev, sizeof(zdev)); | ||||
zdev.d_dev = &zfs_dev; | zdev.d_dev = &zfs_dev; | ||||
zdev.d_type = zdev.d_dev->dv_type; | |||||
dev = *(struct disk_devdesc *)&zdev; | dev = *(struct disk_devdesc *)&zdev; | ||||
init_zfs_bootenv(zfs_fmtdev(&dev)); | init_zfs_bootenv(zfs_fmtdev(&dev)); | ||||
} else | } else | ||||
#endif | #endif | ||||
if (userboot_disk_maxunit > 0) { | if (userboot_disk_maxunit > 0) { | ||||
dev.d_dev = &userboot_disk; | dev.d_dev = &userboot_disk; | ||||
dev.d_type = dev.d_dev->dv_type; | |||||
dev.d_unit = 0; | dev.d_unit = 0; | ||||
dev.d_slice = 0; | dev.d_slice = 0; | ||||
dev.d_partition = 0; | dev.d_partition = 0; | ||||
/* | /* | ||||
* If we cannot auto-detect the partition type then | * If we cannot auto-detect the partition type then | ||||
* access the disk as a raw device. | * access the disk as a raw device. | ||||
*/ | */ | ||||
if (dev.d_dev->dv_open(NULL, &dev)) { | if (dev.d_dev->dv_open(NULL, &dev)) { | ||||
dev.d_slice = -1; | dev.d_slice = -1; | ||||
dev.d_partition = -1; | dev.d_partition = -1; | ||||
} | } | ||||
} else { | } else { | ||||
dev.d_dev = &host_dev; | dev.d_dev = &host_dev; | ||||
dev.d_type = dev.d_dev->dv_type; | |||||
dev.d_unit = 0; | dev.d_unit = 0; | ||||
} | } | ||||
env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev), | env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev), | ||||
userboot_setcurrdev, env_nounset); | userboot_setcurrdev, env_nounset); | ||||
env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev), | env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev), | ||||
env_noset, env_nounset); | env_noset, env_nounset); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |