From f200cc255f8e90b1905d94d0506a22f5dcd467c0 Mon Sep 17 00:00:00 2001 From: Robert Wing Date: Sat, 12 Dec 2020 07:22:38 +0000 Subject: [PATCH] geom(8): list geoms with /dev/ prefix Allow geom(8) to list geoms with the '/dev/' prefix. `geom part show` accepts the '/dev/' prefix but `geom part list` does not. Modify find_geom() in sbin/geom/core/geom.c to be consistent with the behavior of find_geom() in lib/geom/part/geom_part.c. PR: 188213 Reported by: Ronald F. Guilmette Reviewed by: imp, kevans Approved by: kevans (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27556 --- sbin/geom/core/geom.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index e6d6d789908f..58b33a067700 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -862,6 +863,9 @@ find_geom(struct gclass *classp, const char *name) { struct ggeom *gp; + if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + name += sizeof(_PATH_DEV) - 1; + LIST_FOREACH(gp, &classp->lg_geom, lg_geom) { if (strcmp(gp->lg_name, name) == 0) return (gp);