diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c index e961255d..22b2a5ee 100644 --- a/btrfs-corrupt-block.c +++ b/btrfs-corrupt-block.c @@ -1236,7 +1236,7 @@ int main(int argc, char **argv) while(1) { int c; - enum { GETOPT_VAL_BLOCK_GROUP = 256 }; + enum { GETOPT_VAL_BLOCK_GROUP = GETOPT_VAL_FIRST }; static const struct option long_options[] = { /* { "byte-count", 1, NULL, 'b' }, */ { "logical", required_argument, NULL, 'l' }, diff --git a/btrfstune.c b/btrfstune.c index 31be9074..d1a1877e 100644 --- a/btrfstune.c +++ b/btrfstune.c @@ -818,7 +818,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) int fd = -1; while(1) { - enum { GETOPT_VAL_CSUM = 256 }; + enum { GETOPT_VAL_CSUM = GETOPT_VAL_FIRST }; static const struct option long_options[] = { { "help", no_argument, NULL, GETOPT_VAL_HELP}, #if EXPERIMENTAL diff --git a/check/main.c b/check/main.c index 6b2be57a..4f7ab8b2 100644 --- a/check/main.c +++ b/check/main.c @@ -10412,7 +10412,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv) while(1) { int c; - enum { GETOPT_VAL_REPAIR = 257, GETOPT_VAL_INIT_CSUM, + enum { GETOPT_VAL_REPAIR = GETOPT_VAL_FIRST, GETOPT_VAL_INIT_CSUM, GETOPT_VAL_INIT_EXTENT, GETOPT_VAL_CHECK_CSUM, GETOPT_VAL_READONLY, GETOPT_VAL_CHUNK_TREE, GETOPT_VAL_MODE, GETOPT_VAL_CLEAR_SPACE_CACHE, diff --git a/cmds/balance.c b/cmds/balance.c index 7abc69d9..de408579 100644 --- a/cmds/balance.c +++ b/cmds/balance.c @@ -407,9 +407,8 @@ static int cmd_balance_start(const struct cmd_struct *cmd, optind = 0; while (1) { - enum { GETOPT_VAL_FULL_BALANCE = 256, - GETOPT_VAL_BACKGROUND = 257, - GETOPT_VAL_ENQUEUE }; + enum { GETOPT_VAL_FULL_BALANCE = GETOPT_VAL_FIRST, + GETOPT_VAL_BACKGROUND, GETOPT_VAL_ENQUEUE }; static const struct option longopts[] = { { "data", optional_argument, NULL, 'd'}, { "metadata", optional_argument, NULL, 'm' }, diff --git a/cmds/device.c b/cmds/device.c index 7d3febff..a945adaf 100644 --- a/cmds/device.c +++ b/cmds/device.c @@ -74,7 +74,7 @@ static int cmd_device_add(const struct cmd_struct *cmd, optind = 0; while (1) { int c; - enum { GETOPT_VAL_ENQUEUE = 256 }; + enum { GETOPT_VAL_ENQUEUE = GETOPT_VAL_FIRST }; static const struct option long_options[] = { { "nodiscard", optional_argument, NULL, 'K'}, { "force", no_argument, NULL, 'f'}, @@ -199,7 +199,7 @@ static int _cmd_device_remove(const struct cmd_struct *cmd, optind = 0; while (1) { int c; - enum { GETOPT_VAL_ENQUEUE = 256 }; + enum { GETOPT_VAL_ENQUEUE = GETOPT_VAL_FIRST }; static const struct option long_options[] = { { "enqueue", no_argument, NULL, GETOPT_VAL_ENQUEUE}, { NULL, 0, NULL, 0} diff --git a/cmds/inspect-dump-super.c b/cmds/inspect-dump-super.c index d8435624..58f9ba5f 100644 --- a/cmds/inspect-dump-super.c +++ b/cmds/inspect-dump-super.c @@ -92,7 +92,7 @@ static int cmd_inspect_dump_super(const struct cmd_struct *cmd, while (1) { int c; - enum { GETOPT_VAL_BYTENR = 257 }; + enum { GETOPT_VAL_BYTENR = GETOPT_VAL_FIRST }; static const struct option long_options[] = { {"all", no_argument, NULL, 'a'}, {"bytenr", required_argument, NULL, GETOPT_VAL_BYTENR }, diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c index daa7f925..73ffd57e 100644 --- a/cmds/inspect-dump-tree.c +++ b/cmds/inspect-dump-tree.c @@ -342,7 +342,8 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, optind = 0; while (1) { int c; - enum { GETOPT_VAL_FOLLOW = 256, GETOPT_VAL_DFS, GETOPT_VAL_BFS, + enum { GETOPT_VAL_FOLLOW = GETOPT_VAL_FIRST, GETOPT_VAL_DFS, + GETOPT_VAL_BFS, GETOPT_VAL_NOSCAN, GETOPT_VAL_HIDE_NAMES, GETOPT_VAL_CSUM_HEADERS, GETOPT_VAL_CSUM_ITEMS, }; diff --git a/cmds/inspect.c b/cmds/inspect.c index 1534f204..19909f87 100644 --- a/cmds/inspect.c +++ b/cmds/inspect.c @@ -648,7 +648,7 @@ static int cmd_inspect_min_dev_size(const struct cmd_struct *cmd, optind = 0; while (1) { int c; - enum { GETOPT_VAL_DEVID = 256 }; + enum { GETOPT_VAL_DEVID = GETOPT_VAL_FIRST }; static const struct option long_options[] = { { "id", required_argument, NULL, GETOPT_VAL_DEVID }, {NULL, 0, NULL, 0} diff --git a/cmds/qgroup.c b/cmds/qgroup.c index 139dca97..8e044a60 100644 --- a/cmds/qgroup.c +++ b/cmds/qgroup.c @@ -1535,7 +1535,7 @@ static int _cmd_qgroup_assign(const struct cmd_struct *cmd, int assign, optind = 0; while (1) { - enum { GETOPT_VAL_RESCAN = 256, GETOPT_VAL_NO_RESCAN }; + enum { GETOPT_VAL_RESCAN = GETOPT_VAL_FIRST, GETOPT_VAL_NO_RESCAN }; static const struct option long_options[] = { { "rescan", no_argument, NULL, GETOPT_VAL_RESCAN }, { "no-rescan", no_argument, NULL, GETOPT_VAL_NO_RESCAN }, @@ -1757,7 +1757,7 @@ static int cmd_qgroup_show(const struct cmd_struct *cmd, int argc, char **argv) while (1) { int c; enum { - GETOPT_VAL_SORT = 256, + GETOPT_VAL_SORT = GETOPT_VAL_FIRST, GETOPT_VAL_SYNC }; static const struct option long_options[] = { diff --git a/cmds/receive.c b/cmds/receive.c index ca5e7086..958e5d20 100644 --- a/cmds/receive.c +++ b/cmds/receive.c @@ -1602,7 +1602,7 @@ static int cmd_receive(const struct cmd_struct *cmd, int argc, char **argv) while (1) { int c; enum { - GETOPT_VAL_DUMP = 257, + GETOPT_VAL_DUMP = GETOPT_VAL_FIRST, GETOPT_VAL_FORCE_DECOMPRESS, }; static const struct option long_opts[] = { diff --git a/cmds/replace.c b/cmds/replace.c index 23f5dcca..dd15daba 100644 --- a/cmds/replace.c +++ b/cmds/replace.c @@ -147,7 +147,7 @@ static int cmd_replace_start(const struct cmd_struct *cmd, optind = 0; while (1) { int c; - enum { GETOPT_VAL_ENQUEUE = 256 }; + enum { GETOPT_VAL_ENQUEUE = GETOPT_VAL_FIRST }; static const struct option long_options[] = { { "enqueue", no_argument, NULL, GETOPT_VAL_ENQUEUE}, { "nodiscard", no_argument, NULL, 'K' }, diff --git a/cmds/restore.c b/cmds/restore.c index 341f2be5..b517c30c 100644 --- a/cmds/restore.c +++ b/cmds/restore.c @@ -1391,7 +1391,7 @@ static int cmd_restore(const struct cmd_struct *cmd, int argc, char **argv) optind = 0; while (1) { int opt; - enum { GETOPT_VAL_PATH_REGEX = 256 }; + enum { GETOPT_VAL_PATH_REGEX = GETOPT_VAL_FIRST }; static const struct option long_options[] = { { "path-regex", required_argument, NULL, GETOPT_VAL_PATH_REGEX }, diff --git a/cmds/send.c b/cmds/send.c index b1adfeca..f9446302 100644 --- a/cmds/send.c +++ b/cmds/send.c @@ -538,7 +538,7 @@ static int cmd_send(const struct cmd_struct *cmd, int argc, char **argv) optind = 0; while (1) { enum { - GETOPT_VAL_SEND_NO_DATA = 256, + GETOPT_VAL_SEND_NO_DATA = GETOPT_VAL_FIRST, GETOPT_VAL_PROTO, GETOPT_VAL_COMPRESSED_DATA, }; diff --git a/common/help.h b/common/help.h index ea055250..448e51c9 100644 --- a/common/help.h +++ b/common/help.h @@ -17,16 +17,19 @@ #ifndef __BTRFS_HELP_H__ #define __BTRFS_HELP_H__ -#define GETOPT_VAL_SI 256 -#define GETOPT_VAL_IEC 257 -#define GETOPT_VAL_RAW 258 -#define GETOPT_VAL_HUMAN_READABLE 259 -#define GETOPT_VAL_KBYTES 260 -#define GETOPT_VAL_MBYTES 261 -#define GETOPT_VAL_GBYTES 262 -#define GETOPT_VAL_TBYTES 263 +/* User defined long options first option */ +#define GETOPT_VAL_FIRST 256 -#define GETOPT_VAL_HELP 270 +#define GETOPT_VAL_SI 512 +#define GETOPT_VAL_IEC 513 +#define GETOPT_VAL_RAW 514 +#define GETOPT_VAL_HUMAN_READABLE 515 +#define GETOPT_VAL_KBYTES 516 +#define GETOPT_VAL_MBYTES 517 +#define GETOPT_VAL_GBYTES 518 +#define GETOPT_VAL_TBYTES 519 + +#define GETOPT_VAL_HELP 520 #define ARGV0_BUF_SIZE PATH_MAX diff --git a/convert/main.c b/convert/main.c index 73f919d2..95ceec11 100644 --- a/convert/main.c +++ b/convert/main.c @@ -1832,7 +1832,7 @@ int BOX_MAIN(convert)(int argc, char *argv[]) printf("btrfs-convert from %s\n\n", PACKAGE_STRING); while(1) { - enum { GETOPT_VAL_NO_PROGRESS = 256, GETOPT_VAL_CHECKSUM, + enum { GETOPT_VAL_NO_PROGRESS = GETOPT_VAL_FIRST, GETOPT_VAL_CHECKSUM, GETOPT_VAL_UUID }; static const struct option long_options[] = { { "no-progress", no_argument, NULL, diff --git a/mkfs/main.c b/mkfs/main.c index 4e0a46a7..ce096d36 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1021,7 +1021,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) while(1) { int c; enum { - GETOPT_VAL_SHRINK = 257, + GETOPT_VAL_SHRINK = GETOPT_VAL_FIRST, GETOPT_VAL_CHECKSUM, GETOPT_VAL_GLOBAL_ROOTS, };