svn commit: r218086 - projects/graid/head/sys/geom/raid

Alexander Motin mav at FreeBSD.org
Sun Jan 30 12:04:22 UTC 2011


Author: mav
Date: Sun Jan 30 12:04:21 2011
New Revision: 218086
URL: http://svn.freebsd.org/changeset/base/218086

Log:
  Make `graid label` report name of created geom. This name is required for
  any further array operations, especially for scripting.

Modified:
  projects/graid/head/sys/geom/raid/g_raid_ctl.c

Modified: projects/graid/head/sys/geom/raid/g_raid_ctl.c
==============================================================================
--- projects/graid/head/sys/geom/raid/g_raid_ctl.c	Sun Jan 30 11:23:59 2011	(r218085)
+++ projects/graid/head/sys/geom/raid/g_raid_ctl.c	Sun Jan 30 12:04:21 2011	(r218086)
@@ -72,6 +72,7 @@ g_raid_ctl_label(struct gctl_req *req, s
 	const char *format;
 	int *nargs;
 	int crstatus, ctlstatus;
+	char buf[64];
 
 	nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
 	if (nargs == NULL) {
@@ -101,6 +102,12 @@ g_raid_ctl_label(struct gctl_req *req, s
 		gctl_error(req, "Command failed: %d.", ctlstatus);
 		if (crstatus == G_RAID_MD_TASTE_NEW)
 			g_raid_destroy_node(sc, 0);
+	} else {
+		if (crstatus == G_RAID_MD_TASTE_NEW)
+			snprintf(buf, sizeof(buf), "%s created\n", sc->sc_name);
+		else
+			snprintf(buf, sizeof(buf), "%s reused\n", sc->sc_name);
+		gctl_set_param_err(req, "output", buf, strlen(buf) + 1);
 	}
 	sx_xunlock(&sc->sc_lock);
 	g_topology_lock();


More information about the svn-src-projects mailing list