btrfs-progs: unify naming of argc and argv

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2016-03-01 16:28:11 +01:00
parent f4fc6efa4b
commit 6398ed78f9
10 changed files with 54 additions and 54 deletions

View File

@ -1012,7 +1012,7 @@ out:
return ret;
}
int main(int ac, char **av)
int main(int argc, char **argv)
{
struct cache_tree root_cache;
struct btrfs_key key;
@ -1069,7 +1069,7 @@ int main(int ac, char **av)
{ NULL, 0, NULL, 0 }
};
c = getopt_long(ac, av, "l:c:b:eEkuUi:f:x:m:K:IDdr:C:",
c = getopt_long(argc, argv, "l:c:b:eEkuUi:f:x:m:K:IDdr:C:",
long_options, NULL);
if (c < 0)
break;
@ -1141,11 +1141,11 @@ int main(int ac, char **av)
print_usage(c != GETOPT_VAL_HELP);
}
}
set_argv0(av);
ac = ac - optind;
if (check_argc_min(ac, 1))
set_argv0(argv);
argc = argc - optind;
if (check_argc_min(argc, 1))
print_usage(1);
dev = av[optind];
dev = argv[optind];
radix_tree_init();
cache_tree_init(&root_cache);

View File

@ -22,18 +22,18 @@
#include "commands.h"
#include "cmds-inspect-dump-tree.h"
int main(int ac, char **av)
int main(int argc, char **argv)
{
int ret;
set_argv0(av);
set_argv0(argv);
if (ac > 1 && !strcmp(av[1], "--help"))
if (argc > 1 && !strcmp(argv[1], "--help"))
usage(cmd_inspect_dump_tree_usage);
radix_tree_init();
ret = cmd_inspect_dump_tree(ac, av);
ret = cmd_inspect_dump_tree(argc, argv);
btrfs_close_all_devices();

View File

@ -201,7 +201,7 @@ static void print_usage(void)
exit(1);
}
int main(int ac, char **av)
int main(int argc, char **argv)
{
struct cache_tree root_cache;
struct btrfs_root *root;
@ -227,7 +227,7 @@ int main(int ac, char **av)
{ NULL, 0, NULL, 0}
};
c = getopt_long(ac, av, "l:c:o:b:", long_options, NULL);
c = getopt_long(argc, argv, "l:c:o:b:", long_options, NULL);
if (c < 0)
break;
switch(c) {
@ -247,14 +247,14 @@ int main(int ac, char **av)
print_usage();
}
}
set_argv0(av);
ac = ac - optind;
if (check_argc_min(ac, 1))
set_argv0(argv);
argc = argc - optind;
if (check_argc_min(argc, 1))
print_usage();
if (logical == 0)
print_usage();
dev = av[optind];
dev = argv[optind];
radix_tree_init();
cache_tree_init(&root_cache);

View File

@ -37,7 +37,7 @@ static void print_usage(void)
exit(1);
}
int main(int ac, char **av)
int main(int argc, char **argv)
{
struct btrfs_root *root;
int ret;
@ -46,7 +46,7 @@ int main(int ac, char **av)
while(1) {
int c;
c = getopt(ac, av, "s:");
c = getopt(argc, argv, "s:");
if (c < 0)
break;
switch(c) {
@ -64,10 +64,10 @@ int main(int ac, char **av)
print_usage();
}
}
set_argv0(av);
ac = ac - optind;
set_argv0(argv);
argc = argc - optind;
if (check_argc_exact(ac, 1))
if (check_argc_exact(argc, 1))
print_usage();
if (bytenr == 0) {
@ -77,15 +77,15 @@ int main(int ac, char **av)
radix_tree_init();
if((ret = check_mounted(av[optind])) < 0) {
if((ret = check_mounted(argv[optind])) < 0) {
fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret));
return ret;
} else if(ret) {
fprintf(stderr, "%s is currently mounted. Aborting.\n", av[optind]);
fprintf(stderr, "%s is currently mounted. Aborting.\n", argv[optind]);
return -EBUSY;
}
root = open_ctree(av[optind], bytenr, 1);
root = open_ctree(argv[optind], bytenr, 1);
if (!root) {
fprintf(stderr, "Open ctree failed\n");

View File

@ -31,31 +31,31 @@ __attribute__((noreturn)) static void print_usage(void)
exit(1);
}
int main(int ac, char **av)
int main(int argc, char **argv)
{
struct btrfs_root *root;
struct btrfs_trans_handle *trans;
struct btrfs_super_block *sb;
int ret;
set_argv0(av);
if (check_argc_exact(ac, 2))
set_argv0(argv);
if (check_argc_exact(argc, 2))
print_usage();
radix_tree_init();
printf("WARNING: this utility is deprecated, please use 'btrfs rescue zero-log'\n\n");
if ((ret = check_mounted(av[1])) < 0) {
if ((ret = check_mounted(argv[1])) < 0) {
fprintf(stderr, "ERROR: could not check mount status: %s\n", strerror(-ret));
goto out;
} else if (ret) {
fprintf(stderr, "ERROR: %s is currently mounted\n", av[1]);
fprintf(stderr, "ERROR: %s is currently mounted\n", argv[1]);
ret = -EBUSY;
goto out;
}
root = open_ctree(av[1], 0, OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL);
root = open_ctree(argv[1], 0, OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL);
if (!root) {
fprintf(stderr, "ERROR: cannot open ctree\n");
return 1;
@ -63,7 +63,7 @@ int main(int ac, char **av)
sb = root->fs_info->super_copy;
printf("Clearing log on %s, previous log_root %llu, level %u\n",
av[1],
argv[1],
(unsigned long long)btrfs_super_log_root(sb),
(unsigned)btrfs_super_log_root_level(sb));
trans = btrfs_start_transaction(root, 1);

View File

@ -19,7 +19,7 @@
#ifndef __CMDS_INSPECT_DUMP_SUPER_H__
#define __CMDS_INSPECT_DUMP_SUPER_H__
int cmd_inspect_dump_super(int ac, char **av);
int cmd_inspect_dump_super(int argc, char **argv);
extern const char * const cmd_inspect_dump_super_usage[];

View File

@ -119,7 +119,7 @@ const char * const cmd_inspect_dump_tree_usage[] = {
NULL
};
int cmd_inspect_dump_tree(int ac, char **av)
int cmd_inspect_dump_tree(int argc, char **argv)
{
struct btrfs_root *root;
struct btrfs_fs_info *info;
@ -154,7 +154,7 @@ int cmd_inspect_dump_tree(int ac, char **av)
{ NULL, 0, NULL, 0 }
};
c = getopt_long(ac, av, "deb:rRut:", long_options, NULL);
c = getopt_long(argc, argv, "deb:rRut:", long_options, NULL);
if (c < 0)
break;
switch (c) {
@ -185,26 +185,26 @@ int cmd_inspect_dump_tree(int ac, char **av)
}
}
ac = ac - optind;
if (check_argc_exact(ac, 1))
argc = argc - optind;
if (check_argc_exact(argc, 1))
usage(cmd_inspect_dump_tree_usage);
ret = check_arg_type(av[optind]);
ret = check_arg_type(argv[optind]);
if (ret != BTRFS_ARG_BLKDEV && ret != BTRFS_ARG_REG) {
fprintf(stderr, "'%s' is not a block device or regular file\n",
av[optind]);
argv[optind]);
goto out;
}
info = open_ctree_fs_info(av[optind], 0, 0, OPEN_CTREE_PARTIAL);
info = open_ctree_fs_info(argv[optind], 0, 0, OPEN_CTREE_PARTIAL);
if (!info) {
fprintf(stderr, "unable to open %s\n", av[optind]);
fprintf(stderr, "unable to open %s\n", argv[optind]);
goto out;
}
root = info->fs_root;
if (!root) {
fprintf(stderr, "unable to open %s\n", av[optind]);
fprintf(stderr, "unable to open %s\n", argv[optind]);
goto out;
}

View File

@ -17,7 +17,7 @@
#ifndef __CMDS_INSPECT_DUMP_TREE_H__
#define __CMDS_INSPECT_DUMP_TREE_H__
int cmd_inspect_dump_tree(int ac, char **av);
int cmd_inspect_dump_tree(int argc, char **argv);
extern const char * const cmd_inspect_dump_tree_usage[];

View File

@ -624,14 +624,14 @@ out:
return !!ret;
}
static int cmd_inspect_dump_tree_hook(int ac, char **av)
static int cmd_inspect_dump_tree_hook(int argc, char **argv)
{
return cmd_inspect_dump_tree(ac, av);
return cmd_inspect_dump_tree(argc, argv);
}
static int cmd_inspect_dump_super_hook(int ac, char **av)
static int cmd_inspect_dump_super_hook(int argc, char **argv)
{
return cmd_inspect_dump_super(ac, av);
return cmd_inspect_dump_super(argc, argv);
}
static const char inspect_cmd_group_info[] =

16
mkfs.c
View File

@ -1333,7 +1333,7 @@ out:
return ret;
}
int main(int ac, char **av)
int main(int argc, char **argv)
{
char *file;
struct btrfs_root *root;
@ -1395,7 +1395,7 @@ int main(int ac, char **av)
{ NULL, 0, NULL, 0}
};
c = getopt_long(ac, av, "A:b:fl:n:s:m:d:L:O:r:U:VMKq",
c = getopt_long(argc, argv, "A:b:fl:n:s:m:d:L:O:r:U:VMKq",
long_options, NULL);
if (c < 0)
break;
@ -1483,7 +1483,7 @@ int main(int ac, char **av)
sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE));
saved_optind = optind;
dev_cnt = ac - optind;
dev_cnt = argc - optind;
if (dev_cnt == 0)
print_usage(1);
@ -1507,16 +1507,16 @@ int main(int ac, char **av)
}
while (dev_cnt-- > 0) {
file = av[optind++];
file = argv[optind++];
if (is_block_device(file) == 1)
if (test_dev_for_mkfs(file, force_overwrite))
exit(1);
}
optind = saved_optind;
dev_cnt = ac - optind;
dev_cnt = argc - optind;
file = av[optind++];
file = argv[optind++];
ssd = is_ssd(file);
/*
@ -1582,7 +1582,7 @@ int main(int ac, char **av)
for (i = saved_optind; i < saved_optind + dev_cnt; i++) {
char *path;
path = av[i];
path = argv[i];
ret = test_minimum_size(path, nodesize);
if (ret < 0) {
fprintf(stderr, "Failed to check size for '%s': %s\n",
@ -1728,7 +1728,7 @@ int main(int ac, char **av)
goto raid_groups;
while (dev_cnt-- > 0) {
file = av[optind++];
file = argv[optind++];
/*
* open without O_EXCL so that the problem should not