Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Apr 2019 16:26:01 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r346753 - stable/11/sbin/geom/class/part
Message-ID:  <201904261626.x3QGQ1CB081587@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Apr 26 16:26:01 2019
New Revision: 346753
URL: https://svnweb.freebsd.org/changeset/base/346753

Log:
  MFC r317515: Fix withered handling of r280687, broken by r286719.

Modified:
  stable/11/sbin/geom/class/part/geom_part.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/geom/class/part/geom_part.c
==============================================================================
--- stable/11/sbin/geom/class/part/geom_part.c	Fri Apr 26 16:14:23 2019	(r346752)
+++ stable/11/sbin/geom/class/part/geom_part.c	Fri Apr 26 16:26:01 2019	(r346753)
@@ -75,6 +75,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);
@@ -217,7 +218,7 @@ find_geom(struct gclass *classp, const char *name)
 	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;
@@ -225,6 +226,18 @@ find_geom(struct gclass *classp, const char *name)
 	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)
 {
@@ -616,7 +629,7 @@ gpart_show_geom(struct ggeom *gp, const char *element,
 	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?201904261626.x3QGQ1CB081587>