summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Brown <zab@redhat.com>2013-08-14 16:16:34 -0700
committerDavid Sterba <dsterba@suse.cz>2013-09-03 19:41:02 +0200
commit19a2e1f4611eeff9668dacecafb6e51b5ca0f704 (patch)
treea6a821f87083f49c37f8307b454754436a8a4c2c
parent323bf8c5871f94b0623e98d575ccd79d19b14405 (diff)
btrfs-progs: fix shadow symbols
This fixes all the instances of warnings that symbols declared in blocks shadow symbols with the same name in surrounding scopes: cmds-device.c:341:22: warning: symbol 'path' shadows an earlier one cmds-device.c:285:14: originally declared here I just renamed or removed the risky shadow symbols instead of pulling their blocks out into functions. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r--cmds-check.c7
-rw-r--r--cmds-device.c10
-rw-r--r--cmds-restore.c8
-rw-r--r--ctree.c2
-rw-r--r--volumes.c2
5 files changed, 13 insertions, 16 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 4e5f997d..2318aed5 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -3477,6 +3477,7 @@ static int run_next_block(struct btrfs_root *root,
u64 parent;
u64 owner;
u64 flags;
+ u64 ptr;
int ret;
int i;
int nritems;
@@ -3665,8 +3666,8 @@ static int run_next_block(struct btrfs_root *root,
btrfs_item_key_to_cpu(buf, &first_key, 0);
level = btrfs_header_level(buf);
for (i = 0; i < nritems; i++) {
- u64 ptr = btrfs_node_blockptr(buf, i);
- u32 size = btrfs_level_size(root, level - 1);
+ ptr = btrfs_node_blockptr(buf, i);
+ size = btrfs_level_size(root, level - 1);
btrfs_node_key_to_cpu(buf, &key, i);
ret = add_extent_rec(extent_cache, &key,
ptr, size, 0, 0, 1, 0, 1, 0,
@@ -5317,8 +5318,6 @@ again:
ret = err;
if (trans) {
- int err;
-
err = btrfs_commit_transaction(trans, root);
if (!ret)
ret = err;
diff --git a/cmds-device.c b/cmds-device.c
index 48ac526c..06df8647 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -282,7 +282,7 @@ static const char * const cmd_dev_stats_usage[] = {
static int cmd_dev_stats(int argc, char **argv)
{
- char *path;
+ char *dev_path;
struct btrfs_ioctl_fs_info_args fi_args;
struct btrfs_ioctl_dev_info_args *di_args = NULL;
int ret;
@@ -314,16 +314,16 @@ static int cmd_dev_stats(int argc, char **argv)
return 1;
}
- path = argv[optind];
+ dev_path = argv[optind];
- fdmnt = open_path_or_dev_mnt(path, &dirstream);
+ fdmnt = open_path_or_dev_mnt(dev_path, &dirstream);
if (fdmnt < 0) {
- fprintf(stderr, "ERROR: can't access '%s'\n", path);
+ fprintf(stderr, "ERROR: can't access '%s'\n", dev_path);
return 12;
}
- ret = get_fs_info(path, &fi_args, &di_args);
+ ret = get_fs_info(dev_path, &fi_args, &di_args);
if (ret) {
fprintf(stderr, "ERROR: getting dev info for devstats failed: "
"%s\n", strerror(-ret));
diff --git a/cmds-restore.c b/cmds-restore.c
index 478c0b5c..1e965a69 100644
--- a/cmds-restore.c
+++ b/cmds-restore.c
@@ -658,7 +658,7 @@ set_size:
}
static int search_dir(struct btrfs_root *root, struct btrfs_key *key,
- const char *output_rootdir, const char *dir,
+ const char *output_rootdir, const char *in_dir,
const regex_t *mreg)
{
struct btrfs_path *path;
@@ -716,7 +716,7 @@ static int search_dir(struct btrfs_root *root, struct btrfs_key *key,
if (loops++ >= 1024) {
printf("We have looped trying to restore files in %s "
"too many times to be making progress, "
- "stopping\n", dir);
+ "stopping\n", in_dir);
break;
}
@@ -764,7 +764,7 @@ static int search_dir(struct btrfs_root *root, struct btrfs_key *key,
btrfs_dir_item_key_to_cpu(leaf, dir_item, &location);
/* full path from root of btrfs being restored */
- snprintf(fs_name, 4096, "%s/%s", dir, filename);
+ snprintf(fs_name, 4096, "%s/%s", in_dir, filename);
if (mreg && REG_NOMATCH == regexec(mreg, fs_name, 0, NULL, 0))
goto next;
@@ -896,7 +896,7 @@ next:
}
if (verbose)
- printf("Done searching %s\n", dir);
+ printf("Done searching %s\n", in_dir);
btrfs_free_path(path);
return 0;
}
diff --git a/ctree.c b/ctree.c
index a79ed13d..1b093f6b 100644
--- a/ctree.c
+++ b/ctree.c
@@ -2401,7 +2401,6 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
BUG_ON(slot < 0);
if (slot != nritems) {
- int i;
unsigned int old_data = btrfs_item_end_nr(leaf, slot);
if (old_data < data_end) {
@@ -2580,7 +2579,6 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
nritems = btrfs_header_nritems(leaf);
if (slot + nr != nritems) {
- int i;
int data_end = leaf_data_end(root, leaf);
memmove_extent_buffer(leaf, btrfs_leaf_data(leaf) +
diff --git a/volumes.c b/volumes.c
index 1f172b59..e460bce3 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1281,7 +1281,7 @@ again:
BTRFS_BLOCK_GROUP_RAID6)) {
if (raid_map) {
- int i, rot;
+ int rot;
u64 tmp;
u64 raid56_full_stripe_start;
u64 full_stripe_len = nr_data_stripes(map) * map->stripe_len;