Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 2021 21:14:44 GMT
From:      Robert Wing <rew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0a09fd56501c - stable/12 - geom(8): list geoms with /dev/ prefix
Message-ID:  <202101112114.10BLEitJ067124@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by rew:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a09fd56501c2508c9d2797302544d55112d767f

commit 0a09fd56501c2508c9d2797302544d55112d767f
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2020-12-12 07:22:38 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2021-01-11 20:54:22 +0000

    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 <rfg@tristatelogic.com>
    Reviewed by:    imp, kevans
    Approved by:    kevans (mentor)
    Differential Revision:  https://reviews.freebsd.org/D27556
    
    (cherry picked from commit f200cc255f8e90b1905d94d0506a22f5dcd467c0)
---
 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 <ctype.h>
 #include <err.h>
 #include <errno.h>
+#include <paths.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101112114.10BLEitJ067124>