[PATCH] Make fio -W clean again
authorJens Axboe <jens.axboe@oracle.com>
Wed, 18 Oct 2006 15:16:23 +0000 (17:16 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 18 Oct 2006 15:16:23 +0000 (17:16 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Makefile
filesetup.c
fio.c
fio.h
init.c

index b9a7281153c67dd54b97969ac96ef7aeb8a61976..9dc4729f75e6626b5b0361a988ba4ef25cf78011 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CC     = gcc
 CC     = gcc
-CFLAGS = -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS = -W -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 PROGS  = fio
 SCRIPTS = fio_generate_plots
 
 PROGS  = fio
 SCRIPTS = fio_generate_plots
 
index 04052bf368e6a0ebd2fb17e9af1e1c57fcf13f4b..7ea5714a18b6e47cb6422d18a557c57ddbf2bef0 100644 (file)
@@ -358,11 +358,10 @@ int setup_files(struct thread_data *td)
 
 void close_files(struct thread_data *td)
 {
 
 void close_files(struct thread_data *td)
 {
+       struct fio_file *f;
        int i;
 
        int i;
 
-       for (i = 0; i < td->nr_files; i++) {
-               struct fio_file *f = &td->files[i];
-
+       for_each_file(td, f, i) {
                if (f->fd != -1) {
                        if (td->unlink && td->filetype == FIO_TYPE_FILE)
                                unlink(f->file_name);
                if (f->fd != -1) {
                        if (td->unlink && td->filetype == FIO_TYPE_FILE)
                                unlink(f->file_name);
diff --git a/fio.c b/fio.c
index 2b760ddd4beb0c56244637a626284b6faa47d9f8..f9b7e02ffb60a586ebf6d19c2e548df65e29367b 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -277,7 +277,7 @@ static int get_rw_ddir(struct thread_data *td)
                 * Check if it's time to seed a new data direction.
                 */
                if (elapsed >= td->rwmixcycle) {
                 * Check if it's time to seed a new data direction.
                 */
                if (elapsed >= td->rwmixcycle) {
-                       int v;
+                       unsigned int v;
                        long r;
 
                        r = os_random_long(&td->rwmix_state);
                        long r;
 
                        r = os_random_long(&td->rwmix_state);
@@ -422,7 +422,7 @@ static inline void td_set_runstate(struct thread_data *td, int runstate)
 
 static struct fio_file *get_next_file(struct thread_data *td)
 {
 
 static struct fio_file *get_next_file(struct thread_data *td)
 {
-       int old_next_file = td->next_file;
+       unsigned int old_next_file = td->next_file;
        struct fio_file *f;
 
        do {
        struct fio_file *f;
 
        do {
diff --git a/fio.h b/fio.h
index e279574a387026ab07e5b975df2a51fe5d384d0e..ca00a435d7b725826e496e79c4fdd3200d1f97cd 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -540,6 +540,6 @@ extern void close_ioengine(struct thread_data *);
 #define fio_unused     __attribute((__unused__))
 
 #define for_each_file(td, f, i)        \
 #define fio_unused     __attribute((__unused__))
 
 #define for_each_file(td, f, i)        \
-       for ((i) = 0, (f) = &(td)->files[0]; (i) < (td)->nr_files; (i)++, (f) = &(td)->files[(i)])
+       for ((i) = 0, (f) = &(td)->files[0]; (i) < (int) (td)->nr_files; (i)++, (f) = &(td)->files[(i)])
 
 #endif
 
 #endif
diff --git a/init.c b/init.c
index 91a1d507892e80f82dca9647c7be8eb0e266a7b6..fae35f3c8260fd140e0852d31d2f7abe1248e88a 100644 (file)
--- a/init.c
+++ b/init.c
@@ -275,6 +275,7 @@ int init_random_state(struct thread_data *td)
 {
        unsigned long seeds[4];
        int fd, num_maps, blocks, i;
 {
        unsigned long seeds[4];
        int fd, num_maps, blocks, i;
+       struct fio_file *f;
 
        fd = open("/dev/urandom", O_RDONLY);
        if (fd == -1) {
 
        fd = open("/dev/urandom", O_RDONLY);
        if (fd == -1) {
@@ -300,9 +301,7 @@ int init_random_state(struct thread_data *td)
        if (td->rand_repeatable)
                seeds[3] = DEF_RANDSEED;
 
        if (td->rand_repeatable)
                seeds[3] = DEF_RANDSEED;
 
-       for (i = 0; i < td->nr_files; i++) {
-               struct fio_file *f = &td->files[i];
-
+       for_each_file(td, f, i) {
                blocks = (f->file_size + td->min_bs - 1) / td->min_bs;
                num_maps = blocks / BLOCKS_PER_MAP;
                f->file_map = malloc(num_maps * sizeof(long));
                blocks = (f->file_size + td->min_bs - 1) / td->min_bs;
                num_maps = blocks / BLOCKS_PER_MAP;
                f->file_map = malloc(num_maps * sizeof(long));
@@ -1056,7 +1055,7 @@ static int fill_def_thread(void)
        return 0;
 }
 
        return 0;
 }
 
-static void usage(char *name)
+static void usage(void)
 {
        printf("%s\n", fio_version_string);
        printf("\t-o Write output to file\n");
 {
        printf("%s\n", fio_version_string);
        printf("\t-o Write output to file\n");
@@ -1099,7 +1098,7 @@ static int parse_cmd_line(int argc, char *argv[])
                                idx = optind;
                                break;
                        case 'h':
                                idx = optind;
                                break;
                        case 'h':
-                               usage(argv[0]);
+                               usage();
                                exit(0);
                        case 'v':
                                printf("%s\n", fio_version_string);
                                exit(0);
                        case 'v':
                                printf("%s\n", fio_version_string);
@@ -1183,7 +1182,7 @@ int parse_options(int argc, char *argv[])
        job_files = parse_cmd_line(argc, argv);
        if (!job_files) {
                log_err("Need job file(s)\n");
        job_files = parse_cmd_line(argc, argv);
        if (!job_files) {
                log_err("Need job file(s)\n");
-               usage(argv[0]);
+               usage();
                return 1;
        }
 
                return 1;
        }