git: 2ec7d6fd4217 - stable/13 - kboot: Enhance kboot_getdev to cope with NULLs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Jan 2023 22:10:53 UTC
The branch stable/13 has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2ec7d6fd42170fca215dbe291830606648f00ae5
commit 2ec7d6fd42170fca215dbe291830606648f00ae5
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-07-15 13:32:16 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:23 +0000
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
(cherry picked from commit bf35f00522676d6e456b19168908cfa890ae0782)
---
stand/kboot/main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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;