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
This commit is contained in:
Warner Losh 2022-07-15 07:32:16 -06:00
parent edc23ddf9c
commit bf35f00522

View File

@ -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;