Changeset View
Changeset View
Standalone View
Standalone View
stand/common/misc.c
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
int i; | int i; | ||||
/* Call cleanup routines */ | /* Call cleanup routines */ | ||||
for (i = 0; devsw[i] != NULL; ++i) | for (i = 0; devsw[i] != NULL; ++i) | ||||
if (devsw[i]->dv_cleanup != NULL) | if (devsw[i]->dv_cleanup != NULL) | ||||
(devsw[i]->dv_cleanup)(); | (devsw[i]->dv_cleanup)(); | ||||
} | } | ||||
/* | |||||
* mount new rootfs and unmount old, set "currdev" environment variable. | |||||
*/ | |||||
int mount_currdev(struct env_var *ev, int flags, const void *value) | |||||
{ | |||||
int rv; | |||||
/* mount new rootfs */ | |||||
rv = mount(value, "/", 0, NULL); | |||||
if (rv == 0) { | |||||
/* | |||||
* Note we unmount any previously mounted fs only after | |||||
* successfully mounting the new because we do not want to | |||||
* end up with unmounted rootfs. | |||||
*/ | |||||
if (ev->ev_value != NULL) | |||||
unmount(ev->ev_value, 0); | |||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); | |||||
} | |||||
return (rv); | |||||
} |