From: Zach Brown <zab@redhat.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 04/15] btrfs-progs: fix shadow symbols
Date: Wed, 14 Aug 2013 16:16:34 -0700 [thread overview]
Message-ID: <1376522205-16992-5-git-send-email-zab@redhat.com> (raw)
In-Reply-To: <1376522205-16992-1-git-send-email-zab@redhat.com>
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>
---
cmds-check.c | 7 +++----
cmds-device.c | 10 +++++-----
cmds-restore.c | 8 ++++----
ctree.c | 2 --
volumes.c | 2 +-
5 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/cmds-check.c b/cmds-check.c
index 4e5f997..2318aed 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 48ac526..06df864 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 478c0b5..1e965a6 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 a79ed13..1b093f6 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 1f172b5..e460bce 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;
--
1.7.11.7
next prev parent reply other threads:[~2013-08-14 23:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 23:16 [RFC] btrfs-progs: fix sparse checking and warnings Zach Brown
2013-08-14 23:16 ` [PATCH 01/15] btrfs-progs: get C=1 sparse checking working again Zach Brown
2013-08-30 16:08 ` David Sterba
2013-08-30 21:03 ` Zach Brown
2013-08-30 21:27 ` David Sterba
2013-08-14 23:16 ` [PATCH 02/15] btrfs-progs: remove __CHECKER__ from main code Zach Brown
2013-08-14 23:16 ` [PATCH 03/15] btrfs-progs: add ULL to u64 constant Zach Brown
2013-08-14 23:16 ` Zach Brown [this message]
2013-08-14 23:16 ` [PATCH 05/15] btrfs-progs: remove variable length stack arrays Zach Brown
2013-08-14 23:16 ` [PATCH 06/15] btrfs-print: define void function args Zach Brown
2013-08-14 23:16 ` [PATCH 07/15] btrfs-progs: fix endian bugs in chunk rebuilding Zach Brown
2013-08-30 16:16 ` David Sterba
2013-08-14 23:16 ` [PATCH 08/15] btrfs-progs: fix extent key endian bug in repair Zach Brown
2013-08-14 23:16 ` [PATCH 09/15] btrfs-progs: fix in-place byte swapping Zach Brown
2013-08-14 23:16 ` [PATCH 10/15] btrfs-progs: fix qgroup realloc inheritance Zach Brown
2013-08-18 8:05 ` Arne Jansen
2013-08-14 23:16 ` [PATCH 11/15] btrfs-progs: make many private symbols static Zach Brown
2013-08-14 23:16 ` [PATCH 12/15] btrfs-progs: fix unaligned compat endian warnings Zach Brown
2013-08-14 23:16 ` [PATCH 13/15] btrfs-progs: don't use <linux/fs.h> Zach Brown
2013-08-14 23:16 ` [PATCH 14/15] btrfs-progs: give raid6.c its exported prototypes Zach Brown
2013-08-14 23:16 ` [PATCH 15/15] btrfs-progs: use NULL instead of 0 Zach Brown
2013-08-30 16:25 ` David Sterba
2013-08-30 21:04 ` Zach Brown
2013-08-30 16:31 ` [RFC] btrfs-progs: fix sparse checking and warnings David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1376522205-16992-5-git-send-email-zab@redhat.com \
--to=zab@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).