Fix withered handling of r280687, broken by r286719.

MFC after:	1 week.
This commit is contained in:
Alexander Motin 2017-04-27 19:03:08 +00:00
parent 24b55fb76d
commit 5e50c20ea1

View File

@ -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 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;
@ -223,6 +224,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)
{
@ -614,7 +627,7 @@ gpart_show_geom(struct ggeom *gp, const char *element, int show_providers)
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)