svn commit: r368576 - head/sbin/geom/core

Robert Wing rew at FreeBSD.org
Sat Dec 12 07:22:39 UTC 2020


Author: rew
Date: Sat Dec 12 07:22:38 2020
New Revision: 368576
URL: https://svnweb.freebsd.org/changeset/base/368576

Log:
  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 at tristatelogic.com>
  Reviewed by:    imp, kevans
  Approved by:    kevans (mentor)
  MFC after:      1 week
  Differential Revision:  https://reviews.freebsd.org/D27556

Modified:
  head/sbin/geom/core/geom.c

Modified: head/sbin/geom/core/geom.c
==============================================================================
--- head/sbin/geom/core/geom.c	Sat Dec 12 05:57:42 2020	(r368575)
+++ head/sbin/geom/core/geom.c	Sat Dec 12 07:22:38 2020	(r368576)
@@ -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>
@@ -861,6 +862,9 @@ static struct ggeom *
 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)


More information about the svn-src-all mailing list