Get rid of shadow declarations

Reported-by: Bruce Cran <bruce@cran.org.uk>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
diff --git a/crc/sha256.c b/crc/sha256.c
index 0091d44..dcb1677 100644
--- a/crc/sha256.c
+++ b/crc/sha256.c
@@ -243,10 +243,10 @@
 void sha256_update(struct sha256_ctx *sctx, const uint8_t *data,
 		   unsigned int len)
 {
-	unsigned int i, index, part_len;
+	unsigned int i, idx, part_len;
 
 	/* Compute number of bytes mod 128 */
-	index = (unsigned int)((sctx->count[0] >> 3) & 0x3f);
+	idx = (unsigned int)((sctx->count[0] >> 3) & 0x3f);
 
 	/* Update number of bits */
 	if ((sctx->count[0] += (len << 3)) < (len << 3)) {
@@ -254,20 +254,20 @@
 		sctx->count[1] += (len >> 29);
 	}
 
-	part_len = 64 - index;
+	part_len = 64 - idx;
 
 	/* Transform as many times as possible. */
 	if (len >= part_len) {
-		memcpy(&sctx->buf[index], data, part_len);
+		memcpy(&sctx->buf[idx], data, part_len);
 		sha256_transform(sctx->state, sctx->buf);
 
 		for (i = part_len; i + 63 < len; i += 64)
 			sha256_transform(sctx->state, &data[i]);
-		index = 0;
+		idx = 0;
 	} else {
 		i = 0;
 	}
 	
 	/* Buffer remaining input */
-	memcpy(&sctx->buf[index], &data[i], len-i);
+	memcpy(&sctx->buf[idx], &data[i], len-i);
 }
diff --git a/crc/sha512.c b/crc/sha512.c
index 0d44ace..9268a49 100644
--- a/crc/sha512.c
+++ b/crc/sha512.c
@@ -162,10 +162,10 @@
 void sha512_update(struct sha512_ctx *sctx, const uint8_t *data,
 		   unsigned int len)
 {
-	unsigned int i, index, part_len;
+	unsigned int i, idx, part_len;
 
 	/* Compute number of bytes mod 128 */
-	index = (unsigned int)((sctx->count[0] >> 3) & 0x7F);
+	idx = (unsigned int)((sctx->count[0] >> 3) & 0x7F);
 	
 	/* Update number of bits */
 	if ((sctx->count[0] += (len << 3)) < (len << 3)) {
@@ -175,23 +175,23 @@
 		sctx->count[1] += (len >> 29);
 	}
 	
-        part_len = 128 - index;
+        part_len = 128 - idx;
 	
 	/* Transform as many times as possible. */
 	if (len >= part_len) {
-		memcpy(&sctx->buf[index], data, part_len);
+		memcpy(&sctx->buf[idx], data, part_len);
 		sha512_transform(sctx->state, sctx->W, sctx->buf);
 
 		for (i = part_len; i + 127 < len; i+=128)
 			sha512_transform(sctx->state, sctx->W, &data[i]);
 
-		index = 0;
+		idx = 0;
 	} else {
 		i = 0;
 	}
 
 	/* Buffer remaining input */
-	memcpy(&sctx->buf[index], &data[i], len - i);
+	memcpy(&sctx->buf[idx], &data[i], len - i);
 
 	/* erase our data */
 	memset(sctx->W, 0, sizeof(sctx->W));
diff --git a/engines/sg.c b/engines/sg.c
index ac1d999..88d9125 100644
--- a/engines/sg.c
+++ b/engines/sg.c
@@ -166,7 +166,7 @@
 	return FIO_Q_COMPLETED;
 }
 
-static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int sync)
+static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int do_sync)
 {
 	struct sg_io_hdr *hdr = &io_u->hdr;
 	int ret;
@@ -175,7 +175,7 @@
 	if (ret < 0)
 		return ret;
 
-	if (sync) {
+	if (do_sync) {
 		ret = read(f->fd, hdr, sizeof(*hdr));
 		if (ret < 0)
 			return ret;
@@ -185,14 +185,14 @@
 	return FIO_Q_QUEUED;
 }
 
-static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int sync)
+static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int do_sync)
 {
 	struct fio_file *f = io_u->file;
 
 	if (f->filetype == FIO_TYPE_BD)
 		return fio_sgio_ioctl_doio(td, f, io_u);
 
-	return fio_sgio_rw_doio(f, io_u, sync);
+	return fio_sgio_rw_doio(f, io_u, do_sync);
 }
 
 static int fio_sgio_prep(struct thread_data *td, struct io_u *io_u)
diff --git a/engines/sync.c b/engines/sync.c
index 4eea2f9..3377f81 100644
--- a/engines/sync.c
+++ b/engines/sync.c
@@ -141,11 +141,11 @@
 }
 
 static void fio_vsyncio_set_iov(struct syncio_data *sd, struct io_u *io_u,
-				int index)
+				int idx)
 {
-	sd->io_us[index] = io_u;
-	sd->iovecs[index].iov_base = io_u->xfer_buf;
-	sd->iovecs[index].iov_len = io_u->xfer_buflen;
+	sd->io_us[idx] = io_u;
+	sd->iovecs[idx].iov_base = io_u->xfer_buf;
+	sd->iovecs[idx].iov_len = io_u->xfer_buflen;
 	sd->last_offset = io_u->offset + io_u->xfer_buflen;
 	sd->last_file = io_u->file;
 	sd->last_ddir = io_u->ddir;
diff --git a/eta.c b/eta.c
index ba6a398..b367ce9 100644
--- a/eta.c
+++ b/eta.c
@@ -391,7 +391,7 @@
 	fflush(stdout);
 }
 
-void print_status_init(int thread_number)
+void print_status_init(int thr_number)
 {
-	run_str[thread_number] = 'P';
+	run_str[thr_number] = 'P';
 }
diff --git a/fio.c b/fio.c
index 067aa24..e205b3a 100644
--- a/fio.c
+++ b/fio.c
@@ -497,7 +497,6 @@
 				clear_io_u(td, io_u);
 			} else if (io_u->resid) {
 				int bytes = io_u->xfer_buflen - io_u->resid;
-				struct fio_file *f = io_u->file;
 
 				/*
 				 * zero read, fail
@@ -515,6 +514,7 @@
 				if (ddir_rw(io_u->ddir))
 					td->ts.short_io_u[io_u->ddir]++;
 
+				f = io_u->file;
 				if (io_u->offset == f->real_file_size)
 					goto sync_done;
 
@@ -1497,14 +1497,14 @@
 			todo--;
 		} else {
 			struct fio_file *f;
-			unsigned int i;
+			unsigned int j;
 
 			/*
 			 * for sharing to work, each job must always open
 			 * its own files. so close them, if we opened them
 			 * for creation
 			 */
-			for_each_file(td, f, i) {
+			for_each_file(td, f, j) {
 				if (fio_file_open(f))
 					td_io_close_file(td, f);
 			}
diff --git a/init.c b/init.c
index 4ce57a4..c3f23f9 100644
--- a/init.c
+++ b/init.c
@@ -1039,8 +1039,6 @@
 	int i;
 
 	if (!strcmp(string, "?") || !strcmp(string, "help")) {
-		int i;
-
 		log_info("fio: dumping debug options:");
 		for (i = 0; debug_levels[i].name; i++) {
 			dl = &debug_levels[i];
diff --git a/io_u.c b/io_u.c
index 185bba0..1a45706 100644
--- a/io_u.c
+++ b/io_u.c
@@ -635,31 +635,31 @@
 
 static void __io_u_mark_map(unsigned int *map, unsigned int nr)
 {
-	int index = 0;
+	int idx = 0;
 
 	switch (nr) {
 	default:
-		index = 6;
+		idx = 6;
 		break;
 	case 33 ... 64:
-		index = 5;
+		idx = 5;
 		break;
 	case 17 ... 32:
-		index = 4;
+		idx = 4;
 		break;
 	case 9 ... 16:
-		index = 3;
+		idx = 3;
 		break;
 	case 5 ... 8:
-		index = 2;
+		idx = 2;
 		break;
 	case 1 ... 4:
-		index = 1;
+		idx = 1;
 	case 0:
 		break;
 	}
 
-	map[index]++;
+	map[idx]++;
 }
 
 void io_u_mark_submit(struct thread_data *td, unsigned int nr)
@@ -676,117 +676,117 @@
 
 void io_u_mark_depth(struct thread_data *td, unsigned int nr)
 {
-	int index = 0;
+	int idx = 0;
 
 	switch (td->cur_depth) {
 	default:
-		index = 6;
+		idx = 6;
 		break;
 	case 32 ... 63:
-		index = 5;
+		idx = 5;
 		break;
 	case 16 ... 31:
-		index = 4;
+		idx = 4;
 		break;
 	case 8 ... 15:
-		index = 3;
+		idx = 3;
 		break;
 	case 4 ... 7:
-		index = 2;
+		idx = 2;
 		break;
 	case 2 ... 3:
-		index = 1;
+		idx = 1;
 	case 1:
 		break;
 	}
 
-	td->ts.io_u_map[index] += nr;
+	td->ts.io_u_map[idx] += nr;
 }
 
 static void io_u_mark_lat_usec(struct thread_data *td, unsigned long usec)
 {
-	int index = 0;
+	int idx = 0;
 
 	assert(usec < 1000);
 
 	switch (usec) {
 	case 750 ... 999:
-		index = 9;
+		idx = 9;
 		break;
 	case 500 ... 749:
-		index = 8;
+		idx = 8;
 		break;
 	case 250 ... 499:
-		index = 7;
+		idx = 7;
 		break;
 	case 100 ... 249:
-		index = 6;
+		idx = 6;
 		break;
 	case 50 ... 99:
-		index = 5;
+		idx = 5;
 		break;
 	case 20 ... 49:
-		index = 4;
+		idx = 4;
 		break;
 	case 10 ... 19:
-		index = 3;
+		idx = 3;
 		break;
 	case 4 ... 9:
-		index = 2;
+		idx = 2;
 		break;
 	case 2 ... 3:
-		index = 1;
+		idx = 1;
 	case 0 ... 1:
 		break;
 	}
 
-	assert(index < FIO_IO_U_LAT_U_NR);
-	td->ts.io_u_lat_u[index]++;
+	assert(idx < FIO_IO_U_LAT_U_NR);
+	td->ts.io_u_lat_u[idx]++;
 }
 
 static void io_u_mark_lat_msec(struct thread_data *td, unsigned long msec)
 {
-	int index = 0;
+	int idx = 0;
 
 	switch (msec) {
 	default:
-		index = 11;
+		idx = 11;
 		break;
 	case 1000 ... 1999:
-		index = 10;
+		idx = 10;
 		break;
 	case 750 ... 999:
-		index = 9;
+		idx = 9;
 		break;
 	case 500 ... 749:
-		index = 8;
+		idx = 8;
 		break;
 	case 250 ... 499:
-		index = 7;
+		idx = 7;
 		break;
 	case 100 ... 249:
-		index = 6;
+		idx = 6;
 		break;
 	case 50 ... 99:
-		index = 5;
+		idx = 5;
 		break;
 	case 20 ... 49:
-		index = 4;
+		idx = 4;
 		break;
 	case 10 ... 19:
-		index = 3;
+		idx = 3;
 		break;
 	case 4 ... 9:
-		index = 2;
+		idx = 2;
 		break;
 	case 2 ... 3:
-		index = 1;
+		idx = 1;
 	case 0 ... 1:
 		break;
 	}
 
-	assert(index < FIO_IO_U_LAT_M_NR);
-	td->ts.io_u_lat_m[index]++;
+	assert(idx < FIO_IO_U_LAT_M_NR);
+	td->ts.io_u_lat_m[idx]++;
 }
 
 static void io_u_mark_latency(struct thread_data *td, unsigned long usec)
diff --git a/stat.c b/stat.c
index a596388..d95be75 100644
--- a/stat.c
+++ b/stat.c
@@ -728,7 +728,7 @@
 
 static void __add_log_sample(struct io_log *iolog, unsigned long val,
 			     enum fio_ddir ddir, unsigned int bs,
-			     unsigned long time)
+			     unsigned long t)
 {
 	const int nr_samples = iolog->nr_samples;
 
@@ -740,7 +740,7 @@
 	}
 
 	iolog->log[nr_samples].val = val;
-	iolog->log[nr_samples].time = time;
+	iolog->log[nr_samples].time = t;
 	iolog->log[nr_samples].ddir = ddir;
 	iolog->log[nr_samples].bs = bs;
 	iolog->nr_samples++;
diff --git a/verify.c b/verify.c
index 3eac9ca..fc207cf 100644
--- a/verify.c
+++ b/verify.c
@@ -333,13 +333,13 @@
 	struct thread_data *td = vc->td;
 	struct io_u *io_u = vc->io_u;
 	char *buf, *pattern;
-	unsigned int hdr_size = __hdr_size(td->o.verify);
+	unsigned int header_size = __hdr_size(td->o.verify);
 	unsigned int len, mod, i;
 
 	pattern = td->o.verify_pattern;
-	buf = (void *) hdr + hdr_size;
-	len = get_hdr_inc(td, io_u) - hdr_size;
-	mod = hdr_size % td->o.verify_pattern_bytes;
+	buf = (void *) hdr + header_size;
+	len = get_hdr_inc(td, io_u) - header_size;
+	mod = header_size % td->o.verify_pattern_bytes;
 
 	for (i = 0; i < len; i++) {
 		if (buf[i] != pattern[mod]) {
@@ -653,7 +653,7 @@
 int verify_io_u(struct thread_data *td, struct io_u *io_u)
 {
 	struct verify_header *hdr;
-	unsigned int hdr_size, hdr_inc, hdr_num = 0;
+	unsigned int header_size, hdr_inc, hdr_num = 0;
 	void *p;
 	int ret;
 
@@ -678,9 +678,9 @@
 		if (ret && td->o.verify_fatal)
 			break;
 
-		hdr_size = __hdr_size(td->o.verify);
+		header_size = __hdr_size(td->o.verify);
 		if (td->o.verify_offset)
-			memswp(p, p + td->o.verify_offset, hdr_size);
+			memswp(p, p + td->o.verify_offset, header_size);
 		hdr = p;
 
 		if (hdr->fio_magic != FIO_HDR_MAGIC) {