From a2e31b8b539b6c39297e2dcdc6fd1d8c5177982e Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Mon, 5 Jul 2004 21:16:37 +0000 Subject: [PATCH] - Add 'stop' command, which works just like 'destroy' command, but sounds less dangerous. - Update manual pages and extend examples. - Bump versions. --- sbin/geom/class/concat/gconcat.8 | 18 ++++++++++++++++-- sbin/geom/class/concat/geom_concat.c | 9 ++++++++- sbin/geom/class/label/geom_label.c | 9 ++++++++- sbin/geom/class/label/glabel.8 | 22 ++++++++++++++++++---- sbin/geom/class/stripe/geom_stripe.c | 9 ++++++++- sbin/geom/class/stripe/gstripe.8 | 18 ++++++++++++++++-- sys/geom/concat/g_concat.c | 3 ++- sys/geom/concat/g_concat.h | 2 +- sys/geom/label/g_label.c | 3 ++- sys/geom/label/g_label.h | 2 +- sys/geom/stripe/g_stripe.c | 3 ++- sys/geom/stripe/g_stripe.h | 2 +- 12 files changed, 83 insertions(+), 17 deletions(-) diff --git a/sbin/geom/class/concat/gconcat.8 b/sbin/geom/class/concat/gconcat.8 index 3fc896cc8dfa..181202271632 100644 --- a/sbin/geom/class/concat/gconcat.8 +++ b/sbin/geom/class/concat/gconcat.8 @@ -39,6 +39,11 @@ .Ar dev2 .Op Ar dev3 Op Ar ... .Nm +.Cm destroy +.Op Fl fv +.Ar name +.Op Ar name2 Op Ar ... +.Nm .Cm label .Op Fl v .Ar name @@ -46,7 +51,7 @@ .Ar dev2 .Op Ar dev3 Op Ar ... .Nm -.Cm destroy +.Cm stop .Op Fl fv .Ar name .Op Ar name2 Op Ar ... @@ -104,9 +109,13 @@ method, where metadata are stored in every device's last sector. The kernel module .Pa geom_concat.ko will be loaded if it is not loaded already. -.It Cm destroy +.It Cm stop Turn off existing concatenate device by its .Ar name . +This command doesn't touch on-disk metadata! +.It Cm destroy +Same as +.Cm stop . .It Cm clear Clear metadata on the given devices. .It Cm list @@ -135,6 +144,10 @@ concatenation, create a file system on it, and mount it: gconcat label -v data /dev/da0 /dev/da1 /dev/da2 /dev/da3 newfs /dev/data.concat mount /dev/data.concat /mnt +[...] +umount /mnt +gconcat stop data +gconcat unload .Ed .Sh DIAGNOSTICS Exit status is 0 on success, and 1 if the command fails. @@ -143,6 +156,7 @@ Exit status is 0 on success, and 1 if the command fails. .Xr geom 8 , .Xr mount 8 , .Xr newfs 8 , +.Xr umount 8 , .Xr vinum 8 .Sh HISTORY The diff --git a/sbin/geom/class/concat/geom_concat.c b/sbin/geom/class/concat/geom_concat.c index 8000dcb1a9e0..3042b5f4a46b 100644 --- a/sbin/geom/class/concat/geom_concat.c +++ b/sbin/geom/class/concat/geom_concat.c @@ -49,6 +49,7 @@ static void concat_label(struct gctl_req *req); static void concat_clear(struct gctl_req *req); struct g_command class_commands[] = { + { "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS }, { "destroy", G_FLAG_VERBOSE, NULL, { @@ -57,7 +58,12 @@ struct g_command class_commands[] = { } }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, concat_main, G_NULL_OPTS }, - { "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS }, + { "stop", G_FLAG_VERBOSE, NULL, + { + { 'f', "force", NULL, G_TYPE_NONE }, + G_OPT_SENTINEL + } + }, G_CMD_SENTINEL }; @@ -72,6 +78,7 @@ usage(const char *name) fprintf(stderr, "usage: %s create [-v] [dev3 [...]]\n", name); fprintf(stderr, " %s destroy [-fv] [name2 [...]]\n", name); fprintf(stderr, " %s label [-v] [dev3 [...]]\n", name); + fprintf(stderr, " %s stop [-fv] [name2 [...]]\n", name); fprintf(stderr, " %s clear [-v] [dev2 [...]]\n", name); } diff --git a/sbin/geom/class/label/geom_label.c b/sbin/geom/class/label/geom_label.c index bbd6e7ff176b..edb0d7e4ef9e 100644 --- a/sbin/geom/class/label/geom_label.c +++ b/sbin/geom/class/label/geom_label.c @@ -49,6 +49,7 @@ static void label_label(struct gctl_req *req); static void label_clear(struct gctl_req *req); struct g_command class_commands[] = { + { "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS }, { "destroy", G_FLAG_VERBOSE, NULL, { @@ -57,7 +58,12 @@ struct g_command class_commands[] = { } }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, label_main, G_NULL_OPTS }, - { "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS }, + { "stop", G_FLAG_VERBOSE, NULL, + { + { 'f', "force", NULL, G_TYPE_NONE }, + G_OPT_SENTINEL + } + }, G_CMD_SENTINEL }; @@ -72,6 +78,7 @@ usage(const char *name) fprintf(stderr, "usage: %s create [-v] \n", name); fprintf(stderr, " %s destroy [-fv] [name2 [...]]\n", name); fprintf(stderr, " %s label [-v] \n", name); + fprintf(stderr, " %s stop [-fv] [name2 [...]]\n", name); fprintf(stderr, " %s clear [-v] [dev2 [...]]\n", name); } diff --git a/sbin/geom/class/label/glabel.8 b/sbin/geom/class/label/glabel.8 index 4b656e2716c9..46f20e91abb7 100644 --- a/sbin/geom/class/label/glabel.8 +++ b/sbin/geom/class/label/glabel.8 @@ -37,12 +37,17 @@ .Ar name .Ar dev .Nm +.Cm destroy +.Op Fl fv +.Ar name +.Op Ar name Op Ar ... +.Nm .Cm label .Op Fl v .Ar name .Ar dev .Nm -.Cm destroy +.Cm stop .Op Fl fv .Ar name .Op Ar name Op Ar ... @@ -127,9 +132,13 @@ method, where metadata is stored in provider's last sector. The kernel module .Pa geom_label.ko will be loaded if it is not loaded already. -.It Cm destroy -Turn off the given labels by its +.It Cm stop +Turn off the given label by its .Ar name . +This command doesn't touch on-disk metadata! +.It Cm destroy +Same as +.Cm stop . .It Cm clear Clear metadata on the given devices. .It Cm list @@ -158,6 +167,10 @@ create a file system on it, and mount it: glabel label -v usr /dev/da2 newfs /dev/label/usr mount /dev/label/usr /usr +[...] +umount /usr +glabel stop usr +glabel unload .Ed .Pp The next example shows how to setup a label for a UFS file system: @@ -172,7 +185,8 @@ Exit status is 0 on success, and 1 if the command fails. .Xr geom 8 , .Xr mount 8 , .Xr newfs 8 , -.Xr tunefs 8 +.Xr tunefs 8 , +.Xr umount 8 .Sh HISTORY The .Nm diff --git a/sbin/geom/class/stripe/geom_stripe.c b/sbin/geom/class/stripe/geom_stripe.c index 24731b73851d..0ed77c86a5d8 100644 --- a/sbin/geom/class/stripe/geom_stripe.c +++ b/sbin/geom/class/stripe/geom_stripe.c @@ -52,6 +52,7 @@ static void stripe_label(struct gctl_req *req); static void stripe_clear(struct gctl_req *req); struct g_command class_commands[] = { + { "clear", G_FLAG_VERBOSE, stripe_main, G_NULL_OPTS }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { { 's', "stripesize", &stripesize, G_TYPE_NUMBER }, @@ -70,7 +71,12 @@ struct g_command class_commands[] = { G_OPT_SENTINEL } }, - { "clear", G_FLAG_VERBOSE, stripe_main, G_NULL_OPTS }, + { "stop", G_FLAG_VERBOSE, NULL, + { + { 'f', "force", NULL, G_TYPE_NONE }, + G_OPT_SENTINEL + } + }, G_CMD_SENTINEL }; @@ -84,6 +90,7 @@ usage(const char *name) fprintf(stderr, "usage: %s create [-v] [-s stripesize] [dev3 [...]]\n", name); fprintf(stderr, " %s destroy [-fv] [name2 [...]]\n", name); fprintf(stderr, " %s label [-v] [-s stripesize] [dev3 [...]]\n", name); + fprintf(stderr, " %s stop [-fv] [name2 [...]]\n", name); fprintf(stderr, " %s clear [-v] [dev2 [...]]\n", name); } diff --git a/sbin/geom/class/stripe/gstripe.8 b/sbin/geom/class/stripe/gstripe.8 index a2837ae14ffe..1f3e7e1224fa 100644 --- a/sbin/geom/class/stripe/gstripe.8 +++ b/sbin/geom/class/stripe/gstripe.8 @@ -40,6 +40,11 @@ .Ar dev2 .Op Ar dev3 Op Ar ... .Nm +.Cm destroy +.Op Fl fv +.Ar name +.Op Ar name2 Op Ar ... +.Nm .Cm label .Op Fl v .Op Fl s Ar stripesize @@ -48,7 +53,7 @@ .Ar dev2 .Op Ar dev3 Op Ar ... .Nm -.Cm destroy +.Cm stop .Op Fl fv .Ar name .Op Ar name2 Op Ar ... @@ -106,9 +111,13 @@ method, where metadata are stored in every device's last sector. The kernel module .Pa geom_stripe.ko will be loaded if it is not loaded already. -.It Cm destroy +.It Cm stop Turn off existing striped device by its .Ar name . +This command doesn't touch on-disk metadata! +.It Cm destroy +Same as +.Cm stop . .It Cm clear Clear metadata on the given devices. .It Cm list @@ -139,6 +148,10 @@ for automatic configuration, create a file system on it, and mount it: gstripe label -v -s 65536 data /dev/da0 /dev/da1 /dev/da2 /dev/da3 newfs /dev/data.stripe mount /dev/data.stripe /mnt +[...] +umount /mnt +gstripe stop data +gstripe unload .Ed .Sh DIAGNOSTICS Exit status is 0 on success, and 1 if the command fails. @@ -147,6 +160,7 @@ Exit status is 0 on success, and 1 if the command fails. .Xr geom 8 , .Xr mount 8 , .Xr newfs 8 , +.Xr umount 8 , .Xr vinum 8 .Sh HISTORY The diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c index 768e2cbefbed..9dd8bff71842 100644 --- a/sys/geom/concat/g_concat.c +++ b/sys/geom/concat/g_concat.c @@ -791,7 +791,8 @@ g_concat_config(struct gctl_req *req, struct g_class *mp, const char *verb) if (strcmp(verb, "create") == 0) { g_concat_ctl_create(req, mp); return; - } else if (strcmp(verb, "destroy") == 0) { + } else if (strcmp(verb, "destroy") == 0 || + strcmp(verb, "stop") == 0) { g_concat_ctl_destroy(req, mp); return; } diff --git a/sys/geom/concat/g_concat.h b/sys/geom/concat/g_concat.h index 013356b646ce..81675d88029a 100644 --- a/sys/geom/concat/g_concat.h +++ b/sys/geom/concat/g_concat.h @@ -34,7 +34,7 @@ #define G_CONCAT_CLASS_NAME "CONCAT" #define G_CONCAT_MAGIC "GEOM::CONCAT" -#define G_CONCAT_VERSION 1 +#define G_CONCAT_VERSION 2 #ifdef _KERNEL #define G_CONCAT_TYPE_MANUAL 0 diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c index 2aa9754b70d3..7b0781b8e22e 100644 --- a/sys/geom/label/g_label.c +++ b/sys/geom/label/g_label.c @@ -394,7 +394,8 @@ g_label_config(struct gctl_req *req, struct g_class *mp, const char *verb) if (strcmp(verb, "create") == 0) { g_label_ctl_create(req, mp); return; - } else if (strcmp(verb, "destroy") == 0) { + } else if (strcmp(verb, "destroy") == 0 || + strcmp(verb, "stop") == 0) { g_label_ctl_destroy(req, mp); return; } diff --git a/sys/geom/label/g_label.h b/sys/geom/label/g_label.h index 011cc5e3ba5e..2b71dc1c7098 100644 --- a/sys/geom/label/g_label.h +++ b/sys/geom/label/g_label.h @@ -34,7 +34,7 @@ #define G_LABEL_CLASS_NAME "LABEL" #define G_LABEL_MAGIC "GEOM::LABEL" -#define G_LABEL_VERSION 0 +#define G_LABEL_VERSION 1 #define G_LABEL_DIR "label" #ifdef _KERNEL diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c index 1d87a495aef5..cac06f879fb6 100644 --- a/sys/geom/stripe/g_stripe.c +++ b/sys/geom/stripe/g_stripe.c @@ -859,7 +859,8 @@ g_stripe_config(struct gctl_req *req, struct g_class *mp, const char *verb) if (strcmp(verb, "create") == 0) { g_stripe_ctl_create(req, mp); return; - } else if (strcmp(verb, "destroy") == 0) { + } else if (strcmp(verb, "destroy") == 0 || + strcmp(verb, "stop") == 0) { g_stripe_ctl_destroy(req, mp); return; } diff --git a/sys/geom/stripe/g_stripe.h b/sys/geom/stripe/g_stripe.h index 07db6de13709..2a9ff2d91300 100644 --- a/sys/geom/stripe/g_stripe.h +++ b/sys/geom/stripe/g_stripe.h @@ -34,7 +34,7 @@ #define G_STRIPE_CLASS_NAME "STRIPE" #define G_STRIPE_MAGIC "GEOM::STRIPE" -#define G_STRIPE_VERSION 0 +#define G_STRIPE_VERSION 1 #ifdef _KERNEL #define G_STRIPE_TYPE_MANUAL 0