Date: Mon, 13 Sep 2010 13:48:19 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r212554 - in head: sbin/geom/class/cache sbin/geom/class/concat sbin/geom/class/eli sbin/geom/class/journal sbin/geom/class/label sbin/geom/class/mirror sbin/geom/class/mountver sbin/ge... Message-ID: <201009131348.o8DDmJL8004159@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Mon Sep 13 13:48:18 2010 New Revision: 212554 URL: http://svn.freebsd.org/changeset/base/212554 Log: - Remove gc_argname field. It was introduced for gpart(8), but if I understand everything correctly, we don't really need it. - Provide default numeric value as strings. This allows to simplify a lot of code. - Bump version number. Modified: head/sbin/geom/class/cache/geom_cache.c head/sbin/geom/class/concat/geom_concat.c head/sbin/geom/class/eli/geom_eli.c head/sbin/geom/class/journal/geom_journal.c head/sbin/geom/class/label/geom_label.c head/sbin/geom/class/mirror/geom_mirror.c head/sbin/geom/class/mountver/geom_mountver.c head/sbin/geom/class/multipath/geom_multipath.c head/sbin/geom/class/nop/geom_nop.c head/sbin/geom/class/part/geom_part.c head/sbin/geom/class/raid3/geom_raid3.c head/sbin/geom/class/sched/geom_sched.c head/sbin/geom/class/shsec/geom_shsec.c head/sbin/geom/class/stripe/geom_stripe.c head/sbin/geom/class/virstor/geom_virstor.c head/sbin/geom/core/geom.c head/sbin/geom/core/geom.h head/sys/geom/part/g_part.c Modified: head/sbin/geom/class/cache/geom_cache.c ============================================================================== --- head/sbin/geom/class/cache/geom_cache.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/cache/geom_cache.c Mon Sep 13 13:48:18 2010 (r212554) @@ -42,10 +42,8 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_CACHE_VERSION; -static intmax_t blocksize_label = 65536; -static intmax_t size_label = 100; -static intmax_t blocksize_configure = 0; -static intmax_t size_configure = 0; +#define GCACHE_BLOCKSIZE "65536" +#define GCACHE_SIZE "100" static void cache_main(struct gctl_req *req, unsigned flags); static void cache_clear(struct gctl_req *req); @@ -53,44 +51,44 @@ static void cache_dump(struct gctl_req * static void cache_label(struct gctl_req *req); struct g_command class_commands[] = { - { "clear", G_FLAG_VERBOSE, cache_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, cache_main, G_NULL_OPTS, "[-v] prov ..." }, { "configure", G_FLAG_VERBOSE, NULL, { - { 'b', "blocksize", &blocksize_configure, G_TYPE_NUMBER }, - { 's', "size", &size_configure, G_TYPE_NUMBER }, + { 'b', "blocksize", "0", G_TYPE_NUMBER }, + { 's', "size", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] [-b blocksize] [-s size] name" + "[-v] [-b blocksize] [-s size] name" }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 'b', "blocksize", &blocksize_label, G_TYPE_NUMBER }, - { 's', "size", &size_label, G_TYPE_NUMBER }, + { 'b', "blocksize", GCACHE_BLOCKSIZE, G_TYPE_NUMBER }, + { 's', "size", GCACHE_SIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] [-b blocksize] [-s size] name prov" + "[-v] [-b blocksize] [-s size] name prov" }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, - { "dump", 0, cache_main, G_NULL_OPTS, NULL, + { "dump", 0, cache_main, G_NULL_OPTS, "prov ..." }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, cache_main, { - { 'b', "blocksize", &blocksize_label, G_TYPE_NUMBER }, - { 's', "size", &size_label, G_TYPE_NUMBER }, + { 'b', "blocksize", GCACHE_BLOCKSIZE, G_TYPE_NUMBER }, + { 's', "size", GCACHE_SIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] [-b blocksize] [-s size] name prov" + "[-v] [-b blocksize] [-s size] name prov" }, - { "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name ..." }, { "stop", G_FLAG_VERBOSE, NULL, @@ -98,7 +96,7 @@ struct g_command class_commands[] = { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; Modified: head/sbin/geom/class/concat/geom_concat.c ============================================================================== --- head/sbin/geom/class/concat/geom_concat.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/concat/geom_concat.c Mon Sep 13 13:48:18 2010 (r212554) @@ -51,20 +51,20 @@ static void concat_dump(struct gctl_req static void concat_label(struct gctl_req *req); struct g_command class_commands[] = { - { "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, concat_main, G_NULL_OPTS, "[-v] prov ..." }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS, - NULL, "[-v] name prov ..." + "[-v] name prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, - { "dump", 0, concat_main, G_NULL_OPTS, NULL, + { "dump", 0, concat_main, G_NULL_OPTS, "prov ..." }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, concat_main, @@ -72,14 +72,14 @@ struct g_command class_commands[] = { { 'h', "hardcode", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-hv] name prov ..." + "[-hv] name prov ..." }, { "stop", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/eli/geom_eli.c Mon Sep 13 13:48:18 2010 (r212554) @@ -57,11 +57,6 @@ uint32_t version = G_ELI_VERSION; #define GELI_BACKUP_DIR "/var/backups/" #define GELI_ENC_ALGO "aes" -static intmax_t keylen = 0; -static intmax_t keyno = -1; -static intmax_t iterations = -1; -static intmax_t sectorsize = 0; - static void eli_main(struct gctl_req *req, unsigned flags); static void eli_init(struct gctl_req *req); static void eli_attach(struct gctl_req *req); @@ -102,14 +97,14 @@ struct g_command class_commands[] = { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, { 'K', "newkeyfile", "", G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov" + "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { @@ -117,14 +112,14 @@ struct g_command class_commands[] = { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, { 'K', "newkeyfile", "", G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "- an alias for 'init'" + "- an alias for 'init'" }, { "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main, { @@ -134,7 +129,7 @@ struct g_command class_commands[] = { { 'r', "readonly", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-dprv] [-k keyfile] prov" + "[-dprv] [-k keyfile] prov" }, { "detach", 0, NULL, { @@ -142,7 +137,7 @@ struct g_command class_commands[] = { { 'l', "last", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fl] prov ..." + "[-fl] prov ..." }, { "stop", 0, NULL, { @@ -150,18 +145,18 @@ struct g_command class_commands[] = { { 'l', "last", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "- an alias for 'detach'" + "- an alias for 'detach'" }, { "onetime", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { { 'a', "aalgo", "", G_TYPE_STRING }, { 'd', "detach", NULL, G_TYPE_BOOL }, { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" + "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" }, { "configure", G_FLAG_VERBOSE, eli_main, { @@ -169,46 +164,46 @@ struct g_command class_commands[] = { { 'B', "noboot", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-bB] prov ..." + "[-bB] prov ..." }, { "setkey", G_FLAG_VERBOSE, eli_main, { - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, { 'k', "keyfile", "", G_TYPE_STRING }, { 'K', "newkeyfile", "", G_TYPE_STRING }, - { 'n', "keyno", &keyno, G_TYPE_NUMBER }, + { 'n', "keyno", "-1", G_TYPE_NUMBER }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-pPv] [-n keyno] [-i iterations] [-k keyfile] [-K newkeyfile] prov" + "[-pPv] [-n keyno] [-i iterations] [-k keyfile] [-K newkeyfile] prov" }, { "delkey", G_FLAG_VERBOSE, eli_main, { { 'a', "all", NULL, G_TYPE_BOOL }, { 'f', "force", NULL, G_TYPE_BOOL }, - { 'n', "keyno", &keyno, G_TYPE_NUMBER }, + { 'n', "keyno", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-afv] [-n keyno] prov" + "[-afv] [-n keyno] prov" }, { "kill", G_FLAG_VERBOSE, eli_main, { { 'a', "all", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-av] [prov ...]" + "[-av] [prov ...]" }, - { "backup", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL, + { "backup", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, "[-v] prov file" }, - { "restore", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL, + { "restore", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, "[-v] file prov" }, - { "clear", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, "[-v] prov ..." }, - { "dump", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL, + { "dump", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, "[-v] prov ..." }, G_CMD_SENTINEL Modified: head/sbin/geom/class/journal/geom_journal.c ============================================================================== --- head/sbin/geom/class/journal/geom_journal.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/journal/geom_journal.c Mon Sep 13 13:48:18 2010 (r212554) @@ -47,18 +47,16 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_JOURNAL_VERSION; -static intmax_t default_jsize = -1; - static void journal_main(struct gctl_req *req, unsigned flags); static void journal_clear(struct gctl_req *req); static void journal_dump(struct gctl_req *req); static void journal_label(struct gctl_req *req); struct g_command class_commands[] = { - { "clear", G_FLAG_VERBOSE, journal_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, journal_main, G_NULL_OPTS, "[-v] prov ..." }, - { "dump", 0, journal_main, G_NULL_OPTS, NULL, + { "dump", 0, journal_main, G_NULL_OPTS, "prov ..." }, { "label", G_FLAG_VERBOSE, journal_main, @@ -66,19 +64,19 @@ struct g_command class_commands[] = { { 'c', "checksum", NULL, G_TYPE_BOOL }, { 'f', "force", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, - { 's', "jsize", &default_jsize, G_TYPE_NUMBER }, + { 's', "jsize", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-cfhv] [-s jsize] dataprov [jprov]" + "[-cfhv] [-s jsize] dataprov [jprov]" }, { "stop", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, - { "sync", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "sync", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v]" }, G_CMD_SENTINEL Modified: head/sbin/geom/class/label/geom_label.c ============================================================================== --- head/sbin/geom/class/label/geom_label.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/label/geom_label.c Mon Sep 13 13:48:18 2010 (r212554) @@ -55,31 +55,31 @@ static void label_dump(struct gctl_req * static void label_label(struct gctl_req *req); struct g_command PUBSYM(class_commands)[] = { - { "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS, "[-v] dev ..." }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, G_NULL_OPTS, - NULL, "[-v] name dev" + "[-v] name dev" }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, - { "dump", 0, label_main, G_NULL_OPTS, NULL, + { "dump", 0, label_main, G_NULL_OPTS, "dev ..." }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, label_main, G_NULL_OPTS, - NULL, "[-v] name dev" + "[-v] name dev" }, { "stop", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; Modified: head/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- head/sbin/geom/class/mirror/geom_mirror.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/mirror/geom_mirror.c Mon Sep 13 13:48:18 2010 (r212554) @@ -44,10 +44,9 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_MIRROR_VERSION; -#define GMIRROR_BALANCE "load" - -static intmax_t label_slice = 4096, configure_slice = -1; -static intmax_t insert_priority = 0, configure_priority = -1; +#define GMIRROR_BALANCE "load" +#define GMIRROR_SLICE "4096" +#define GMIRROR_PRIORITY "0" static void mirror_main(struct gctl_req *req, unsigned flags); static void mirror_activate(struct gctl_req *req); @@ -56,10 +55,10 @@ static void mirror_dump(struct gctl_req static void mirror_label(struct gctl_req *req); struct g_command class_commands[] = { - { "activate", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS, NULL, + { "activate", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS, "[-v] name prov ..." }, - { "clear", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS, "[-v] prov ..." }, { "configure", G_FLAG_VERBOSE, NULL, @@ -71,20 +70,20 @@ struct g_command class_commands[] = { { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, - { 'p', "priority", &configure_priority, G_TYPE_NUMBER }, - { 's', "slice", &configure_slice, G_TYPE_NUMBER }, + { 'p', "priority", "-1", G_TYPE_NUMBER }, + { 's', "slice", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-adfFhnv] [-b balance] [-s slice] name\n" - "[-v] -p priority name prov" + "[-adfFhnv] [-b balance] [-s slice] name\n" + "[-v] -p priority name prov" }, - { "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name prov ..." }, - { "dump", 0, mirror_main, G_NULL_OPTS, NULL, + { "dump", 0, mirror_main, G_NULL_OPTS, "prov ..." }, - { "forget", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "forget", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "name ..." }, { "label", G_FLAG_VERBOSE, mirror_main, @@ -93,24 +92,24 @@ struct g_command class_commands[] = { { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, - { 's', "slice", &label_slice, G_TYPE_NUMBER }, + { 's', "slice", GMIRROR_SLICE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-Fhnv] [-b balance] [-s slice] name prov ..." + "[-Fhnv] [-b balance] [-s slice] name prov ..." }, { "insert", G_FLAG_VERBOSE, NULL, { { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'i', "inactive", NULL, G_TYPE_BOOL }, - { 'p', "priority", &insert_priority, G_TYPE_NUMBER }, + { 'p', "priority", GMIRROR_PRIORITY, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-hiv] [-p priority] name prov ..." + "[-hiv] [-p priority] name prov ..." }, - { "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name prov ..." }, - { "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name prov ..." }, { "stop", G_FLAG_VERBOSE, NULL, @@ -118,7 +117,7 @@ struct g_command class_commands[] = { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; Modified: head/sbin/geom/class/mountver/geom_mountver.c ============================================================================== --- head/sbin/geom/class/mountver/geom_mountver.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/mountver/geom_mountver.c Mon Sep 13 13:48:18 2010 (r212554) @@ -43,14 +43,14 @@ struct g_command class_commands[] = { { G_OPT_SENTINEL }, - NULL, "[-v] dev ..." + "[-v] dev ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] prov ..." + "[-fv] prov ..." }, G_CMD_SENTINEL }; Modified: head/sbin/geom/class/multipath/geom_multipath.c ============================================================================== --- head/sbin/geom/class/multipath/geom_multipath.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/multipath/geom_multipath.c Mon Sep 13 13:48:18 2010 (r212554) @@ -53,27 +53,27 @@ static void mp_add(struct gctl_req *); struct g_command class_commands[] = { { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS, - NULL, "[-v] name prov ..." + "[-v] name prov ..." }, { "add", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS, - NULL, "[-v] name prov ..." + "[-v] name prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - NULL, "[-v] prov ..." + "[-v] prov ..." }, { "clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, - NULL, "[-v] prov ..." + "[-v] prov ..." }, { "rotate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - NULL, "[-v] prov ..." + "[-v] prov ..." }, { "getactive", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - NULL, "[-v] prov ..." + "[-v] prov ..." }, G_CMD_SENTINEL }; Modified: head/sbin/geom/class/nop/geom_nop.c ============================================================================== --- head/sbin/geom/class/nop/geom_nop.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/nop/geom_nop.c Mon Sep 13 13:48:18 2010 (r212554) @@ -38,44 +38,37 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_NOP_VERSION; -static intmax_t error = -1; -static intmax_t rfailprob = -1; -static intmax_t wfailprob = -1; -static intmax_t offset = 0; -static intmax_t secsize = 0; -static intmax_t size = 0; - struct g_command class_commands[] = { { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 'e', "error", &error, G_TYPE_NUMBER }, - { 'o', "offset", &offset, G_TYPE_NUMBER }, - { 'r', "rfailprob", &rfailprob, G_TYPE_NUMBER }, - { 's', "size", &size, G_TYPE_NUMBER }, - { 'S', "secsize", &secsize, G_TYPE_NUMBER }, - { 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER }, + { 'e', "error", "-1", G_TYPE_NUMBER }, + { 'o', "offset", "0", G_TYPE_NUMBER }, + { 'r', "rfailprob", "-1", G_TYPE_NUMBER }, + { 's', "size", "0", G_TYPE_NUMBER }, + { 'S', "secsize", "0", G_TYPE_NUMBER }, + { 'w', "wfailprob", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] [-e error] [-o offset] [-r rfailprob] [-s size] " + "[-v] [-e error] [-o offset] [-r rfailprob] [-s size] " "[-S secsize] [-w wfailprob] dev ..." }, { "configure", G_FLAG_VERBOSE, NULL, { - { 'e', "error", &error, G_TYPE_NUMBER }, - { 'r', "rfailprob", &rfailprob, G_TYPE_NUMBER }, - { 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER }, + { 'e', "error", "-1", G_TYPE_NUMBER }, + { 'r', "rfailprob", "-1", G_TYPE_NUMBER }, + { 'w', "wfailprob", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..." + "[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] prov ..." + "[-fv] prov ..." }, - { "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] prov ..." }, G_CMD_SENTINEL Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/part/geom_part.c Mon Sep 13 13:48:18 2010 (r212554) @@ -58,15 +58,15 @@ __FBSDID("$FreeBSD$"); uint32_t PUBSYM(lib_version) = G_LIB_VERSION; uint32_t PUBSYM(version) = 0; -static char autofill[] = "*"; -static char flags[] = "C"; - static char sstart[32]; static char ssize[32]; -static const char const bootcode_param[] = "bootcode"; -static const char const index_param[] = "index"; -static const char const partcode_param[] = "partcode"; +#define GPART_AUTOFILL "*" +#define GPART_FLAGS "C" + +#define GPART_PARAM_BOOTCODE "bootcode" +#define GPART_PARAM_INDEX "index" +#define GPART_PARAM_PARTCODE "partcode" static struct gclass *find_class(struct gmesh *, const char *); static struct ggeom * find_geom(struct gclass *, const char *); @@ -87,76 +87,81 @@ static void gpart_write_partcode_vtoc8(s struct g_command PUBSYM(class_commands)[] = { { "add", 0, gpart_issue, { - { 'b', "start", autofill, G_TYPE_STRING }, - { 's', "size", autofill, G_TYPE_STRING }, + { 'b', "start", GPART_AUTOFILL, G_TYPE_STRING }, + { 's', "size", GPART_AUTOFILL, G_TYPE_STRING }, { 't', "type", NULL, G_TYPE_STRING }, - { 'i', index_param, "", G_TYPE_ASCNUM }, + { 'i', GPART_PARAM_INDEX, "", G_TYPE_ASCNUM }, { 'l', "label", "", G_TYPE_STRING }, - { 'f', "flags", flags, G_TYPE_STRING }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL + "[-b start] [-s size] -t type [-i index] [-l label] [-f flags] geom" }, { "bootcode", 0, gpart_bootcode, { - { 'b', bootcode_param, "", G_TYPE_STRING }, - { 'p', partcode_param, "", G_TYPE_STRING }, - { 'i', index_param, "", G_TYPE_ASCNUM }, - { 'f', "flags", flags, G_TYPE_STRING }, + { 'b', GPART_PARAM_BOOTCODE, "", G_TYPE_STRING }, + { 'p', GPART_PARAM_PARTCODE, "", G_TYPE_STRING }, + { 'i', GPART_PARAM_INDEX, "", G_TYPE_ASCNUM }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL + "bootcode [-b bootcode] [-p partcode] [-i index] [-f flags] geom" + }, + { "commit", 0, gpart_issue, G_NULL_OPTS, + "geom" }, - { "commit", 0, gpart_issue, G_NULL_OPTS, "geom", NULL }, { "create", 0, gpart_issue, { { 's', "scheme", NULL, G_TYPE_STRING }, { 'n', "entries", "", G_TYPE_ASCNUM }, - { 'f', "flags", flags, G_TYPE_STRING }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "provider", NULL + "-s scheme [-n entries] [-f flags] provider" }, { "delete", 0, gpart_issue, { - { 'i', index_param, NULL, G_TYPE_ASCNUM }, - { 'f', "flags", flags, G_TYPE_STRING }, + { 'i', GPART_PARAM_INDEX, NULL, G_TYPE_ASCNUM }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL + "-i index [-f flags] geom" }, { "destroy", 0, gpart_issue, { - { 'f', "flags", flags, G_TYPE_STRING }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL }, + "[-f flags] geom" + }, { "modify", 0, gpart_issue, { - { 'i', index_param, NULL, G_TYPE_ASCNUM }, + { 'i', GPART_PARAM_INDEX, NULL, G_TYPE_ASCNUM }, { 'l', "label", "", G_TYPE_STRING }, { 't', "type", "", G_TYPE_STRING }, - { 'f', "flags", flags, G_TYPE_STRING }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL + "-i index [-l label] [-t type] [-f flags] geom" }, { "set", 0, gpart_issue, { { 'a', "attrib", NULL, G_TYPE_STRING }, - { 'i', index_param, NULL, G_TYPE_ASCNUM }, - { 'f', "flags", flags, G_TYPE_STRING }, + { 'i', GPART_PARAM_INDEX, NULL, G_TYPE_ASCNUM }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL + "-a attrib -i index [-f flags] geom" }, { "show", 0, gpart_show, { { 'l', "show_label", NULL, G_TYPE_BOOL }, { 'r', "show_rawtype", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-lr] [geom ...]" + "[-lr] [geom ...]" + }, + { "undo", 0, gpart_issue, G_NULL_OPTS, + "geom" }, - { "undo", 0, gpart_issue, G_NULL_OPTS, "geom", NULL }, { "unset", 0, gpart_issue, { { 'a', "attrib", NULL, G_TYPE_STRING }, - { 'i', index_param, NULL, G_TYPE_ASCNUM }, - { 'f', "flags", flags, G_TYPE_STRING }, + { 'i', GPART_PARAM_INDEX, NULL, G_TYPE_ASCNUM }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL + "-a attrib -i index [-f flags] geom" }, { "resize", 0, gpart_issue, { - { 's', "size", autofill, G_TYPE_STRING }, - { 'i', index_param, NULL, G_TYPE_ASCNUM }, - { 'f', "flags", flags, G_TYPE_STRING }, + { 's', "size", GPART_AUTOFILL, G_TYPE_STRING }, + { 'i', GPART_PARAM_INDEX, NULL, G_TYPE_ASCNUM }, + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL + "[-s size] -i index [-f flags] geom" }, G_CMD_SENTINEL }; @@ -281,7 +286,7 @@ gpart_autofill_resize(struct gctl_req *r char *val; int error, idx; - s = gctl_get_ascii(req, index_param); + s = gctl_get_ascii(req, GPART_PARAM_INDEX); idx = strtol(s, &val, 10); if (idx < 1 || *s == '\0' || *val != '\0') errx(EXIT_FAILURE, "invalid partition index"); @@ -773,11 +778,11 @@ gpart_bootcode(struct gctl_req *req, uns size_t bootsize, partsize; int error, idx, vtoc8; - if (gctl_has_param(req, bootcode_param)) { - s = gctl_get_ascii(req, bootcode_param); + if (gctl_has_param(req, GPART_PARAM_BOOTCODE)) { + s = gctl_get_ascii(req, GPART_PARAM_BOOTCODE); bootsize = 800 * 1024; /* Arbitrary limit. */ bootcode = gpart_bootfile_read(s, &bootsize); - error = gctl_change_param(req, bootcode_param, bootsize, + error = gctl_change_param(req, GPART_PARAM_BOOTCODE, bootsize, bootcode); if (error) errc(EXIT_FAILURE, error, "internal error"); @@ -797,7 +802,7 @@ gpart_bootcode(struct gctl_req *req, uns geom_deletetree(&mesh); errx(EXIT_FAILURE, "Class %s not found.", s); } - s = gctl_get_ascii(req, "geom"); + s = gctl_get_ascii(req, "arg0"); if (s == NULL) abort(); gp = find_geom(classp, s); @@ -808,11 +813,11 @@ gpart_bootcode(struct gctl_req *req, uns if (strcmp(s, "VTOC8") == 0) vtoc8 = 1; - if (gctl_has_param(req, partcode_param)) { - s = gctl_get_ascii(req, partcode_param); + if (gctl_has_param(req, GPART_PARAM_PARTCODE)) { + s = gctl_get_ascii(req, GPART_PARAM_PARTCODE); partsize = vtoc8 != 0 ? VTOC_BOOTSIZE : bootsize * 1024; partcode = gpart_bootfile_read(s, &partsize); - error = gctl_delete_param(req, partcode_param); + error = gctl_delete_param(req, GPART_PARAM_PARTCODE); if (error) errc(EXIT_FAILURE, error, "internal error"); } else { @@ -820,14 +825,14 @@ gpart_bootcode(struct gctl_req *req, uns partsize = 0; } - if (gctl_has_param(req, index_param)) { + if (gctl_has_param(req, GPART_PARAM_INDEX)) { if (partcode == NULL) errx(EXIT_FAILURE, "-i is only valid with -p"); - s = gctl_get_ascii(req, index_param); + s = gctl_get_ascii(req, GPART_PARAM_INDEX); idx = strtol(s, &sp, 10); if (idx < 1 || *s == '\0' || *sp != '\0') errx(EXIT_FAILURE, "invalid partition index"); - error = gctl_delete_param(req, index_param); + error = gctl_delete_param(req, GPART_PARAM_INDEX); if (error) errc(EXIT_FAILURE, error, "internal error"); } else @@ -858,6 +863,10 @@ gpart_issue(struct gctl_req *req, unsign const char *errstr; int error, status; + if (gctl_get_int(req, "nargs") != 1) + errx(EXIT_FAILURE, "Invalid number of arguments."); + (void)gctl_delete_param(req, "nargs"); + /* autofill parameters (if applicable). */ error = gpart_autofill(req); if (error) { Modified: head/sbin/geom/class/raid3/geom_raid3.c ============================================================================== --- head/sbin/geom/class/raid3/geom_raid3.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/raid3/geom_raid3.c Mon Sep 13 13:48:18 2010 (r212554) @@ -45,15 +45,13 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_RAID3_VERSION; -static intmax_t default_blocksize = 0; - static void raid3_main(struct gctl_req *req, unsigned f); static void raid3_clear(struct gctl_req *req); 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, NULL, + { "clear", G_FLAG_VERBOSE, raid3_main, G_NULL_OPTS, "[-v] prov ..." }, { "configure", G_FLAG_VERBOSE, NULL, @@ -70,9 +68,9 @@ struct g_command class_commands[] = { { 'W', "noverify", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-adfFhnrRvwW] name" + "[-adfFhnrRvwW] name" }, - { "dump", 0, raid3_main, G_NULL_OPTS, NULL, + { "dump", 0, raid3_main, G_NULL_OPTS, "prov ..." }, { "insert", G_FLAG_VERBOSE, NULL, @@ -81,7 +79,7 @@ struct g_command class_commands[] = { { 'n', "number", NULL, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-hv] <-n number> name prov" + "[-hv] <-n number> name prov" }, { "label", G_FLAG_VERBOSE, raid3_main, { @@ -89,13 +87,13 @@ struct g_command class_commands[] = { { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, { 'r', "round_robin", NULL, G_TYPE_BOOL }, - { 's', "blocksize", &default_blocksize, G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, { 'w', "verify", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-hFnrvw] [-s blocksize] name prov prov prov ..." + "[-hFnrvw] [-s blocksize] name prov prov prov ..." }, - { "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, + { "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name prov" }, { "remove", G_FLAG_VERBOSE, NULL, @@ -103,14 +101,14 @@ struct g_command class_commands[] = { { 'n', "number", NULL, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-v] <-n number> name" + "[-v] <-n number> name" }, { "stop", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; @@ -193,7 +191,7 @@ raid3_label(struct gctl_req *req) * sectorsizes of every disk and find the smallest mediasize. */ mediasize = 0; - sectorsize = gctl_get_intmax(req, "blocksize"); + sectorsize = gctl_get_intmax(req, "sectorsize"); for (i = 1; i < nargs; i++) { str = gctl_get_ascii(req, "arg%d", i); msize = g_get_mediasize(str); Modified: head/sbin/geom/class/sched/geom_sched.c ============================================================================== --- head/sbin/geom/class/sched/geom_sched.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/sched/geom_sched.c Mon Sep 13 13:48:18 2010 (r212554) @@ -60,11 +60,13 @@ uint32_t version = G_SCHED_VERSION; * Adapt to differences in geom library. * in V1 struct g_command misses gc_argname, eld, and G_BOOL is undefined */ -#if G_LIB_VERSION == 1 -#define G_ARGNAME +#if G_LIB_VERSION <= 1 #define G_TYPE_BOOL G_TYPE_NUMBER -#else +#endif +#if G_LIB_VERSION >= 3 && G_LIB_VERSION <= 4 #define G_ARGNAME NULL, +#else +#define G_ARGNAME #endif static void Modified: head/sbin/geom/class/shsec/geom_shsec.c ============================================================================== --- head/sbin/geom/class/shsec/geom_shsec.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/shsec/geom_shsec.c Mon Sep 13 13:48:18 2010 (r212554) @@ -52,10 +52,10 @@ static void shsec_dump(struct gctl_req * static void shsec_label(struct gctl_req *req); struct g_command class_commands[] = { - { "clear", G_FLAG_VERBOSE, shsec_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, shsec_main, G_NULL_OPTS, "[-v] prov ..." }, - { "dump", 0, shsec_main, G_NULL_OPTS, NULL, + { "dump", 0, shsec_main, G_NULL_OPTS, "prov ..." }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, shsec_main, @@ -63,14 +63,14 @@ struct g_command class_commands[] = { { 'h', "hardcode", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-hv] name prov prov ..." + "[-hv] name prov prov ..." }, { "stop", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; Modified: head/sbin/geom/class/stripe/geom_stripe.c ============================================================================== --- head/sbin/geom/class/stripe/geom_stripe.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/stripe/geom_stripe.c Mon Sep 13 13:48:18 2010 (r212554) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_STRIPE_VERSION; -static intmax_t default_stripesize = 65536; +#define GSTRIPE_STRIPESIZE "65536" static void stripe_main(struct gctl_req *req, unsigned flags); static void stripe_clear(struct gctl_req *req); @@ -54,40 +54,40 @@ static void stripe_dump(struct gctl_req static void stripe_label(struct gctl_req *req); struct g_command class_commands[] = { - { "clear", G_FLAG_VERBOSE, stripe_main, G_NULL_OPTS, NULL, + { "clear", G_FLAG_VERBOSE, stripe_main, G_NULL_OPTS, "[-v] prov ..." }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 's', "stripesize", &default_stripesize, G_TYPE_NUMBER }, + { 's', "stripesize", GSTRIPE_STRIPESIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-hv] [-s stripesize] name prov prov ..." + "[-hv] [-s stripesize] name prov prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, - { "dump", 0, stripe_main, G_NULL_OPTS, NULL, + { "dump", 0, stripe_main, G_NULL_OPTS, "prov ..." }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, stripe_main, { { 'h', "hardcode", NULL, G_TYPE_BOOL }, - { 's', "stripesize", &default_stripesize, G_TYPE_NUMBER }, + { 's', "stripesize", GSTRIPE_STRIPESIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-hv] [-s stripesize] name prov prov ..." + "[-hv] [-s stripesize] name prov prov ..." }, { "stop", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fv] name ..." + "[-fv] name ..." }, G_CMD_SENTINEL }; Modified: head/sbin/geom/class/virstor/geom_virstor.c ============================================================================== --- head/sbin/geom/class/virstor/geom_virstor.c Mon Sep 13 13:11:50 2010 (r212553) +++ head/sbin/geom/class/virstor/geom_virstor.c Mon Sep 13 13:48:18 2010 (r212554) @@ -48,8 +48,9 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_VIRSTOR_VERSION; -static intmax_t chunk_size = 4 * 1024 * 1024; /* in kB (default: 4 MB) */ -static intmax_t vir_size = 2ULL << 40; /* in MB (default: 2 TB) */ + +#define GVIRSTOR_CHUNK_SIZE "4M" +#define GVIRSTOR_VIR_SIZE "2T" #if G_LIB_VERSION == 1 /* Support RELENG_6 */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009131348.o8DDmJL8004159>