Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/zfsboot/zfsboot.c
Show First 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | bootdev = MAKEBOOTDEV(dev_maj[DEVT_DISK], devdesc.d_slice + 1, | ||||
devdesc.d_partition >= 0 ? devdesc.d_partition : 0xff); | devdesc.d_partition >= 0 ? devdesc.d_partition : 0xff); | ||||
/* | /* | ||||
* zfs_fmtdev() can be called only after dv_init | * zfs_fmtdev() can be called only after dv_init | ||||
*/ | */ | ||||
if (bdev != NULL && bdev->dd.d_dev->dv_type == DEVT_ZFS) { | if (bdev != NULL && bdev->dd.d_dev->dv_type == DEVT_ZFS) { | ||||
/* set up proper device name string for ZFS */ | /* set up proper device name string for ZFS */ | ||||
strncpy(boot_devname, zfs_fmtdev(bdev), sizeof (boot_devname)); | strncpy(boot_devname, zfs_fmtdev(bdev), sizeof (boot_devname)); | ||||
if (zfs_nextboot(bdev, cmd, sizeof(cmd)) == 0) { | if (zfs_get_bootonce(bdev, "command", cmd, sizeof(cmd)) == 0) { | ||||
nvlist_t *benv; | |||||
nextboot = 1; | nextboot = 1; | ||||
memcpy(cmddup, cmd, sizeof(cmd)); | memcpy(cmddup, cmd, sizeof(cmd)); | ||||
if (parse_cmd()) { | if (parse_cmd()) { | ||||
if (!OPT_CHECK(RBX_QUIET)) | if (!OPT_CHECK(RBX_QUIET)) | ||||
printf("failed to parse pad2 area\n"); | printf("failed to parse pad2 area\n"); | ||||
exit(0); | exit(0); | ||||
} | } | ||||
if (!OPT_CHECK(RBX_QUIET)) | if (!OPT_CHECK(RBX_QUIET)) | ||||
printf("zfs nextboot: %s\n", cmddup); | printf("zfs nextboot: %s\n", cmddup); | ||||
if (zfs_get_bootenv(bdev, &benv) == 0) { | |||||
nvlist_add_string(benv, "bootonce-used", | |||||
cmddup); | |||||
zfs_set_bootenv(bdev, benv); | |||||
} | |||||
/* Do not process this command twice */ | /* Do not process this command twice */ | ||||
*cmd = 0; | *cmd = 0; | ||||
} | } | ||||
} | } | ||||
/* now make sure we have bdev on all cases */ | /* now make sure we have bdev on all cases */ | ||||
free(bdev); | free(bdev); | ||||
i386_getdev((void **)&bdev, boot_devname, NULL); | i386_getdev((void **)&bdev, boot_devname, NULL); | ||||
▲ Show 20 Lines • Show All 459 Lines • Show Last 20 Lines |