Date: Fri, 5 Jan 2007 22:46:04 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 112567 for review Message-ID: <200701052246.l05Mk4D5055370@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=112567 Change 112567 by mjacob@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; + } + } +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701052246.l05Mk4D5055370>