stand/kboot: Simplify
There's plenty of stack in kboot, so use it here rather than the malloc/free dance. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D39416
This commit is contained in:
parent
d5babd0d23
commit
5328f9034f
@ -574,7 +574,6 @@ probe_zfs_currdev(uint64_t pool_guid, uint64_t root_guid, bool setcurrdev)
|
|||||||
{
|
{
|
||||||
char *devname;
|
char *devname;
|
||||||
struct zfs_devdesc currdev;
|
struct zfs_devdesc currdev;
|
||||||
char *buf = NULL;
|
|
||||||
bool bootable;
|
bool bootable;
|
||||||
|
|
||||||
currdev.dd.d_dev = &zfs_dev;
|
currdev.dd.d_dev = &zfs_dev;
|
||||||
@ -587,18 +586,15 @@ probe_zfs_currdev(uint64_t pool_guid, uint64_t root_guid, bool setcurrdev)
|
|||||||
|
|
||||||
bootable = sanity_check_currdev();
|
bootable = sanity_check_currdev();
|
||||||
if (bootable) {
|
if (bootable) {
|
||||||
buf = malloc(VDEV_PAD_SIZE);
|
char buf[VDEV_PAD_SIZE];
|
||||||
if (buf != NULL) {
|
|
||||||
if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf,
|
if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) {
|
||||||
VDEV_PAD_SIZE) == 0) {
|
|
||||||
printf("zfs bootonce: %s\n", buf);
|
printf("zfs bootonce: %s\n", buf);
|
||||||
if (setcurrdev)
|
if (setcurrdev)
|
||||||
set_currdev(buf);
|
set_currdev(buf);
|
||||||
setenv("zfs-bootonce", buf, 1);
|
setenv("zfs-bootonce", buf, 1);
|
||||||
}
|
}
|
||||||
free(buf);
|
|
||||||
(void)zfs_attach_nvstore(&currdev);
|
(void)zfs_attach_nvstore(&currdev);
|
||||||
}
|
|
||||||
init_zfs_boot_options(devname);
|
init_zfs_boot_options(devname);
|
||||||
}
|
}
|
||||||
return (bootable);
|
return (bootable);
|
||||||
|
Loading…
Reference in New Issue
Block a user