btrfs-progs: getopt, use symbolic name for argument requirements

Signed-off-by: David Sterba <dsterba@suse.cz>
master
David Sterba 2015-04-08 17:39:51 +02:00
parent 4074ae5f2b
commit 08f9acadab
8 changed files with 50 additions and 50 deletions

View File

@ -1019,23 +1019,23 @@ int main(int ac, char **av)
int c;
static const struct option long_options[] = {
/* { "byte-count", 1, NULL, 'b' }, */
{ "logical", 1, NULL, 'l' },
{ "copy", 1, NULL, 'c' },
{ "bytes", 1, NULL, 'b' },
{ "extent-record", 0, NULL, 'e' },
{ "extent-tree", 0, NULL, 'E' },
{ "keys", 0, NULL, 'k' },
{ "chunk-record", 0, NULL, 'u' },
{ "chunk-tree", 0, NULL, 'U' },
{ "inode", 1, NULL, 'i'},
{ "file-extent", 1, NULL, 'x'},
{ "metadata-block", 1, NULL, 'm'},
{ "field", 1, NULL, 'f'},
{ "key", 1, NULL, 'K'},
{ "item", 0, NULL, 'I'},
{ "dir-item", 0, NULL, 'D'},
{ "delete", 0, NULL, 'd'},
{ "root", 0, NULL, 'r'},
{ "logical", required_argument, NULL, 'l' },
{ "copy", required_argument, NULL, 'c' },
{ "bytes", required_argument, NULL, 'b' },
{ "extent-record", no_argument, NULL, 'e' },
{ "extent-tree", no_argument, NULL, 'E' },
{ "keys", no_argument, NULL, 'k' },
{ "chunk-record", no_argument, NULL, 'u' },
{ "chunk-tree", no_argument, NULL, 'U' },
{ "inode", required_argument, NULL, 'i'},
{ "file-extent", required_argument, NULL, 'x'},
{ "metadata-block", required_argument, NULL, 'm'},
{ "field", required_argument, NULL, 'f'},
{ "key", required_argument, NULL, 'K'},
{ "item", no_argument, NULL, 'I'},
{ "dir-item", no_argument, NULL, 'D'},
{ "delete", no_argument, NULL, 'd'},
{ "root", no_argument, NULL, 'r'},
{ NULL, 0, NULL, 0 }
};

View File

@ -126,10 +126,10 @@ int main(int ac, char **av)
int c;
static const struct option long_options[] = {
/* { "byte-count", 1, NULL, 'b' }, */
{ "logical", 1, NULL, 'l' },
{ "copy", 1, NULL, 'c' },
{ "output", 1, NULL, 'o' },
{ "bytes", 1, NULL, 'b' },
{ "logical", required_argument, NULL, 'l' },
{ "copy", required_argument, NULL, 'c' },
{ "output", required_argument, NULL, 'o' },
{ "bytes", required_argument, NULL, 'b' },
{ NULL, 0, NULL, 0}
};

View File

@ -9224,16 +9224,16 @@ int cmd_check(int argc, char **argv)
enum { OPT_REPAIR = 257, OPT_INIT_CSUM, OPT_INIT_EXTENT,
OPT_CHECK_CSUM, OPT_READONLY };
static const struct option long_options[] = {
{ "super", 1, NULL, 's' },
{ "repair", 0, NULL, OPT_REPAIR },
{ "readonly", 0, NULL, OPT_READONLY },
{ "init-csum-tree", 0, NULL, OPT_INIT_CSUM },
{ "init-extent-tree", 0, NULL, OPT_INIT_EXTENT },
{ "check-data-csum", 0, NULL, OPT_CHECK_CSUM },
{ "backup", 0, NULL, 'b' },
{ "subvol-extents", 1, NULL, 'E' },
{ "qgroup-report", 0, NULL, 'Q' },
{ "tree-root", 1, NULL, 'r' },
{ "super", required_argument, NULL, 's' },
{ "repair", no_argument, NULL, OPT_REPAIR },
{ "readonly", no_argument, NULL, OPT_READONLY },
{ "init-csum-tree", no_argument, NULL, OPT_INIT_CSUM },
{ "init-extent-tree", no_argument, NULL, OPT_INIT_EXTENT },
{ "check-data-csum", no_argument, NULL, OPT_CHECK_CSUM },
{ "backup", no_argument, NULL, 'b' },
{ "subvol-extents", required_argument, NULL, 'E' },
{ "qgroup-report", no_argument, NULL, 'Q' },
{ "tree-root", required_argument, NULL, 'r' },
{ NULL, 0, NULL, 0}
};

View File

@ -252,7 +252,7 @@ static int cmd_qgroup_show(int argc, char **argv)
while (1) {
int c;
static const struct option long_options[] = {
{"sort", 1, NULL, 'S'},
{"sort", required_argument, NULL, 'S'},
{"raw", no_argument, NULL, GETOPT_VAL_RAW},
{"kbytes", no_argument, NULL, GETOPT_VAL_KBYTES},
{"mbytes", no_argument, NULL, GETOPT_VAL_MBYTES},

View File

@ -934,7 +934,7 @@ int cmd_receive(int argc, char **argv)
while (1) {
int c;
static const struct option long_opts[] = {
{ "max-errors", 1, NULL, 'E' },
{ "max-errors", required_argument, NULL, 'E' },
{ NULL, 0, NULL, 0 }
};

View File

@ -1177,8 +1177,8 @@ int cmd_restore(int argc, char **argv)
while (1) {
int opt;
static const struct option long_options[] = {
{ "path-regex", 1, NULL, 256},
{ "dry-run", 0, NULL, 'D'},
{ "path-regex", required_argument, NULL, 256},
{ "dry-run", no_argument, NULL, 'D'},
{ NULL, 0, NULL, 0}
};

View File

@ -404,7 +404,7 @@ static int cmd_subvol_list(int argc, char **argv)
while(1) {
int c;
static const struct option long_options[] = {
{"sort", 1, NULL, 'S'},
{"sort", required_argument, NULL, 'S'},
{NULL, 0, NULL, 0}
};

28
mkfs.c
View File

@ -1143,20 +1143,20 @@ int main(int ac, char **av)
while(1) {
int c;
static const struct option long_options[] = {
{ "alloc-start", 1, NULL, 'A'},
{ "byte-count", 1, NULL, 'b' },
{ "force", 0, NULL, 'f' },
{ "leafsize", 1, NULL, 'l' },
{ "label", 1, NULL, 'L'},
{ "metadata", 1, NULL, 'm' },
{ "mixed", 0, NULL, 'M' },
{ "nodesize", 1, NULL, 'n' },
{ "sectorsize", 1, NULL, 's' },
{ "data", 1, NULL, 'd' },
{ "version", 0, NULL, 'V' },
{ "rootdir", 1, NULL, 'r' },
{ "nodiscard", 0, NULL, 'K' },
{ "features", 1, NULL, 'O' },
{ "alloc-start", required_argument, NULL, 'A'},
{ "byte-count", required_argument, NULL, 'b' },
{ "force", no_argument, NULL, 'f' },
{ "leafsize", required_argument, NULL, 'l' },
{ "label", required_argument, NULL, 'L'},
{ "metadata", required_argument, NULL, 'm' },
{ "mixed", no_argument, NULL, 'M' },
{ "nodesize", required_argument, NULL, 'n' },
{ "sectorsize", required_argument, NULL, 's' },
{ "data", required_argument, NULL, 'd' },
{ "version", no_argument, NULL, 'V' },
{ "rootdir", required_argument, NULL, 'r' },
{ "nodiscard", no_argument, NULL, 'K' },
{ "features", required_argument, NULL, 'O' },
{ "uuid", required_argument, NULL, 'U' },
{ NULL, 0, NULL, 0}
};