aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/stripe
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2020-07-22 02:15:21 +0000
committerXin LI <delphij@FreeBSD.org>2020-07-22 02:15:21 +0000
commitfcf69f3dbce6b3b6187ff584031e690fbe2479d2 (patch)
treeffeb8b9fcb72de1f688fe880b1a8e468add897aa /sys/geom/stripe
parent0ab851aac3a028d0771e6d32054b8b768a2bec3b (diff)
Notes
Diffstat (limited to 'sys/geom/stripe')
-rw-r--r--sys/geom/stripe/g_stripe.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index af764ee7453a..a1b9835499ee 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -1091,19 +1091,9 @@ g_stripe_ctl_create(struct gctl_req *req, struct g_class *mp)
/* Check all providers are valid */
for (no = 1; no < *nargs; no++) {
snprintf(param, sizeof(param), "arg%u", no);
- name = gctl_get_asciiparam(req, param);
- if (name == NULL) {
- gctl_error(req, "No 'arg%u' argument.", no);
- return;
- }
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- name += strlen(_PATH_DEV);
- pp = g_provider_by_name(name);
- if (pp == NULL) {
- G_STRIPE_DEBUG(1, "Disk %s is invalid.", name);
- gctl_error(req, "Disk %s is invalid.", name);
+ pp = gctl_get_provider(req, param);
+ if (pp == NULL)
return;
- }
}
gp = g_stripe_create(mp, &md, G_STRIPE_TYPE_MANUAL);
@@ -1117,15 +1107,13 @@ g_stripe_ctl_create(struct gctl_req *req, struct g_class *mp)
sbuf_printf(sb, "Can't attach disk(s) to %s:", gp->name);
for (attached = 0, no = 1; no < *nargs; no++) {
snprintf(param, sizeof(param), "arg%u", no);
- name = gctl_get_asciiparam(req, param);
- if (name == NULL) {
- gctl_error(req, "No 'arg%u' argument.", no);
+ pp = gctl_get_provider(req, param);
+ if (pp == NULL) {
+ name = gctl_get_asciiparam(req, param);
+ MPASS(name != NULL);
+ sbuf_printf(sb, " %s", name);
continue;
}
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- name += strlen(_PATH_DEV);
- pp = g_provider_by_name(name);
- KASSERT(pp != NULL, ("Provider %s disappear?!", name));
if (g_stripe_add_disk(sc, pp, no - 1) != 0) {
G_STRIPE_DEBUG(1, "Disk %u (%s) not attached to %s.",
no, pp->name, gp->name);