diff options
Diffstat (limited to 'stand/common/misc.c')
-rw-r--r-- | stand/common/misc.c | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/stand/common/misc.c b/stand/common/misc.c index 9cb5550344ca..a7c46ad2e74c 100644 --- a/stand/common/misc.c +++ b/stand/common/misc.c @@ -24,9 +24,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <string.h> #include <stand.h> #include <bootstrap.h> @@ -169,17 +166,6 @@ alloc_pread(readin_handle_t fd, off_t off, size_t len) return (buf); } -void -dev_cleanup(void) -{ - int i; - - /* Call cleanup routines */ - for (i = 0; devsw[i] != NULL; ++i) - if (devsw[i]->dv_cleanup != NULL) - (devsw[i]->dv_cleanup)(); -} - /* * mount new rootfs and unmount old, set "currdev" environment variable. */ @@ -201,3 +187,49 @@ int mount_currdev(struct env_var *ev, int flags, const void *value) } return (rv); } + +/* + * Set currdev to suit the value being supplied in (value) + */ +int +gen_setcurrdev(struct env_var *ev, int flags, const void *value) +{ + struct devdesc *ncurr; + int rv; + + if ((rv = devparse(&ncurr, value, NULL)) != 0) + return (rv); + free(ncurr); + + return (mount_currdev(ev, flags, value)); +} + +/* + * Wrapper to set currdev and loaddev at the same time. + */ +void +set_currdev(const char *devname) +{ + + env_setenv("currdev", EV_VOLATILE, devname, gen_setcurrdev, + env_nounset); + /* + * Don't execute hook here; the loaddev hook makes it immutable + * once we've determined what the proper currdev is. + */ + env_setenv("loaddev", EV_VOLATILE | EV_NOHOOK, devname, env_noset, + env_nounset); +} + +#ifndef LOADER_NET_SUPPORT +/* + * This api is normally provided by dev_net.c + * This stub keeps libsa happy when LOADER_NET_SUPPORT + * is not enabled. + */ +bool +is_tftp(void) +{ + return false; +} +#endif |