Get rid of shadow declarations
authorJens Axboe <jaxboe@fusionio.com>
Wed, 19 Jan 2011 21:04:16 +0000 (14:04 -0700)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 19 Jan 2011 21:04:16 +0000 (14:04 -0700)
Reported-by: Bruce Cran <bruce@cran.org.uk>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
crc/sha256.c
crc/sha512.c
engines/sg.c
engines/sync.c
eta.c
fio.c
init.c
io_u.c
stat.c
verify.c

index 0091d4477284dca5deca9c3e603c4e292ddac2b2..dcb1677274a128cd584a19d4144a776531c3b187 100644 (file)
@@ -243,10 +243,10 @@ void sha256_init(struct sha256_ctx *sctx)
 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 @@ void sha256_update(struct sha256_ctx *sctx, const uint8_t *data,
                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);
 }
index 0d44ace580dbe1795a000d68c987775c63b786ff..9268a4900e01006ddae9ca2c6fc745a5e146e523 100644 (file)
@@ -162,10 +162,10 @@ void sha512_init(struct sha512_ctx *sctx)
 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 @@ void sha512_update(struct sha512_ctx *sctx, const uint8_t *data,
                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));
index ac1d999797a2bd1f5bc7622340b2a7773887a004..88d91258d22c89e78298c6084e7dd277b51aa23e 100644 (file)
@@ -166,7 +166,7 @@ static int fio_sgio_ioctl_doio(struct thread_data *td,
        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 @@ static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int sync)
        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 @@ static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int sync)
        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)
index 4eea2f9268bd68eb5eecdecfbcf42e01670ad88b..3377f81a627f3578c713f049610151f8c7d218eb 100644 (file)
@@ -141,11 +141,11 @@ static int fio_vsyncio_append(struct thread_data *td, struct io_u *io_u)
 }
 
 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 ba6a3989366f37b025c42b5a4569e91ab707febe..b367ce9d7722cf492811b38deb85e83afc56cf35 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -391,7 +391,7 @@ void print_thread_status(void)
        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 067aa245a04e9d3dd63d2a020b2f72cd33aad975..e205b3aa52ac9f9a693fd249c52de1b84f45afb8 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -497,7 +497,6 @@ static void do_verify(struct thread_data *td)
                                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 @@ static void do_verify(struct thread_data *td)
                                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 @@ static void run_threads(void)
                        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 4ce57a4f3dc4e7a7814a10d4eb05ffa22f3047a3..c3f23f93c1926ee5b9b35c3223b7ec1a1f520519 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1039,8 +1039,6 @@ static int set_debug(const char *string)
        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 185bba03d9829052877b118f03257156c2eb2bc0..1a45706f160556f2c153bf82505370b484d7055e 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -635,31 +635,31 @@ out:
 
 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_complete(struct thread_data *td, unsigned int nr)
 
 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 a596388a41c5b00f820fb2f79f69436dfecd9aa2..d95be758334329b0e681347d419522e82ee1cd45 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -728,7 +728,7 @@ static inline void add_stat_sample(struct io_stat *is, unsigned long data)
 
 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 @@ static void __add_log_sample(struct io_log *iolog, unsigned long val,
        }
 
        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++;
index 3eac9cab4ebaa975c7e20f4e57aade6bbc1738f9..fc207cf635bc731fbdbb788d4f791bb9bba4124b 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -333,13 +333,13 @@ static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc)
        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 @@ static int verify_trimmed_io_u(struct thread_data *td, struct io_u *io_u)
 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 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
                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) {