mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 04:43:53 +00:00
stand/userboot: Simplify code
We have way more than 8k of stack for the current value of the zfs bootonce attribute. Allocate buf on the stack rather than the complicated malloc / free dance. Sponsored by: Netflix Reviewed by: tsoome, kevans, jhb Differential Revision: https://reviews.freebsd.org/D39414
This commit is contained in:
parent
0c4183f02e
commit
5ce98ee5f4
|
@ -235,7 +235,6 @@ extract_currdev(void)
|
|||
struct devdesc *dd;
|
||||
#if defined(USERBOOT_ZFS_SUPPORT)
|
||||
struct zfs_devdesc zdev;
|
||||
char *buf = NULL;
|
||||
|
||||
if (userboot_zfs_found) {
|
||||
|
||||
|
@ -272,17 +271,14 @@ extract_currdev(void)
|
|||
|
||||
#if defined(USERBOOT_ZFS_SUPPORT)
|
||||
if (userboot_zfs_found) {
|
||||
buf = malloc(VDEV_PAD_SIZE);
|
||||
if (buf != NULL) {
|
||||
if (zfs_get_bootonce(&zdev, OS_BOOTONCE, buf,
|
||||
VDEV_PAD_SIZE) == 0) {
|
||||
printf("zfs bootonce: %s\n", buf);
|
||||
set_currdev(buf);
|
||||
setenv("zfs-bootonce", buf, 1);
|
||||
}
|
||||
free(buf);
|
||||
(void) zfs_attach_nvstore(&zdev);
|
||||
char buf[VDEV_PAD_SIZE];
|
||||
|
||||
if (zfs_get_bootonce(&zdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) {
|
||||
printf("zfs bootonce: %s\n", buf);
|
||||
set_currdev(buf);
|
||||
setenv("zfs-bootonce", buf, 1);
|
||||
}
|
||||
(void)zfs_attach_nvstore(&zdev);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue