aboutsummaryrefslogtreecommitdiff
path: root/stand/kboot
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2022-07-15 13:32:16 +0000
committerWarner Losh <imp@FreeBSD.org>2022-07-15 18:00:50 +0000
commitbf35f00522676d6e456b19168908cfa890ae0782 (patch)
treeb9115f5060ca855f3ed4d703bb80904ccb342f21 /stand/kboot
parentedc23ddf9cf35d7ea9baf72d14449e04508d2314 (diff)
downloadsrc-bf35f00522676d6e456b19168908cfa890ae0782.tar.gz
src-bf35f00522676d6e456b19168908cfa890ae0782.zip
kboot: Enhance kboot_getdev to cope with NULLs
Fallback to currdev when NULL is passed in when 'rootdev' is NULL. Other getdevs do this. Additional features are needed here still, though. Sponsored by: Netflix
Diffstat (limited to 'stand/kboot')
-rw-r--r--stand/kboot/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/stand/kboot/main.c b/stand/kboot/main.c
index 90b31a611476..3fab25132f15 100644
--- a/stand/kboot/main.c
+++ b/stand/kboot/main.c
@@ -212,11 +212,17 @@ kboot_get_kernel_machine_bits(void)
int
kboot_getdev(void **vdev, const char *devspec, const char **path)
{
- int i;
+ int i, rv;
const char *devpath, *filepath;
struct devsw *dv;
struct devdesc *desc;
+ if (devspec == NULL) {
+ rv = kboot_getdev(vdev, getenv("currdev"), NULL);
+ if (rv == 0 && path != NULL)
+ *path = devspec;
+ return (rv);
+ }
if (strchr(devspec, ':') != NULL) {
devpath = devspec;
filepath = strchr(devspec, ':') + 1;