diff options
author | ae <ae@FreeBSD.org> | 2010-11-11 12:13:41 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2010-11-11 12:13:41 +0000 |
commit | 54af98ea87a7891c608f6dfc24d9a8a232e606ec (patch) | |
tree | bc297da2dcbbbab6edf8fbc8c0fea53a539cf327 /sys/geom | |
parent | dadf5cd065f60f3861c85cdb6b3ee94517f2c17e (diff) | |
download | FreeBSD-src-54af98ea87a7891c608f6dfc24d9a8a232e606ec.zip FreeBSD-src-54af98ea87a7891c608f6dfc24d9a8a232e606ec.tar.gz |
Fix regression introduced in r215088: gpart(8) reports
"arg0 'provider': Invalid argument" after creating new partition
table.
Move code for search of existing geom into g_part_find_geom
function and use this function instead of g_part_parm_geom
in g_part_ctl_create.
Approved by: kib (mentor)
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/part/g_part.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c index 65ad525..b48ae11 100644 --- a/sys/geom/part/g_part.c +++ b/sys/geom/part/g_part.c @@ -296,6 +296,17 @@ g_part_new_provider(struct g_geom *gp, struct g_part_table *table, g_error_provider(entry->gpe_pp, 0); } +static struct g_geom* +g_part_find_geom(const char *name) +{ + struct g_geom *gp; + LIST_FOREACH(gp, &g_part_class.geom, geom) { + if (!strcmp(name, gp->name)) + break; + } + return (gp); +} + static int g_part_parm_geom(struct gctl_req *req, const char *name, struct g_geom **v) { @@ -307,10 +318,7 @@ g_part_parm_geom(struct gctl_req *req, const char *name, struct g_geom **v) return (ENOATTR); if (strncmp(gname, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) gname += sizeof(_PATH_DEV) - 1; - LIST_FOREACH(gp, &g_part_class.geom, geom) { - if (!strcmp(gname, gp->name)) - break; - } + gp = g_part_find_geom(gname); if (gp == NULL) { gctl_error(req, "%d %s '%s'", EINVAL, name, gname); return (EINVAL); @@ -748,8 +756,8 @@ g_part_ctl_create(struct gctl_req *req, struct g_part_parms *gpp) g_topology_assert(); /* Check that there isn't already a g_part geom on the provider. */ - error = g_part_parm_geom(req, "arg0", &gp); - if (!error) { + gp = g_part_find_geom(pp->name); + if (gp != NULL) { null = gp->softc; if (null->gpt_scheme != &g_part_null_scheme) { gctl_error(req, "%d geom '%s'", EEXIST, pp->name); |