Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2017 19:03:08 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317515 - head/sbin/geom/class/part
Message-ID:  <201704271903.v3RJ38Lj016200@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Apr 27 19:03:08 2017
New Revision: 317515
URL: https://svnweb.freebsd.org/changeset/base/317515

Log:
  Fix withered handling of r280687, broken by r286719.
  
  MFC after:	1 week.

Modified:
  head/sbin/geom/class/part/geom_part.c

Modified: head/sbin/geom/class/part/geom_part.c
==============================================================================
--- head/sbin/geom/class/part/geom_part.c	Thu Apr 27 18:52:18 2017	(r317514)
+++ head/sbin/geom/class/part/geom_part.c	Thu Apr 27 19:03:08 2017	(r317515)
@@ -73,6 +73,7 @@ volatile sig_atomic_t undo_restore;
 
 static struct gclass *find_class(struct gmesh *, const char *);
 static struct ggeom * find_geom(struct gclass *, const char *);
+static int geom_is_withered(struct ggeom *);
 static const char *find_geomcfg(struct ggeom *, const char *);
 static const char *find_provcfg(struct gprovider *, const char *);
 static struct gprovider *find_provider(struct ggeom *, off_t);
@@ -215,7 +216,7 @@ find_geom(struct gclass *classp, const c
 	LIST_FOREACH(gp, &classp->lg_geom, lg_geom) {
 		if (strcmp(gp->lg_name, name) != 0)
 			continue;
-		if (find_geomcfg(gp, "wither") == NULL)
+		if (!geom_is_withered(gp))
 			return (gp);
 		else
 			wgp = gp;
@@ -223,6 +224,18 @@ find_geom(struct gclass *classp, const c
 	return (wgp);
 }
 
+static int
+geom_is_withered(struct ggeom *gp)
+{
+	struct gconfig *gc;
+
+	LIST_FOREACH(gc, &gp->lg_config, lg_config) {
+		if (!strcmp(gc->lg_name, "wither"))
+			return (1);
+	}
+	return (0);
+}
+
 static const char *
 find_geomcfg(struct ggeom *gp, const char *cfg)
 {
@@ -614,7 +627,7 @@ gpart_show_geom(struct ggeom *gp, const 
 	off_t length, secsz;
 	int idx, wblocks, wname, wmax;
 
-	if (find_geomcfg(gp, "wither"))
+	if (geom_is_withered(gp))
 		return;
 	scheme = find_geomcfg(gp, "scheme");
 	if (scheme == NULL)



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