Define subcommands' usage inside g_command structure.
MFC after: 1 week
This commit is contained in:
parent
c979e2069c
commit
e10c321f69
@ -51,46 +51,41 @@ static void concat_dump(struct gctl_req *req);
|
||||
static void concat_label(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 },
|
||||
{ "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS,
|
||||
"[-v] prov ..."
|
||||
},
|
||||
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS,
|
||||
"[-v] name prov prov ..."
|
||||
},
|
||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
{ "dump", 0, concat_main, G_NULL_OPTS,
|
||||
"prov ..."
|
||||
},
|
||||
{ "dump", 0, concat_main, G_NULL_OPTS },
|
||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, concat_main,
|
||||
{
|
||||
{ 'h', "hardcode", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-hv] name prov prov ..."
|
||||
},
|
||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
G_CMD_SENTINEL
|
||||
};
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
|
||||
void usage(const char *name);
|
||||
void
|
||||
usage(const char *name)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s create [-v] name prov prov ...\n", name);
|
||||
fprintf(stderr, " %s destroy [-fv] name ...\n", name);
|
||||
fprintf(stderr, " %s label [-hv] name prov prov ...\n", name);
|
||||
fprintf(stderr, " %s stop [-fv] name ...\n", name);
|
||||
fprintf(stderr, " %s clear [-v] prov ...\n", name);
|
||||
fprintf(stderr, " %s dump prov ...\n", name);
|
||||
}
|
||||
|
||||
static void
|
||||
concat_main(struct gctl_req *req, unsigned flags)
|
||||
{
|
||||
|
@ -50,41 +50,37 @@ static void label_dump(struct gctl_req *req);
|
||||
static void label_label(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 },
|
||||
{ "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS,
|
||||
"[-v] dev ..."
|
||||
},
|
||||
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS,
|
||||
"[-v] name dev"
|
||||
},
|
||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
{ "dump", 0, label_main, G_NULL_OPTS,
|
||||
"dev ..."
|
||||
},
|
||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, label_main, G_NULL_OPTS,
|
||||
"[-v] name dev"
|
||||
},
|
||||
{ "dump", 0, label_main, G_NULL_OPTS },
|
||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, label_main, G_NULL_OPTS },
|
||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
G_CMD_SENTINEL
|
||||
};
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
|
||||
void usage(const char *name);
|
||||
void
|
||||
usage(const char *name)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s create [-v] name dev\n", name);
|
||||
fprintf(stderr, " %s destroy [-fv] name ...\n", name);
|
||||
fprintf(stderr, " %s label [-v] name dev\n", name);
|
||||
fprintf(stderr, " %s stop [-fv] name ...\n", name);
|
||||
fprintf(stderr, " %s clear [-v] dev ...\n", name);
|
||||
fprintf(stderr, " %s dump dev ...\n", name);
|
||||
}
|
||||
|
||||
static void
|
||||
label_main(struct gctl_req *req, unsigned flags)
|
||||
{
|
||||
|
@ -56,8 +56,12 @@ static void mirror_dump(struct gctl_req *req);
|
||||
static void mirror_label(struct gctl_req *req);
|
||||
|
||||
struct g_command class_commands[] = {
|
||||
{ "activate", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS },
|
||||
{ "clear", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS },
|
||||
{ "activate", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS,
|
||||
"[-v] name prov ..."
|
||||
},
|
||||
{ "clear", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS,
|
||||
"[-v] prov ..."
|
||||
},
|
||||
{ "configure", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'a', "autosync", NULL, G_TYPE_NONE },
|
||||
@ -67,11 +71,18 @@ struct g_command class_commands[] = {
|
||||
{ 'n', "noautosync", NULL, G_TYPE_NONE },
|
||||
{ 's', "slice", &configure_slice, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-adhnv] [-b balance] [-s slice] name"
|
||||
},
|
||||
{ "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
||||
"[-v] name prov ..."
|
||||
},
|
||||
{ "dump", 0, mirror_main, G_NULL_OPTS,
|
||||
"prov ..."
|
||||
},
|
||||
{ "forget", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
||||
"name ..."
|
||||
},
|
||||
{ "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS },
|
||||
{ "dump", 0, mirror_main, G_NULL_OPTS },
|
||||
{ "forget", G_FLAG_VERBOSE, NULL, G_NULL_OPTS },
|
||||
{ "label", G_FLAG_VERBOSE, mirror_main,
|
||||
{
|
||||
{ 'b', "balance", label_balance, G_TYPE_STRING },
|
||||
@ -79,7 +90,8 @@ struct g_command class_commands[] = {
|
||||
{ 'n', "noautosync", NULL, G_TYPE_NONE },
|
||||
{ 's', "slice", &label_slice, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-hnv] [-b balance] [-s slice] name prov ..."
|
||||
},
|
||||
{ "insert", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
@ -87,40 +99,27 @@ struct g_command class_commands[] = {
|
||||
{ 'i', "inactive", NULL, G_TYPE_NONE },
|
||||
{ 'p', "priority", &insert_priority, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-hiv] [-p priority] name prov ..."
|
||||
},
|
||||
{ "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
||||
"[-v] name prov ..."
|
||||
},
|
||||
{ "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
||||
"[-v] name prov ..."
|
||||
},
|
||||
{ "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS },
|
||||
{ "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS },
|
||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
G_CMD_SENTINEL
|
||||
};
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
void usage(const char *);
|
||||
void
|
||||
usage(const char *comm)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s label [-hnv] [-b balance] [-s slice] name prov ...\n"
|
||||
" %s clear [-v] prov ...\n"
|
||||
" %s dump prov ...\n"
|
||||
" %s configure [-adhnv] [-b balance] [-s slice] name\n"
|
||||
" %s rebuild [-v] name prov ...\n"
|
||||
" %s insert [-hiv] [-p priority] name prov ...\n"
|
||||
" %s remove [-v] name prov ...\n"
|
||||
" %s activate [-v] name prov ...\n"
|
||||
" %s deactivate [-v] name prov ...\n"
|
||||
" %s forget name ...\n"
|
||||
" %s stop [-fv] name ...\n",
|
||||
comm, comm, comm, comm, comm, comm, comm, comm, comm, comm, comm);
|
||||
}
|
||||
|
||||
static void
|
||||
mirror_main(struct gctl_req *req, unsigned flags)
|
||||
{
|
||||
|
@ -51,29 +51,22 @@ struct g_command class_commands[] = {
|
||||
{ 's', "size", &size, G_TYPE_NUMBER },
|
||||
{ 'S', "secsize", &secsize, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-v] [-f failprob] [-o offset] [-s size] [-S secsize] dev ..."
|
||||
},
|
||||
{ "configure", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "failprob", &failprob, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-v] [-f failprob] prov ..."
|
||||
},
|
||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] prov ..."
|
||||
},
|
||||
G_CMD_SENTINEL
|
||||
};
|
||||
|
||||
void usage(const char *name);
|
||||
void
|
||||
usage(const char *name)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s create [-v] [-f failprob] [-o offset] [-s size] [-S secsize] dev ...\n", name);
|
||||
fprintf(stderr, " %s configure [-v] [-f failprob] prov ...\n", name);
|
||||
fprintf(stderr, " %s destroy [-fv] prov ...\n", name);
|
||||
}
|
||||
|
@ -51,7 +51,9 @@ static void raid3_dump(struct gctl_req *req);
|
||||
static void raid3_label(struct gctl_req *req);
|
||||
|
||||
struct g_command class_commands[] = {
|
||||
{ "clear", G_FLAG_VERBOSE, raid3_main, G_NULL_OPTS },
|
||||
{ "clear", G_FLAG_VERBOSE, raid3_main, G_NULL_OPTS,
|
||||
"[-v] prov ..."
|
||||
},
|
||||
{ "configure", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'a', "autosync", NULL, G_TYPE_NONE },
|
||||
@ -63,15 +65,19 @@ struct g_command class_commands[] = {
|
||||
{ 'w', "verify", NULL, G_TYPE_NONE },
|
||||
{ 'W', "noverify", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-adhnrRvwW] name"
|
||||
},
|
||||
{ "dump", 0, raid3_main, G_NULL_OPTS,
|
||||
"prov ..."
|
||||
},
|
||||
{ "dump", 0, raid3_main, G_NULL_OPTS },
|
||||
{ "insert", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'h', "hardcode", NULL, G_TYPE_NONE },
|
||||
{ 'n', "number", NULL, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-hv] <-n number> name prov"
|
||||
},
|
||||
{ "label", G_FLAG_VERBOSE, raid3_main,
|
||||
{
|
||||
@ -80,42 +86,31 @@ struct g_command class_commands[] = {
|
||||
{ 'r', "round_robin", NULL, G_TYPE_NONE },
|
||||
{ 'w', "verify", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-hnrvw] name prov prov prov ..."
|
||||
},
|
||||
{ "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
||||
"[-v] name prov"
|
||||
},
|
||||
{ "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS },
|
||||
{ "remove", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'n', "number", NULL, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-v] <-n number> name"
|
||||
},
|
||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
G_CMD_SENTINEL
|
||||
};
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
void usage(const char *);
|
||||
void
|
||||
usage(const char *comm)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s label [-hnrvw] name prov prov prov ...\n"
|
||||
" %s clear [-v] prov ...\n"
|
||||
" %s dump prov ...\n"
|
||||
" %s configure [-adhnrRvwW] name\n"
|
||||
" %s rebuild [-v] name prov\n"
|
||||
" %s insert [-hv] <-n number> name prov\n"
|
||||
" %s remove [-v] <-n number> name\n"
|
||||
" %s stop [-fv] name ...\n",
|
||||
comm, comm, comm, comm, comm, comm, comm, comm);
|
||||
}
|
||||
|
||||
static void
|
||||
raid3_main(struct gctl_req *req, unsigned flags)
|
||||
{
|
||||
|
@ -52,36 +52,31 @@ static void shsec_dump(struct gctl_req *req);
|
||||
static void shsec_label(struct gctl_req *req);
|
||||
|
||||
struct g_command class_commands[] = {
|
||||
{ "clear", G_FLAG_VERBOSE, shsec_main, G_NULL_OPTS },
|
||||
{ "dump", 0, shsec_main, G_NULL_OPTS },
|
||||
{ "clear", G_FLAG_VERBOSE, shsec_main, G_NULL_OPTS,
|
||||
"clear [-v] prov ..."
|
||||
},
|
||||
{ "dump", 0, shsec_main, G_NULL_OPTS,
|
||||
"dump prov ..."
|
||||
},
|
||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, shsec_main,
|
||||
{
|
||||
{ 'h', "hardcode", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-hv] name prov prov ..."
|
||||
},
|
||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
G_CMD_SENTINEL
|
||||
};
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
void usage(const char *name);
|
||||
void
|
||||
usage(const char *name)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s label [-hv] name prov prov ...\n", name);
|
||||
fprintf(stderr, " %s stop [-fv] name ...\n", name);
|
||||
fprintf(stderr, " %s clear [-v] prov ...\n", name);
|
||||
fprintf(stderr, " %s dump prov ...\n", name);
|
||||
}
|
||||
|
||||
static void
|
||||
shsec_main(struct gctl_req *req, unsigned flags)
|
||||
{
|
||||
|
@ -54,51 +54,46 @@ static void stripe_dump(struct gctl_req *req);
|
||||
static void stripe_label(struct gctl_req *req);
|
||||
|
||||
struct g_command class_commands[] = {
|
||||
{ "clear", G_FLAG_VERBOSE, stripe_main, G_NULL_OPTS },
|
||||
{ "clear", G_FLAG_VERBOSE, stripe_main, G_NULL_OPTS,
|
||||
"[-v] prov ..."
|
||||
},
|
||||
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
|
||||
{
|
||||
{ 's', "stripesize", &stripesize, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-hv] [-s stripesize] name prov prov ..."
|
||||
},
|
||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
{ "dump", 0, stripe_main, G_NULL_OPTS,
|
||||
"dump prov ..."
|
||||
},
|
||||
{ "dump", 0, stripe_main, G_NULL_OPTS },
|
||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, stripe_main,
|
||||
{
|
||||
{ 'h', "hardcode", NULL, G_TYPE_NONE },
|
||||
{ 's', "stripesize", &stripesize, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-hv] [-s stripesize] name prov prov ..."
|
||||
},
|
||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'f', "force", NULL, G_TYPE_NONE },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
"[-fv] name ..."
|
||||
},
|
||||
G_CMD_SENTINEL
|
||||
};
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
void usage(const char *name);
|
||||
void
|
||||
usage(const char *name)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s create [-hv] [-s stripesize] name prov prov ...\n", name);
|
||||
fprintf(stderr, " %s destroy [-fv] name ...\n", name);
|
||||
fprintf(stderr, " %s label [-hv] [-s stripesize] name prov prov ...\n", name);
|
||||
fprintf(stderr, " %s stop [-fv] name ...\n", name);
|
||||
fprintf(stderr, " %s clear [-v] prov ...\n", name);
|
||||
fprintf(stderr, " %s dump prov ...\n", name);
|
||||
}
|
||||
|
||||
static void
|
||||
stripe_main(struct gctl_req *req, unsigned flags)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user