summaryrefslogtreecommitdiffstats
path: root/sbin/geom
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2010-07-04 22:17:56 +0000
committermjacob <mjacob@FreeBSD.org>2010-07-04 22:17:56 +0000
commit7f001287352c08739d0b3ad7fefca5c5018c27ed (patch)
tree691e116d0f663506e9d08f02483c808ceafcc1f4 /sbin/geom
parentcae33a9ae04566b89465e85f077e1992cb5f9fde (diff)
downloadFreeBSD-src-7f001287352c08739d0b3ad7fefca5c5018c27ed.zip
FreeBSD-src-7f001287352c08739d0b3ad7fefca5c5018c27ed.tar.gz
Fix the clear function which has been broken for a bit.
MFC after: 1 week
Diffstat (limited to 'sbin/geom')
-rw-r--r--sbin/geom/class/multipath/geom_multipath.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sbin/geom/class/multipath/geom_multipath.c b/sbin/geom/class/multipath/geom_multipath.c
index 288492c..2d2cdaf 100644
--- a/sbin/geom/class/multipath/geom_multipath.c
+++ b/sbin/geom/class/multipath/geom_multipath.c
@@ -222,17 +222,28 @@ mp_label(struct gctl_req *req)
}
}
+
static void
mp_clear(struct gctl_req *req)
{
const char *name;
- int error;
+ int error, i, nargs;
- name = gctl_get_ascii(req, "arg1");
- error = g_metadata_clear(name, G_MULTIPATH_MAGIC);
- if (error != 0) {
- fprintf(stderr, "Can't clear metadata on %s: %s.\n", name, strerror(error));
- gctl_error(req, "Not fully done.");
+ nargs = gctl_get_int(req, "nargs");
+ if (nargs < 1) {
+ gctl_error(req, "Too few arguments.");
+ return;
+ }
+
+ for (i = 0; i < nargs; i++) {
+ name = gctl_get_ascii(req, "arg%d", i);
+ error = g_metadata_clear(name, G_MULTIPATH_MAGIC);
+ if (error != 0) {
+ fprintf(stderr, "Can't clear metadata on %s: %s.\n",
+ name, strerror(error));
+ gctl_error(req, "Not fully done.");
+ continue;
+ }
}
}
OpenPOWER on IntegriCloud