stand/ofw: Access the parsing routine more directly
We don't need to check if something is a ZFS device. Instead, if the found device has a parse routine, call it. Otherwise, just copy the path. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37343
This commit is contained in:
parent
910de60a7e
commit
d16083815c
@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include "bootstrap.h"
|
#include "bootstrap.h"
|
||||||
#include "libofw.h"
|
#include "libofw.h"
|
||||||
#include "libzfs.h"
|
|
||||||
|
|
||||||
static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **);
|
static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **);
|
||||||
|
|
||||||
@ -109,15 +108,16 @@ ofw_parsedev(struct ofw_devdesc **dev, const char *devspec, const char **path)
|
|||||||
printf("ofw_parsedev: malloc failed\n");
|
printf("ofw_parsedev: malloc failed\n");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
strcpy(idev->d_path, name);
|
|
||||||
idev->dd.d_dev = dv;
|
idev->dd.d_dev = dv;
|
||||||
if (dv->dv_type == DEVT_ZFS) {
|
if (dv->dv_parsedev != NULL) {
|
||||||
p = devspec + strlen(dv->dv_name);
|
p = devspec + strlen(dv->dv_name);
|
||||||
free(idev);
|
free(idev);
|
||||||
err = zfs_parsedev((struct devdesc **)&idev, p, path);
|
err = dv->dv_parsedev((struct devdesc **)&idev, p, path);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
strcpy(idev->d_path, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user