PERFORCE change 112567 for review

Matt Jacob mjacob at FreeBSD.org
Fri Jan 5 14:46:05 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=112567

Change 112567 by mjacob at mjexp_6 on 2007/01/05 22:45:21

	Fix a typo.

Affected files ...

.. //depot/projects/mjexp_6/sbin/geom/class/multipath/geom_multipath.c#2 edit

Differences ...

==== //depot/projects/mjexp_6/sbin/geom/class/multipath/geom_multipath.c#2 (text+ko) ====

@@ -47,16 +47,17 @@
 
 static void mp_main(struct gctl_req *, unsigned int);
 static void mp_label(struct gctl_req *);
+static void mp_clear(struct gctl_req *);
 
 struct g_command class_commands[] = {
 	{
 		"label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS,
-		"[-v] name prov prov"
+		"[-v] name prov ..."
 	},
 	{
-		"destroy", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
-		"[-fv] name"
-        },
+		"clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS,
+		"[-v] prov ..."
+	},
 	G_CMD_SENTINEL
 };
 
@@ -72,6 +73,8 @@
 	}
 	if (strcmp(name, "label") == 0) {
 		mp_label(req);
+	} else if (strcmp(name, "clear") == 0) {
+		mp_clear(req);
 	} else {
 		gctl_error(req, "Unknown command: %s.", name);
 	}
@@ -90,7 +93,7 @@
 	int error, i, nargs;
 
 	nargs = gctl_get_int(req, "nargs");
-	if (nargs != 3) {
+	if (nargs < 2) {
 		gctl_error(req, "wrong number of arguments.");
 		return;
 	}
@@ -201,3 +204,27 @@
 		}
 	}
 }
+
+static void
+mp_clear(struct gctl_req *req)
+{
+	const char *name;
+	int error, i, nargs;
+
+	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;
+                }
+        }
+}


More information about the p4-projects mailing list