Changeset View
Changeset View
Standalone View
Standalone View
stand/userboot/userboot/main.c
| Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| static void | static void | ||||
| extract_currdev(void) | extract_currdev(void) | ||||
| { | { | ||||
| struct disk_devdesc dev; | struct disk_devdesc dev; | ||||
| struct devdesc *dd; | struct devdesc *dd; | ||||
| #if defined(USERBOOT_ZFS_SUPPORT) | #if defined(USERBOOT_ZFS_SUPPORT) | ||||
| struct zfs_devdesc zdev; | struct zfs_devdesc zdev; | ||||
| char *buf = NULL; | |||||
| if (userboot_zfs_found) { | if (userboot_zfs_found) { | ||||
| /* Leave the pool/root guid's unassigned */ | /* Leave the pool/root guid's unassigned */ | ||||
| bzero(&zdev, sizeof(zdev)); | bzero(&zdev, sizeof(zdev)); | ||||
| zdev.dd.d_dev = &zfs_dev; | zdev.dd.d_dev = &zfs_dev; | ||||
| init_zfs_boot_options(devformat(&zdev.dd)); | init_zfs_boot_options(devformat(&zdev.dd)); | ||||
| Show All 20 Lines | if (userboot_disk_maxunit > 0) { | ||||
| dev.dd.d_unit = 0; | dev.dd.d_unit = 0; | ||||
| dd = &dev.dd; | dd = &dev.dd; | ||||
| } | } | ||||
| set_currdev(devformat(dd)); | set_currdev(devformat(dd)); | ||||
| #if defined(USERBOOT_ZFS_SUPPORT) | #if defined(USERBOOT_ZFS_SUPPORT) | ||||
| if (userboot_zfs_found) { | if (userboot_zfs_found) { | ||||
| buf = malloc(VDEV_PAD_SIZE); | char buf[VDEV_PAD_SIZE]; | ||||
| if (buf != NULL) { | |||||
| if (zfs_get_bootonce(&zdev, OS_BOOTONCE, buf, | if (zfs_get_bootonce(&zdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) { | ||||
| VDEV_PAD_SIZE) == 0) { | |||||
| printf("zfs bootonce: %s\n", buf); | printf("zfs bootonce: %s\n", buf); | ||||
| set_currdev(buf); | set_currdev(buf); | ||||
| setenv("zfs-bootonce", buf, 1); | setenv("zfs-bootonce", buf, 1); | ||||
| } | } | ||||
| free(buf); | |||||
| (void) zfs_attach_nvstore(&zdev); | (void)zfs_attach_nvstore(&zdev); | ||||
| } | |||||
| } | } | ||||
| #endif | #endif | ||||
| } | } | ||||
| #if defined(USERBOOT_ZFS_SUPPORT) | #if defined(USERBOOT_ZFS_SUPPORT) | ||||
| static void | static void | ||||
| userboot_zfs_probe(void) | userboot_zfs_probe(void) | ||||
| { | { | ||||
| Show All 37 Lines | |||||