diff options
author | mav <mav@FreeBSD.org> | 2015-04-09 10:05:58 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-04-09 10:05:58 +0000 |
commit | baa4297d14630dc2e0c60f91fae40ecf50aa4ae0 (patch) | |
tree | 3c5a4e23edb11d763059b26db3205dc28460332d | |
parent | 2da35800ba74197e3c32cfb7335da62b036ad920 (diff) | |
download | FreeBSD-src-baa4297d14630dc2e0c60f91fae40ecf50aa4ae0.zip FreeBSD-src-baa4297d14630dc2e0c60f91fae40ecf50aa4ae0.tar.gz |
MFC r280685: When searching for provider by name, prefer non-withered one.
-rw-r--r-- | sys/geom/geom_subr.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index f42aae5..bf14a86 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -683,21 +683,27 @@ g_provider_by_name(char const *arg) { struct g_class *cp; struct g_geom *gp; - struct g_provider *pp; + struct g_provider *pp, *wpp; if (strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) arg += sizeof(_PATH_DEV) - 1; + wpp = NULL; LIST_FOREACH(cp, &g_classes, class) { LIST_FOREACH(gp, &cp->geom, geom) { LIST_FOREACH(pp, &gp->provider, provider) { - if (!strcmp(arg, pp->name)) + if (strcmp(arg, pp->name) != 0) + continue; + if ((gp->flags & G_GEOM_WITHER) == 0 && + (pp->flags & G_PF_WITHER) == 0) return (pp); + else + wpp = pp; } } } - return (NULL); + return (wpp); } void |