Add gpart(8).
In order to support gpart(8), geom(8) needs to support a named argument. Also, optional string parameters are a requirement. Both have been added to the infrastructure. The former required all existing classes to be adjusted.
This commit is contained in:
parent
8ea441aed5
commit
40656d0851
@ -12,6 +12,7 @@ SUBDIR+=label
|
|||||||
SUBDIR+=mirror
|
SUBDIR+=mirror
|
||||||
SUBDIR+=multipath
|
SUBDIR+=multipath
|
||||||
SUBDIR+=nop
|
SUBDIR+=nop
|
||||||
|
SUBDIR+=part
|
||||||
SUBDIR+=raid3
|
SUBDIR+=raid3
|
||||||
SUBDIR+=shsec
|
SUBDIR+=shsec
|
||||||
SUBDIR+=stripe
|
SUBDIR+=stripe
|
||||||
|
16
sbin/geom/class/cache/geom_cache.c
vendored
16
sbin/geom/class/cache/geom_cache.c
vendored
@ -53,7 +53,7 @@ static void cache_dump(struct gctl_req *req);
|
|||||||
static void cache_label(struct gctl_req *req);
|
static void cache_label(struct gctl_req *req);
|
||||||
|
|
||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{ "clear", G_FLAG_VERBOSE, cache_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, cache_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
{ "configure", G_FLAG_VERBOSE, NULL,
|
{ "configure", G_FLAG_VERBOSE, NULL,
|
||||||
@ -62,7 +62,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "size", &size_configure, G_TYPE_NUMBER },
|
{ 's', "size", &size_configure, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-v] [-b blocksize] [-s size] name"
|
NULL, "[-v] [-b blocksize] [-s size] name"
|
||||||
},
|
},
|
||||||
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
|
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
|
||||||
{
|
{
|
||||||
@ -70,16 +70,16 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "size", &size_label, G_TYPE_NUMBER },
|
{ 's', "size", &size_label, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-v] [-b blocksize] [-s size] name prov"
|
NULL, "[-v] [-b blocksize] [-s size] name prov"
|
||||||
},
|
},
|
||||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
{ "dump", 0, cache_main, G_NULL_OPTS,
|
{ "dump", 0, cache_main, G_NULL_OPTS, NULL,
|
||||||
"prov ..."
|
"prov ..."
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, cache_main,
|
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, cache_main,
|
||||||
@ -88,9 +88,9 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "size", &size_label, G_TYPE_NUMBER },
|
{ 's', "size", &size_label, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-v] [-b blocksize] [-s size] name prov"
|
NULL, "[-v] [-b blocksize] [-s size] name prov"
|
||||||
},
|
},
|
||||||
{ "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
{ "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
||||||
"[-v] name ..."
|
"[-v] name ..."
|
||||||
},
|
},
|
||||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||||
@ -98,7 +98,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
@ -51,20 +51,20 @@ static void concat_dump(struct gctl_req *req);
|
|||||||
static void concat_label(struct gctl_req *req);
|
static void concat_label(struct gctl_req *req);
|
||||||
|
|
||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{ "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS,
|
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS,
|
||||||
"[-v] name prov ..."
|
NULL, "[-v] name prov ..."
|
||||||
},
|
},
|
||||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
{ "dump", 0, concat_main, G_NULL_OPTS,
|
{ "dump", 0, concat_main, G_NULL_OPTS, NULL,
|
||||||
"prov ..."
|
"prov ..."
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, concat_main,
|
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, concat_main,
|
||||||
@ -72,14 +72,14 @@ struct g_command class_commands[] = {
|
|||||||
{ 'h', "hardcode", NULL, G_TYPE_BOOL },
|
{ 'h', "hardcode", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-hv] name prov ..."
|
NULL, "[-hv] name prov ..."
|
||||||
},
|
},
|
||||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
@ -105,7 +105,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "sectorsize", §orsize, G_TYPE_NUMBER },
|
{ 's', "sectorsize", §orsize, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-bPv] [-a aalgo] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov"
|
NULL, "[-bPv] [-a aalgo] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov"
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE, eli_main,
|
{ "label", G_FLAG_VERBOSE, eli_main,
|
||||||
{
|
{
|
||||||
@ -119,7 +119,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "sectorsize", §orsize, G_TYPE_NUMBER },
|
{ 's', "sectorsize", §orsize, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"- an alias for 'init'"
|
NULL, "- an alias for 'init'"
|
||||||
},
|
},
|
||||||
{ "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main,
|
{ "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main,
|
||||||
{
|
{
|
||||||
@ -129,7 +129,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 'r', "readonly", NULL, G_TYPE_BOOL },
|
{ 'r', "readonly", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-dprv] [-k keyfile] prov"
|
NULL, "[-dprv] [-k keyfile] prov"
|
||||||
},
|
},
|
||||||
{ "detach", 0, NULL,
|
{ "detach", 0, NULL,
|
||||||
{
|
{
|
||||||
@ -137,7 +137,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 'l', "last", NULL, G_TYPE_BOOL },
|
{ 'l', "last", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fl] prov ..."
|
NULL, "[-fl] prov ..."
|
||||||
},
|
},
|
||||||
{ "stop", 0, NULL,
|
{ "stop", 0, NULL,
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 'l', "last", NULL, G_TYPE_BOOL },
|
{ 'l', "last", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"- an alias for 'detach'"
|
NULL, "- an alias for 'detach'"
|
||||||
},
|
},
|
||||||
{ "onetime", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
|
{ "onetime", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "sectorsize", §orsize, G_TYPE_NUMBER },
|
{ 's', "sectorsize", §orsize, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov ..."
|
NULL, "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov ..."
|
||||||
},
|
},
|
||||||
{ "configure", G_FLAG_VERBOSE, eli_main,
|
{ "configure", G_FLAG_VERBOSE, eli_main,
|
||||||
{
|
{
|
||||||
@ -164,7 +164,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 'B', "noboot", NULL, G_TYPE_BOOL },
|
{ 'B', "noboot", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-bB] prov ..."
|
NULL, "[-bB] prov ..."
|
||||||
},
|
},
|
||||||
{ "setkey", G_FLAG_VERBOSE, eli_main,
|
{ "setkey", G_FLAG_VERBOSE, eli_main,
|
||||||
{
|
{
|
||||||
@ -176,7 +176,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 'P', "nonewpassphrase", NULL, G_TYPE_BOOL },
|
{ 'P', "nonewpassphrase", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-pPv] [-n keyno] [-i iterations] [-k keyfile] [-K newkeyfile] prov"
|
NULL, "[-pPv] [-n keyno] [-i iterations] [-k keyfile] [-K newkeyfile] prov"
|
||||||
},
|
},
|
||||||
{ "delkey", G_FLAG_VERBOSE, eli_main,
|
{ "delkey", G_FLAG_VERBOSE, eli_main,
|
||||||
{
|
{
|
||||||
@ -185,25 +185,25 @@ struct g_command class_commands[] = {
|
|||||||
{ 'n', "keyno", &keyno, G_TYPE_NUMBER },
|
{ 'n', "keyno", &keyno, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-afv] [-n keyno] prov"
|
NULL, "[-afv] [-n keyno] prov"
|
||||||
},
|
},
|
||||||
{ "kill", G_FLAG_VERBOSE, eli_main,
|
{ "kill", G_FLAG_VERBOSE, eli_main,
|
||||||
{
|
{
|
||||||
{ 'a', "all", NULL, G_TYPE_BOOL },
|
{ 'a', "all", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-av] [prov ...]"
|
NULL, "[-av] [prov ...]"
|
||||||
},
|
},
|
||||||
{ "backup", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS,
|
{ "backup", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov file"
|
"[-v] prov file"
|
||||||
},
|
},
|
||||||
{ "restore", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS,
|
{ "restore", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] file prov"
|
"[-v] file prov"
|
||||||
},
|
},
|
||||||
{ "clear", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
{ "dump", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS,
|
{ "dump", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
|
@ -55,10 +55,10 @@ static void journal_dump(struct gctl_req *req);
|
|||||||
static void journal_label(struct gctl_req *req);
|
static void journal_label(struct gctl_req *req);
|
||||||
|
|
||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{ "clear", G_FLAG_VERBOSE, journal_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, journal_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
{ "dump", 0, journal_main, G_NULL_OPTS,
|
{ "dump", 0, journal_main, G_NULL_OPTS, NULL,
|
||||||
"prov ..."
|
"prov ..."
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE, journal_main,
|
{ "label", G_FLAG_VERBOSE, journal_main,
|
||||||
@ -69,16 +69,16 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "jsize", &default_jsize, G_TYPE_NUMBER },
|
{ 's', "jsize", &default_jsize, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-cfhv] [-s jsize] dataprov [jprov]"
|
NULL, "[-cfhv] [-s jsize] dataprov [jprov]"
|
||||||
},
|
},
|
||||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
{ "sync", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
{ "sync", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
||||||
"[-v]"
|
"[-v]"
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
|
@ -50,31 +50,31 @@ static void label_dump(struct gctl_req *req);
|
|||||||
static void label_label(struct gctl_req *req);
|
static void label_label(struct gctl_req *req);
|
||||||
|
|
||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{ "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] dev ..."
|
"[-v] dev ..."
|
||||||
},
|
},
|
||||||
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS,
|
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS,
|
||||||
"[-v] name dev"
|
NULL, "[-v] name dev"
|
||||||
},
|
},
|
||||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
{ "dump", 0, label_main, G_NULL_OPTS,
|
{ "dump", 0, label_main, G_NULL_OPTS, NULL,
|
||||||
"dev ..."
|
"dev ..."
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, label_main, G_NULL_OPTS,
|
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, label_main, G_NULL_OPTS,
|
||||||
"[-v] name dev"
|
NULL, "[-v] name dev"
|
||||||
},
|
},
|
||||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
@ -56,10 +56,10 @@ static void mirror_dump(struct gctl_req *req);
|
|||||||
static void mirror_label(struct gctl_req *req);
|
static void mirror_label(struct gctl_req *req);
|
||||||
|
|
||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{ "activate", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS,
|
{ "activate", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] name prov ..."
|
"[-v] name prov ..."
|
||||||
},
|
},
|
||||||
{ "clear", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
{ "configure", G_FLAG_VERBOSE, NULL,
|
{ "configure", G_FLAG_VERBOSE, NULL,
|
||||||
@ -74,15 +74,15 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "slice", &configure_slice, G_TYPE_NUMBER },
|
{ 's', "slice", &configure_slice, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-adfFhnv] [-b balance] [-s slice] name"
|
NULL, "[-adfFhnv] [-b balance] [-s slice] name"
|
||||||
},
|
},
|
||||||
{ "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
{ "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
||||||
"[-v] name prov ..."
|
"[-v] name prov ..."
|
||||||
},
|
},
|
||||||
{ "dump", 0, mirror_main, G_NULL_OPTS,
|
{ "dump", 0, mirror_main, G_NULL_OPTS, NULL,
|
||||||
"prov ..."
|
"prov ..."
|
||||||
},
|
},
|
||||||
{ "forget", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
{ "forget", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
||||||
"name ..."
|
"name ..."
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE, mirror_main,
|
{ "label", G_FLAG_VERBOSE, mirror_main,
|
||||||
@ -94,7 +94,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "slice", &label_slice, G_TYPE_NUMBER },
|
{ 's', "slice", &label_slice, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-Fhnv] [-b balance] [-s slice] name prov ..."
|
NULL, "[-Fhnv] [-b balance] [-s slice] name prov ..."
|
||||||
},
|
},
|
||||||
{ "insert", G_FLAG_VERBOSE, NULL,
|
{ "insert", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
@ -103,12 +103,12 @@ struct g_command class_commands[] = {
|
|||||||
{ 'p', "priority", &insert_priority, G_TYPE_NUMBER },
|
{ 'p', "priority", &insert_priority, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-hiv] [-p priority] name prov ..."
|
NULL, "[-hiv] [-p priority] name prov ..."
|
||||||
},
|
},
|
||||||
{ "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
{ "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
||||||
"[-v] name prov ..."
|
"[-v] name prov ..."
|
||||||
},
|
},
|
||||||
{ "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
{ "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
||||||
"[-v] name prov ..."
|
"[-v] name prov ..."
|
||||||
},
|
},
|
||||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||||
@ -116,7 +116,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
@ -52,11 +52,11 @@ static void mp_clear(struct gctl_req *);
|
|||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{
|
{
|
||||||
"label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS,
|
"label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS,
|
||||||
"[-v] name prov ..."
|
NULL, "[-v] name prov ..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS,
|
"clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS,
|
||||||
"[-v] prov ..."
|
NULL, "[-v] prov ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
@ -56,8 +56,8 @@ struct g_command class_commands[] = {
|
|||||||
{ 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER },
|
{ 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-v] [-e error] [-o offset] [-r rfailprob] [-s size] [-S secsize] "
|
NULL, "[-v] [-e error] [-o offset] [-r rfailprob] [-s size] "
|
||||||
"[-w wfailprob] dev ..."
|
"[-S secsize] [-w wfailprob] dev ..."
|
||||||
},
|
},
|
||||||
{ "configure", G_FLAG_VERBOSE, NULL,
|
{ "configure", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
@ -66,16 +66,16 @@ struct g_command class_commands[] = {
|
|||||||
{ 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER },
|
{ 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..."
|
NULL, "[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..."
|
||||||
},
|
},
|
||||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] prov ..."
|
NULL, "[-fv] prov ..."
|
||||||
},
|
},
|
||||||
{ "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
{ "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
|
9
sbin/geom/class/part/Makefile
Normal file
9
sbin/geom/class/part/Makefile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
.PATH: ${.CURDIR}/../../misc
|
||||||
|
|
||||||
|
CLASS= part
|
||||||
|
|
||||||
|
WARNS?= 4
|
||||||
|
|
||||||
|
.include <bsd.lib.mk>
|
91
sbin/geom/class/part/geom_part.c
Normal file
91
sbin/geom/class/part/geom_part.c
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 2007 Marcel Moolenaar
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <readpassphrase.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <libgeom.h>
|
||||||
|
#include <paths.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "core/geom.h"
|
||||||
|
#include "misc/subr.h"
|
||||||
|
|
||||||
|
uint32_t lib_version = G_LIB_VERSION;
|
||||||
|
uint32_t version = 0;
|
||||||
|
|
||||||
|
static char optional[] = "";
|
||||||
|
static char flags[] = "C";
|
||||||
|
|
||||||
|
struct g_command class_commands[] = {
|
||||||
|
{ "add", 0, NULL, {
|
||||||
|
{ 'b', "start", NULL, G_TYPE_STRING },
|
||||||
|
{ 's', "size", NULL, G_TYPE_STRING },
|
||||||
|
{ 't', "type", NULL, G_TYPE_STRING },
|
||||||
|
{ 'i', "index", optional, G_TYPE_STRING },
|
||||||
|
{ 'l', "label", optional, G_TYPE_STRING },
|
||||||
|
{ 'f', "flags", flags, G_TYPE_STRING },
|
||||||
|
G_OPT_SENTINEL },
|
||||||
|
"geom", NULL,
|
||||||
|
},
|
||||||
|
{ "commit", 0, NULL, G_NULL_OPTS, "geom", NULL },
|
||||||
|
{ "create", 0, NULL, {
|
||||||
|
{ 's', "scheme", NULL, G_TYPE_STRING },
|
||||||
|
{ 'n', "entries", optional, G_TYPE_STRING },
|
||||||
|
{ 'f', "flags", flags, G_TYPE_STRING },
|
||||||
|
G_OPT_SENTINEL },
|
||||||
|
"provider", NULL
|
||||||
|
},
|
||||||
|
{ "delete", 0, NULL, {
|
||||||
|
{ 'i', "index", NULL, G_TYPE_STRING },
|
||||||
|
{ 'f', "flags", flags, G_TYPE_STRING },
|
||||||
|
G_OPT_SENTINEL },
|
||||||
|
"geom", NULL
|
||||||
|
},
|
||||||
|
{ "destroy", 0, NULL, {
|
||||||
|
{ 'f', "flags", flags, G_TYPE_STRING },
|
||||||
|
G_OPT_SENTINEL },
|
||||||
|
"geom", NULL },
|
||||||
|
{ "modify", 0, NULL, {
|
||||||
|
{ 'i', "index", NULL, G_TYPE_STRING },
|
||||||
|
{ 'l', "label", optional, G_TYPE_STRING },
|
||||||
|
{ 't', "type", optional, G_TYPE_STRING },
|
||||||
|
{ 'f', "flags", flags, G_TYPE_STRING },
|
||||||
|
G_OPT_SENTINEL },
|
||||||
|
"geom", NULL
|
||||||
|
},
|
||||||
|
{ "undo", 0, NULL, G_NULL_OPTS, "geom", NULL },
|
||||||
|
G_CMD_SENTINEL
|
||||||
|
};
|
308
sbin/geom/class/part/gpart.8
Normal file
308
sbin/geom/class/part/gpart.8
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
.\" Copyright (c) 2007 Marcel Moolenaar
|
||||||
|
.\" All rights reserved.
|
||||||
|
.\"
|
||||||
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
|
.\" modification, are permitted provided that the following conditions
|
||||||
|
.\" are met:
|
||||||
|
.\" 1. Redistributions of source code must retain the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer.
|
||||||
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer in the
|
||||||
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
|
.\"
|
||||||
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||||
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
.\" SUCH DAMAGE.
|
||||||
|
.\"
|
||||||
|
.\" $FreeBSD$
|
||||||
|
.\"
|
||||||
|
.Dd May 15, 2007
|
||||||
|
.Dt GPART 8
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm gpart
|
||||||
|
.Nd "control utility for the disk partitioning GEOM class"
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
To add support for the disk partitioning GEOM class,
|
||||||
|
place one or more of the following
|
||||||
|
lines in your kernel configuration file:
|
||||||
|
.Bd -ragged -offset indent
|
||||||
|
.Cd "options GEOM_PART_APM"
|
||||||
|
.Cd "options GEOM_PART_GPT"
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
|
The GEOM_PART_APM option adds support for the Apple Partition Map (APM)
|
||||||
|
found on Apple Macintosh computers, and the GEOM_PART_GPT option adds
|
||||||
|
support for the GUID Partition Table (GPT) found on Intel Itanium
|
||||||
|
computers and Intel-based Macintosh computers.
|
||||||
|
.Pp
|
||||||
|
Usage of the
|
||||||
|
.Xr gpart 8
|
||||||
|
utility:
|
||||||
|
.Pp
|
||||||
|
.\" ==== ADD ====
|
||||||
|
.Nm
|
||||||
|
.Cm add
|
||||||
|
.Fl b Ar start
|
||||||
|
.Fl s Ar size
|
||||||
|
.Fl t Ar type
|
||||||
|
.Op Fl i Ar index
|
||||||
|
.Op Fl l Ar label
|
||||||
|
.Op Fl f Ar flags
|
||||||
|
.Ar geom
|
||||||
|
.\" ==== COMMIT ====
|
||||||
|
.Nm
|
||||||
|
.Cm commit
|
||||||
|
.Ar geom
|
||||||
|
.\" ==== CREATE ====
|
||||||
|
.Nm
|
||||||
|
.Cm create
|
||||||
|
.Fl s Ar scheme
|
||||||
|
.Op Fl n Ar entries
|
||||||
|
.Op Fl f Ar flags
|
||||||
|
.Ar provider
|
||||||
|
.\" ==== DELETE ====
|
||||||
|
.Nm
|
||||||
|
.Cm delete
|
||||||
|
.Fl i Ar index
|
||||||
|
.Op Fl f Ar flags
|
||||||
|
.Ar geom
|
||||||
|
.\" ==== DESTROY ====
|
||||||
|
.Nm
|
||||||
|
.Cm destroy
|
||||||
|
.Op Fl f Ar flags
|
||||||
|
.Ar geom
|
||||||
|
.\" ==== MODIFY ====
|
||||||
|
.Nm
|
||||||
|
.Cm modify
|
||||||
|
.Fl i Ar index
|
||||||
|
.Op Fl l Ar label
|
||||||
|
.Op Fl t Ar type
|
||||||
|
.Op Fl f Ar flags
|
||||||
|
.Ar geom
|
||||||
|
.\" ==== UNDO ====
|
||||||
|
.Nm
|
||||||
|
.Cm undo
|
||||||
|
.Ar geom
|
||||||
|
.\"
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
utility is used to partition GEOM providers, normally disks.
|
||||||
|
The first argument of which is the action to be taken:
|
||||||
|
.Bl -tag -width ".Cm wwwwwww"
|
||||||
|
.\" ==== ADD ====
|
||||||
|
.It Cm add
|
||||||
|
Add a new partition to the partitioning scheme given by
|
||||||
|
.Ar geom .
|
||||||
|
The partition begins on the logical block address given by the
|
||||||
|
.Fl b Ar start
|
||||||
|
option.
|
||||||
|
Its size is expressed in logical block numbers and given by the
|
||||||
|
.Fl s Ar size
|
||||||
|
option.
|
||||||
|
The type of the partition is given by the
|
||||||
|
.Fl t Ar type
|
||||||
|
option.
|
||||||
|
Partition types are discussed in the section entitled "Partition Types".
|
||||||
|
.Pp
|
||||||
|
Addition options include:
|
||||||
|
.Bl -tag -width ".Fl w Ar wwwwwww"
|
||||||
|
.It Fl i Ar index
|
||||||
|
The index in the partition table at which the new partition is to be
|
||||||
|
placed. The index determines the name of the device special file used
|
||||||
|
to represent the partition.
|
||||||
|
.It Fl l Ar label
|
||||||
|
The label attached to the partition.
|
||||||
|
This option is only valid when used on partitioning schemes that support
|
||||||
|
partition labels.
|
||||||
|
.It Fl f Ar flags
|
||||||
|
Additional operational flags.
|
||||||
|
See the section entitled "Operational flags" below for a discussion
|
||||||
|
about its use.
|
||||||
|
.El
|
||||||
|
.\" ==== COMMIT ====
|
||||||
|
.It Cm commit
|
||||||
|
Commit any pending changes for geom
|
||||||
|
.Ar geom .
|
||||||
|
All actions are being committed by default and will not result in
|
||||||
|
pending changes.
|
||||||
|
Actions can be modified with the
|
||||||
|
.Fl f Ar flags
|
||||||
|
option so that they are not being committed by default.
|
||||||
|
As such, they become pending.
|
||||||
|
Pending changes are reflected by the geom and the
|
||||||
|
.Nm
|
||||||
|
utility, but they are not actually written to disk.
|
||||||
|
The
|
||||||
|
.Cm commit
|
||||||
|
action will write any and all pending changes to disk.
|
||||||
|
.\" ==== CREATE ====
|
||||||
|
.It Cm create
|
||||||
|
Create a new partitioning scheme on a provider given by
|
||||||
|
.Ar provider .
|
||||||
|
The
|
||||||
|
.Fl s Ar scheme
|
||||||
|
option determines the scheme to use.
|
||||||
|
The kernel needs to have support for a particular scheme before
|
||||||
|
that scheme can be used to partition a disk.
|
||||||
|
.Pp
|
||||||
|
Addition options include:
|
||||||
|
.Bl -tag -width ".Fl w Ar wwwwwww"
|
||||||
|
.It Fl n Ar entries
|
||||||
|
The number of entries in the partition table.
|
||||||
|
Every partitioning scheme has a minimum and a maximum number of entries
|
||||||
|
and this option allows tables to be created with the number of entries
|
||||||
|
that lies anywhere between the minimum and the maximum.
|
||||||
|
Some schemes have a maximum equal to the minimum and some schemes have
|
||||||
|
a maximum large enough to be considered unlimited.
|
||||||
|
By default, partition tables are created with the minimum number of
|
||||||
|
entries.
|
||||||
|
.It Fl f Ar flags
|
||||||
|
Additional operational flags.
|
||||||
|
See the section entitled "Operational flags" below for a discussion
|
||||||
|
about its use.
|
||||||
|
.El
|
||||||
|
.\" ==== DELETE ====
|
||||||
|
.It Cm delete
|
||||||
|
Delete a partition from geom
|
||||||
|
.Ar geom
|
||||||
|
and further identified by the
|
||||||
|
.Fl i Ar index
|
||||||
|
option.
|
||||||
|
The partition cannot be actively used by the kernel.
|
||||||
|
.Pp
|
||||||
|
Addition options include:
|
||||||
|
.Bl -tag -width ".Fl w Ar wwwwwww"
|
||||||
|
.It Fl f Ar flags
|
||||||
|
Additional operational flags.
|
||||||
|
See the section entitled "Operational flags" below for a discussion
|
||||||
|
about its use.
|
||||||
|
.El
|
||||||
|
.\" ==== DESTROY ====
|
||||||
|
.It Cm destroy
|
||||||
|
Destroy the partitioning scheme as implemented by geom
|
||||||
|
.Ar geom .
|
||||||
|
.Pp
|
||||||
|
Addition options include:
|
||||||
|
.Bl -tag -width ".Fl w Ar wwwwwww"
|
||||||
|
.It Fl f Ar flags
|
||||||
|
Additional operational flags.
|
||||||
|
See the section entitled "Operational flags" below for a discussion
|
||||||
|
about its use.
|
||||||
|
.El
|
||||||
|
.\" ==== MODIFY ====
|
||||||
|
.It Cm modify
|
||||||
|
Modify a partition from geom
|
||||||
|
.Ar geom
|
||||||
|
and further identified by the
|
||||||
|
.Fl i Ar index
|
||||||
|
option.
|
||||||
|
Only the the type and/or label of the partition can be modified.
|
||||||
|
To change the type of a partition, specify the new type with the
|
||||||
|
.Fl t Ar type
|
||||||
|
option.
|
||||||
|
To change the label of a partition, specify the new label with the
|
||||||
|
.Fl l Ar label
|
||||||
|
option.
|
||||||
|
Not all partitioning schemes support labels and it is invalid to
|
||||||
|
try to change a partition label in such cases.
|
||||||
|
.Pp
|
||||||
|
Addition options include:
|
||||||
|
.Bl -tag -width ".Fl w Ar wwwwwww"
|
||||||
|
.It Fl f Ar flags
|
||||||
|
Additional operational flags.
|
||||||
|
See the section entitled "Operational flags" below for a discussion
|
||||||
|
about its use.
|
||||||
|
.El
|
||||||
|
.\" ==== UNDO ====
|
||||||
|
.It Cm undo
|
||||||
|
Revert any pending changes.
|
||||||
|
This action is the opposite of the
|
||||||
|
.Cm commit
|
||||||
|
action and can be used to undo any changes that have not been committed.
|
||||||
|
.El
|
||||||
|
.Sh PARTITION TYPES
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
utility uses symbolic names for common partition types to avoid that the
|
||||||
|
user needs to know what the partitioning scheme in question is and what
|
||||||
|
the actual number or identification needs to be used for a particular
|
||||||
|
type.
|
||||||
|
the
|
||||||
|
.Nm
|
||||||
|
utility also allows the user to specify scheme-specific partition types
|
||||||
|
for partition types that don't have symbol names.
|
||||||
|
The symbolic names currently understood are:
|
||||||
|
.Bl -tag -width "wwwwwwwwwwwww"
|
||||||
|
.It efi
|
||||||
|
The system partition for computers that use the Extensible Firmware
|
||||||
|
Interface (EFI).
|
||||||
|
In such cases, the GPT partitioning scheme is being used and the
|
||||||
|
actual partition type for the system partition can also be specified as
|
||||||
|
"!c12a7328-f81f-11d2-ba4b-00a0c93ec93ab".
|
||||||
|
.It freebsd
|
||||||
|
A FreeBSD partition that uses the BSD disklabel to sub-divide the
|
||||||
|
partition into file systems.
|
||||||
|
This is a legacy partition type and should not be used for the APM
|
||||||
|
or GPT schemes.
|
||||||
|
The scheme-specific types are "!FreeBSD" for APM, and
|
||||||
|
"!516e7cb4-6ecf-11d6-8ff8-00022d09712b" for GPT.
|
||||||
|
.It freebsd-swap
|
||||||
|
A FreeBSD partition dedicated to swap space.
|
||||||
|
The scheme-specific types are "!FreeBSD-swap" for APM, and
|
||||||
|
"!516e7cb5-6ecf-11d6-8ff8-00022d09712b" for GPT.
|
||||||
|
.It freebsd-ufs
|
||||||
|
A FreeBSD partition that contains a UFS or UFS2 file system.
|
||||||
|
the scheme-specific types are "!FreeBSD-UFS" for APM, and
|
||||||
|
"!516e7cb6-6ecf-11d6-8ff8-00022d09712b" for GPT.
|
||||||
|
.It freebsd-vinum
|
||||||
|
A FreeBSD partition that contains a Vinum volume.
|
||||||
|
The scheme-specific types are "!FreeBSD-Vinum" for APM, and
|
||||||
|
"!516e7cb8-6ecf-11d6-8ff8-00022d09712b" for GPT.
|
||||||
|
.It mbr
|
||||||
|
A partition that is sub-partitioned by a master boot record (MBR).
|
||||||
|
This type is known as "!024dee41-33e7-11d3-9d69-0008c781f39f" by GPT.
|
||||||
|
.El
|
||||||
|
.Sh OPERATIONAL FLAGS
|
||||||
|
Actions other than the
|
||||||
|
.Cm commit
|
||||||
|
and
|
||||||
|
.Cm undo
|
||||||
|
actions take an optional
|
||||||
|
.Fl f Ar flags
|
||||||
|
option.
|
||||||
|
This option is used to specify action-specific operational flags.
|
||||||
|
By default, the
|
||||||
|
.Nm
|
||||||
|
utility defines the 'C' flag so that the action is immediately
|
||||||
|
committed.
|
||||||
|
The user can specify
|
||||||
|
.Fl f Ar x
|
||||||
|
to have the action result in a pending change that can later, with
|
||||||
|
other pending changes, be committed as a single compound change with
|
||||||
|
the
|
||||||
|
.Cm commit
|
||||||
|
action or reverted with the
|
||||||
|
.Cm undo
|
||||||
|
action.
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
Exit status is 0 on success, and 1 if the command fails.
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr geom 4 ,
|
||||||
|
.Xr geom 8 ,
|
||||||
|
.Sh HISTORY
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
utility appeared in
|
||||||
|
.Fx 7.0 .
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Marcel Moolenaar Aq marcel@FreeBSD.org
|
@ -51,7 +51,7 @@ static void raid3_dump(struct gctl_req *req);
|
|||||||
static void raid3_label(struct gctl_req *req);
|
static void raid3_label(struct gctl_req *req);
|
||||||
|
|
||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{ "clear", G_FLAG_VERBOSE, raid3_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, raid3_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
{ "configure", G_FLAG_VERBOSE, NULL,
|
{ "configure", G_FLAG_VERBOSE, NULL,
|
||||||
@ -68,9 +68,9 @@ struct g_command class_commands[] = {
|
|||||||
{ 'W', "noverify", NULL, G_TYPE_BOOL },
|
{ 'W', "noverify", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-adfFhnrRvwW] name"
|
NULL, "[-adfFhnrRvwW] name"
|
||||||
},
|
},
|
||||||
{ "dump", 0, raid3_main, G_NULL_OPTS,
|
{ "dump", 0, raid3_main, G_NULL_OPTS, NULL,
|
||||||
"prov ..."
|
"prov ..."
|
||||||
},
|
},
|
||||||
{ "insert", G_FLAG_VERBOSE, NULL,
|
{ "insert", G_FLAG_VERBOSE, NULL,
|
||||||
@ -79,7 +79,7 @@ struct g_command class_commands[] = {
|
|||||||
{ 'n', "number", NULL, G_TYPE_NUMBER },
|
{ 'n', "number", NULL, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-hv] <-n number> name prov"
|
NULL, "[-hv] <-n number> name prov"
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE, raid3_main,
|
{ "label", G_FLAG_VERBOSE, raid3_main,
|
||||||
{
|
{
|
||||||
@ -90,9 +90,9 @@ struct g_command class_commands[] = {
|
|||||||
{ 'w', "verify", NULL, G_TYPE_BOOL },
|
{ 'w', "verify", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-hFnrvw] name prov prov prov ..."
|
NULL, "[-hFnrvw] name prov prov prov ..."
|
||||||
},
|
},
|
||||||
{ "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
|
{ "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
||||||
"[-v] name prov"
|
"[-v] name prov"
|
||||||
},
|
},
|
||||||
{ "remove", G_FLAG_VERBOSE, NULL,
|
{ "remove", G_FLAG_VERBOSE, NULL,
|
||||||
@ -100,14 +100,14 @@ struct g_command class_commands[] = {
|
|||||||
{ 'n', "number", NULL, G_TYPE_NUMBER },
|
{ 'n', "number", NULL, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-v] <-n number> name"
|
NULL, "[-v] <-n number> name"
|
||||||
},
|
},
|
||||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
@ -52,10 +52,10 @@ static void shsec_dump(struct gctl_req *req);
|
|||||||
static void shsec_label(struct gctl_req *req);
|
static void shsec_label(struct gctl_req *req);
|
||||||
|
|
||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{ "clear", G_FLAG_VERBOSE, shsec_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, shsec_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
{ "dump", 0, shsec_main, G_NULL_OPTS,
|
{ "dump", 0, shsec_main, G_NULL_OPTS, NULL,
|
||||||
"prov ..."
|
"prov ..."
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, shsec_main,
|
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, shsec_main,
|
||||||
@ -63,14 +63,14 @@ struct g_command class_commands[] = {
|
|||||||
{ 'h', "hardcode", NULL, G_TYPE_BOOL },
|
{ 'h', "hardcode", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-hv] name prov prov ..."
|
NULL, "[-hv] name prov prov ..."
|
||||||
},
|
},
|
||||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
@ -54,7 +54,7 @@ static void stripe_dump(struct gctl_req *req);
|
|||||||
static void stripe_label(struct gctl_req *req);
|
static void stripe_label(struct gctl_req *req);
|
||||||
|
|
||||||
struct g_command class_commands[] = {
|
struct g_command class_commands[] = {
|
||||||
{ "clear", G_FLAG_VERBOSE, stripe_main, G_NULL_OPTS,
|
{ "clear", G_FLAG_VERBOSE, stripe_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] prov ..."
|
"[-v] prov ..."
|
||||||
},
|
},
|
||||||
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
|
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
|
||||||
@ -62,16 +62,16 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "stripesize", &default_stripesize, G_TYPE_NUMBER },
|
{ 's', "stripesize", &default_stripesize, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-hv] [-s stripesize] name prov prov ..."
|
NULL, "[-hv] [-s stripesize] name prov prov ..."
|
||||||
},
|
},
|
||||||
{ "destroy", G_FLAG_VERBOSE, NULL,
|
{ "destroy", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
{ "dump", 0, stripe_main, G_NULL_OPTS,
|
{ "dump", 0, stripe_main, G_NULL_OPTS, NULL,
|
||||||
"dump prov ..."
|
"dump prov ..."
|
||||||
},
|
},
|
||||||
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, stripe_main,
|
{ "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, stripe_main,
|
||||||
@ -80,14 +80,14 @@ struct g_command class_commands[] = {
|
|||||||
{ 's', "stripesize", &default_stripesize, G_TYPE_NUMBER },
|
{ 's', "stripesize", &default_stripesize, G_TYPE_NUMBER },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-hv] [-s stripesize] name prov prov ..."
|
NULL, "[-hv] [-s stripesize] name prov prov ..."
|
||||||
},
|
},
|
||||||
{ "stop", G_FLAG_VERBOSE, NULL,
|
{ "stop", G_FLAG_VERBOSE, NULL,
|
||||||
{
|
{
|
||||||
{ 'f', "force", NULL, G_TYPE_BOOL },
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-fv] name ..."
|
NULL, "[-fv] name ..."
|
||||||
},
|
},
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
@ -69,8 +69,8 @@ static void std_load(struct gctl_req *req, unsigned flags);
|
|||||||
static void std_unload(struct gctl_req *req, unsigned flags);
|
static void std_unload(struct gctl_req *req, unsigned flags);
|
||||||
|
|
||||||
struct g_command std_commands[] = {
|
struct g_command std_commands[] = {
|
||||||
{ "help", 0, std_help, G_NULL_OPTS, NULL },
|
{ "help", 0, std_help, G_NULL_OPTS, NULL, NULL },
|
||||||
{ "list", 0, std_list, G_NULL_OPTS,
|
{ "list", 0, std_list, G_NULL_OPTS, NULL,
|
||||||
"[name ...]"
|
"[name ...]"
|
||||||
},
|
},
|
||||||
{ "status", 0, std_status,
|
{ "status", 0, std_status,
|
||||||
@ -78,10 +78,11 @@ struct g_command std_commands[] = {
|
|||||||
{ 's', "script", NULL, G_TYPE_BOOL },
|
{ 's', "script", NULL, G_TYPE_BOOL },
|
||||||
G_OPT_SENTINEL
|
G_OPT_SENTINEL
|
||||||
},
|
},
|
||||||
"[-s] [name ...]"
|
NULL, "[-s] [name ...]"
|
||||||
},
|
},
|
||||||
{ "load", G_FLAG_VERBOSE | G_FLAG_LOADKLD, std_load, G_NULL_OPTS, NULL },
|
{ "load", G_FLAG_VERBOSE | G_FLAG_LOADKLD, std_load, G_NULL_OPTS,
|
||||||
{ "unload", G_FLAG_VERBOSE, std_unload, G_NULL_OPTS, NULL },
|
NULL, NULL },
|
||||||
|
{ "unload", G_FLAG_VERBOSE, std_unload, G_NULL_OPTS, NULL, NULL },
|
||||||
G_CMD_SENTINEL
|
G_CMD_SENTINEL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,6 +113,8 @@ usage_command(struct g_command *cmd, const char *prefix)
|
|||||||
if (opt->go_val != NULL || G_OPT_TYPE(opt) == G_TYPE_BOOL)
|
if (opt->go_val != NULL || G_OPT_TYPE(opt) == G_TYPE_BOOL)
|
||||||
fprintf(stderr, "]");
|
fprintf(stderr, "]");
|
||||||
}
|
}
|
||||||
|
if (cmd->gc_argname)
|
||||||
|
fprintf(stderr, " %s", cmd->gc_argname);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,23 +330,31 @@ parse_arguments(struct g_command *cmd, struct gctl_req *req, int *argc,
|
|||||||
gctl_ro_param(req, opt->go_name,
|
gctl_ro_param(req, opt->go_name,
|
||||||
sizeof(intmax_t), opt->go_val);
|
sizeof(intmax_t), opt->go_val);
|
||||||
} else if (G_OPT_TYPE(opt) == G_TYPE_STRING) {
|
} else if (G_OPT_TYPE(opt) == G_TYPE_STRING) {
|
||||||
gctl_ro_param(req, opt->go_name, -1,
|
if (*(char *)opt->go_val != '\0')
|
||||||
opt->go_val);
|
gctl_ro_param(req, opt->go_name,
|
||||||
|
-1, opt->go_val);
|
||||||
} else {
|
} else {
|
||||||
assert(!"Invalid type");
|
assert(!"Invalid type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Add rest of given arguments.
|
|
||||||
*/
|
|
||||||
gctl_ro_param(req, "nargs", sizeof(int), argc);
|
|
||||||
for (i = 0; i < (unsigned)*argc; i++) {
|
|
||||||
char argname[16];
|
|
||||||
|
|
||||||
snprintf(argname, sizeof(argname), "arg%u", i);
|
if (cmd->gc_argname == NULL) {
|
||||||
gctl_ro_param(req, argname, -1, (*argv)[i]);
|
/*
|
||||||
|
* Add rest of given arguments.
|
||||||
|
*/
|
||||||
|
gctl_ro_param(req, "nargs", sizeof(int), argc);
|
||||||
|
for (i = 0; i < (unsigned)*argc; i++) {
|
||||||
|
char argname[16];
|
||||||
|
|
||||||
|
snprintf(argname, sizeof(argname), "arg%u", i);
|
||||||
|
gctl_ro_param(req, argname, -1, (*argv)[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (*argc != 1)
|
||||||
|
usage();
|
||||||
|
gctl_ro_param(req, cmd->gc_argname, -1, (*argv)[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
#define G_OPT_SENTINEL { '\0', NULL, NULL, G_TYPE_NONE }
|
#define G_OPT_SENTINEL { '\0', NULL, NULL, G_TYPE_NONE }
|
||||||
#define G_NULL_OPTS { G_OPT_SENTINEL }
|
#define G_NULL_OPTS { G_OPT_SENTINEL }
|
||||||
#define G_CMD_SENTINEL { NULL, 0, NULL, G_NULL_OPTS, NULL }
|
#define G_CMD_SENTINEL { NULL, 0, NULL, G_NULL_OPTS, NULL, NULL }
|
||||||
|
|
||||||
struct g_option {
|
struct g_option {
|
||||||
char go_char;
|
char go_char;
|
||||||
@ -62,6 +62,7 @@ struct g_command {
|
|||||||
unsigned gc_flags;
|
unsigned gc_flags;
|
||||||
void (*gc_func)(struct gctl_req *, unsigned);
|
void (*gc_func)(struct gctl_req *, unsigned);
|
||||||
struct g_option gc_options[G_OPT_MAX];
|
struct g_option gc_options[G_OPT_MAX];
|
||||||
|
const char *gc_argname;
|
||||||
const char *gc_usage;
|
const char *gc_usage;
|
||||||
};
|
};
|
||||||
#endif /* !_GEOM_H_ */
|
#endif /* !_GEOM_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user