summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-01-19 13:30:06 +0100
committerDavid Sterba <dsterba@suse.cz>2015-01-19 13:30:06 +0100
commitecbf1339a63e99a8ef7d5ddc334e38a39f291d3d (patch)
tree0483487c6fa237ac649c4bd0414bb564a7111925 /mkfs.c
parentca7b429f263ab19acf606846dd560be7e8519302 (diff)
btrfs-progs: cleanup, move getop long options close to their use
Move long_option defintions just before getopt_long everywhere. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/mkfs.c b/mkfs.c
index 98a1eddd..fc7bf845 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -340,25 +340,6 @@ static char *parse_label(char *input)
return strdup(input);
}
-static 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' },
- { "uuid", required_argument, NULL, 'U' },
- { NULL, 0, NULL, 0}
-};
-
static int add_directory_items(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 objectid,
ino_t parent_inum, const char *name,
@@ -1258,7 +1239,6 @@ int main(int ac, char **av)
u32 nodesize = leafsize;
u32 stripesize = 4096;
int zero_end = 1;
- int option_index = 0;
int fd;
int ret;
int i;
@@ -1283,6 +1263,26 @@ int main(int ac, char **av)
while(1) {
int c;
+ int option_index = 0;
+ static 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' },
+ { "uuid", required_argument, NULL, 'U' },
+ { NULL, 0, NULL, 0}
+ };
+
c = getopt_long(ac, av, "A:b:fl:n:s:m:d:L:O:r:U:VMK",
long_options, &option_index);
if (c < 0)