linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 12/18] xfsprogs: don't shadow global libxfs_init x variable
Date: Wed, 10 Oct 2018 15:01:16 -0500	[thread overview]
Message-ID: <1539201682-22198-13-git-send-email-sandeen@redhat.com> (raw)
In-Reply-To: <1539201682-22198-1-git-send-email-sandeen@redhat.com>

We use the variable 'x' for the global libxfs_init structure, but several
other functions think 'x' is a nice convenient local var too, and sparse
complains.  Rename these local variables (or in some cases re-use existing
loop counter vars when x was used for this purpose).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 db/check.c          | 15 +++++++--------
 logprint/log_misc.c | 31 ++++++++++++++++---------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/db/check.c b/db/check.c
index 683e176..352aab3 100644
--- a/db/check.c
+++ b/db/check.c
@@ -2050,7 +2050,7 @@ process_block_dir_v2(
 	int		nex;
 	xfs_ino_t	parent;
 	int		v;
-	int		x;
+	int		i;
 
 	nex = blkmap_getn(blkmap, 0, mp->m_dir_geo->fsbcount, &bmp);
 	v = id->ilist || verbose;
@@ -2067,9 +2067,9 @@ process_block_dir_v2(
 		make_bbmap(&bbmap, nex, bmp);
 	set_cur(&typtab[TYP_DIR2], XFS_FSB_TO_DADDR(mp, bmp->startblock),
 		mp->m_dir_geo->fsbcount * blkbb, DB_RING_IGN, nex > 1 ? &bbmap : NULL);
-	for (x = 0; !v && x < nex; x++) {
-		for (b = bmp[x].startblock;
-		     !v && b < bmp[x].startblock + bmp[x].blockcount;
+	for (i = 0; !v && i < nex; i++) {
+		for (b = bmp[i].startblock;
+		     !v && b < bmp[i].startblock + bmp[i].blockcount;
 		     b++)
 			v = CHECK_BLIST(b);
 	}
@@ -2998,7 +2998,6 @@ process_leaf_node_dir_v2(
 	int			t = 0;
 	int			v;
 	int			v2;
-	int			x;
 
 	v2 = verbose || id->ilist;
 	v = parent = 0;
@@ -3012,9 +3011,9 @@ process_leaf_node_dir_v2(
 	while ((dbno = blkmap_next_off(blkmap, dbno, &t)) != NULLFILEOFF) {
 		nex = blkmap_getn(blkmap, dbno, mp->m_dir_geo->fsbcount, &bmp);
 		ASSERT(nex > 0);
-		for (v = v2, x = 0; !v && x < nex; x++) {
-			for (b = bmp[x].startblock;
-			     !v && b < bmp[x].startblock + bmp[x].blockcount;
+		for (v = v2, i = 0; !v && i < nex; i++) {
+			for (b = bmp[i].startblock;
+			     !v && b < bmp[i].startblock + bmp[i].blockcount;
 			     b++)
 				v = CHECK_BLIST(b);
 		}
diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index e29366a..99d9920 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -192,7 +192,6 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
     int64_t			 blkno;
     xfs_buf_log_format_t lbuf;
     int			 size, blen, map_size, struct_size;
-    __be64		 x, y;
     unsigned short	 flags;
 
     /*
@@ -247,20 +246,22 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
 		if (be32_to_cpu(head->oh_len) < 4*8) {
 			printf(_("Out of space\n"));
 		} else {
+			__be64		 a, b;
+
 			printf("\n");
 			/*
 			 * memmove because *ptr may not be 8-byte aligned
 			 */
-			memmove(&x, *ptr, sizeof(__be64));
-			memmove(&y, *ptr+8, sizeof(__be64));
-		       printf(_("icount: %llu  ifree: %llu  "),
-			       (unsigned long long) be64_to_cpu(x),
-			       (unsigned long long) be64_to_cpu(y));
-			memmove(&x, *ptr+16, sizeof(__be64));
-			memmove(&y, *ptr+24, sizeof(__be64));
-		       printf(_("fdblks: %llu  frext: %llu\n"),
-			       (unsigned long long) be64_to_cpu(x),
-			       (unsigned long long) be64_to_cpu(y));
+			memmove(&a, *ptr, sizeof(__be64));
+			memmove(&b, *ptr+8, sizeof(__be64));
+			printf(_("icount: %llu  ifree: %llu  "),
+			       (unsigned long long) be64_to_cpu(a),
+			       (unsigned long long) be64_to_cpu(b));
+			memmove(&a, *ptr+16, sizeof(__be64));
+			memmove(&b, *ptr+24, sizeof(__be64));
+			printf(_("fdblks: %llu  frext: %llu\n"),
+			       (unsigned long long) be64_to_cpu(a),
+			       (unsigned long long) be64_to_cpu(b));
 		}
 		super_block = 0;
 	} else if (be32_to_cpu(*(__be32 *)(*ptr)) == XFS_AGI_MAGIC) {
@@ -1185,7 +1186,7 @@ xlog_print_extended_headers(
 	int 			num_hdrs;
 	int 			num_required;
 	char			xhbuf[XLOG_HEADER_SIZE];
-	xlog_rec_ext_header_t	*x;
+	xlog_rec_ext_header_t	*xhdr;
 
 	num_required = howmany(len, XLOG_HEADER_CYCLE_SIZE);
 	num_hdrs = be32_to_cpu(hdr->h_size) / XLOG_HEADER_CYCLE_SIZE;
@@ -1210,7 +1211,7 @@ xlog_print_extended_headers(
 	*ret_num_hdrs = num_hdrs;
 
 	/* don't include 1st header */
-	for (i = 1, x = *ret_xhdrs; i < num_hdrs; i++, (*blkno)++, x++) {
+	for (i = 1, xhdr = *ret_xhdrs; i < num_hdrs; i++, (*blkno)++, xhdr++) {
 	    /* read one extra header blk */
 	    if (read(fd, xhbuf, 512) == 0) {
 		printf(_("%s: physical end of log\n"), progname);
@@ -1240,9 +1241,9 @@ xlog_print_extended_headers(
 	     * will look asymmetric with the 1 hdr normal case
 	     * which does endian coversion on access.
 	     */
-	    x->xh_cycle = ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle;
+	    xhdr->xh_cycle = ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle;
 	    for (j = 0; j < XLOG_HEADER_CYCLE_SIZE / BBSIZE; j++) {
-		x->xh_cycle_data[j] =
+		xhdr->xh_cycle_data[j] =
 		    ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle_data[j];
 	    }
 	}
-- 
1.8.3.1

  parent reply	other threads:[~2018-10-11  3:25 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 20:01 [PATCH 00/18] xfsprogs: finer-grained sparse fixes Eric Sandeen
2018-10-10 20:01 ` [PATCH 01/18] xfsprogs: enable sparse checking with "make C=[12]" Eric Sandeen
2018-10-10 21:24   ` Darrick J. Wong
2018-10-10 22:18   ` [PATCH 01/18 V2] " Eric Sandeen
2018-10-11  5:57     ` Christoph Hellwig
2018-10-11 14:09       ` Eric Sandeen
2018-10-10 20:01 ` [PATCH 02/18] xfs_db: convert single-bit bitfields to bools Eric Sandeen
2018-10-11  5:58   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 03/18] xfsprogs: minor endian annotation fixes Eric Sandeen
2018-10-11  5:59   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 04/18] xfsprogs: avoid redefinition of NBBY Eric Sandeen
2018-10-11  5:59   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 05/18] xfsprogs: include headers for extern variables Eric Sandeen
2018-10-11  5:59   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 06/18] libxfs: add several zone extern declarations to libxfs_priv.h Eric Sandeen
2018-10-11  5:59   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 07/18] libxfs: silence static warnings about platform_* functions Eric Sandeen
2018-10-11  6:00   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 08/18] xfs_io: include io.h to silence static function warnings Eric Sandeen
2018-10-11  6:00   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 09/18] libxfs: silence sparse static function warnings in util.c Eric Sandeen
2018-10-11  6:00   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 10/18] avl64: export avl64_firstino / avl64_firstino from avl64.h Eric Sandeen
2018-10-11  6:01   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 11/18] xfsprogs: misc static function warning fixes Eric Sandeen
2018-10-11  6:01   ` Christoph Hellwig
2018-10-10 20:01 ` Eric Sandeen [this message]
2018-10-11  6:02   ` [PATCH 12/18] xfsprogs: don't shadow global libxfs_init x variable Christoph Hellwig
2018-10-10 20:01 ` [PATCH 13/18] xfs_io: rename global buffer variable Eric Sandeen
2018-10-11  6:02   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 14/18] xfs_logprint: fix shadow var in xlog_print_trans_buffer Eric Sandeen
2018-10-11  6:03   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 15/18] xfs_repair: fix 'bno' shadow vars in scan.c Eric Sandeen
2018-10-11  6:03   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 16/18] xfs_scrub: remove shadow var from run_scrub_phases() Eric Sandeen
2018-10-11  6:03   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 17/18] xfs_metadump: remove shadow variable Eric Sandeen
2018-10-10 21:34   ` Darrick J. Wong
2018-10-11  6:04   ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 18/18] libfrog: change project entity variable scope to local/static Eric Sandeen
2018-10-10 21:37 ` [PATCH 00/18] xfsprogs: finer-grained sparse fixes Darrick J. Wong

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=1539201682-22198-13-git-send-email-sandeen@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-xfs@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).