[PATCH] Assorted compiler warnings
authorJens Axboe <axboe@suse.de>
Thu, 29 Sep 2005 10:01:37 +0000 (12:01 +0200)
committerJens Axboe <axboe@suse.de>
Thu, 29 Sep 2005 10:01:37 +0000 (12:01 +0200)
blkparse.c
blkparse_fmt.c
blktrace.c
blktrace.h

index 93b6f0915df59857d57ccb5fb42927caf12ff84c..bf930e7f0d643e037c0da9a48c6690e14771a1b0 100644 (file)
@@ -203,7 +203,7 @@ static int track_ios;
 static int ppi_hash_by_pid = 1;
 
 #define RB_BATCH_DEFAULT       (512)
-static int rb_batch = RB_BATCH_DEFAULT;
+static unsigned int rb_batch = RB_BATCH_DEFAULT;
 
 static int pipeline;
 
@@ -1423,7 +1423,7 @@ static int read_data(int fd, void *buffer, int bytes, int block)
 static int read_events(int fd, int always_block)
 {
        struct per_dev_info *pdi = NULL;
-       int events = 0;
+       unsigned int events = 0;
 
        while (!is_done() && events < rb_batch) {
                struct blk_io_trace *bit;
@@ -1600,7 +1600,7 @@ static void flush_output(void)
        fflush(ofp);
 }
 
-static void handle_sigint(int sig)
+static void handle_sigint(__attribute__((__unused__)) int sig)
 {
        done = 1;
        flush_output();
index ebf97c66d27d08efca0ad3bf17c3c990d39013da..30bab91a02195347bb880f8097af04d4e9aecb9d 100644 (file)
@@ -21,16 +21,16 @@ static inline int valid_spec(int spec)
        return strchr(VALID_SPECS, spec) != NULL;
 }
 
-void set_all_format_specs(char *optarg)
+void set_all_format_specs(char *option)
 {
        char *p;
 
        for (p = VALID_SPECS; *p; p++)
                if (override_format[(int)(*p)] == NULL)
-                       override_format[(int)(*p)] = strdup(optarg);
+                       override_format[(int)(*p)] = strdup(option);
 }
 
-int add_format_spec(char *optarg)
+int add_format_spec(char *option)
 {
        int spec = optarg[0];
 
@@ -39,12 +39,12 @@ int add_format_spec(char *optarg)
                return 1;
        }
        if (optarg[1] != ',') {
-               fprintf(stderr,"Bad format specifier - need ',' %s\n", optarg);
+               fprintf(stderr,"Bad format specifier - need ',' %s\n", option);
                return 1;
        }
-       optarg += 2;
-       if (*optarg == '\0') {
-               fprintf(stderr,"Bad format specifier - need fmt %s\n", optarg);
+       option += 2;
+       if (*option == '\0') {
+               fprintf(stderr,"Bad format specifier - need fmt %s\n", option);
                return 1;
        }
 
@@ -52,10 +52,10 @@ int add_format_spec(char *optarg)
         * Set both merges (front and back)
         */
        if (spec == 'M') {
-               override_format['B'] = strdup(optarg);
-               override_format['M'] = strdup(optarg);
+               override_format['B'] = strdup(option);
+               override_format['M'] = strdup(option);
        } else
-               override_format[spec] = strdup(optarg);
+               override_format[spec] = strdup(option);
 
        return 0;
 }
index 0fc69ebec1fe056832db690373709296aef7d106..d9a8910a9131042ab573c3472033a0ce47bf8f80 100644 (file)
@@ -172,8 +172,8 @@ static char *output_name;
 static int act_mask = ~0U;
 static int kill_running_trace;
 static int use_mmap;
-static int buf_size = BUF_SIZE;
-static int buf_nr = BUF_NR;
+static unsigned int buf_size = BUF_SIZE;
+static unsigned int buf_nr = BUF_NR;
 
 #define is_done()      (*(volatile int *)(&done))
 static volatile int done;
@@ -184,7 +184,7 @@ static void exit_trace(int status);
 
 static int find_mask_map(char *string)
 {
-       int i;
+       unsigned int i;
 
        for (i = 0; i < sizeof(mask_maps)/sizeof(mask_maps[0]); i++)
                if (COMPARE_MASK_MAP(&mask_maps[i], string))
@@ -261,8 +261,8 @@ static int get_data_read(struct thread_information *tip, void *buf, int len)
        return -1;
 }
 
-static int get_data_mmap(struct thread_information *tip, void *buf, int len,
-                        int check_magic)
+static int get_data_mmap(struct thread_information *tip, void *buf,
+                        unsigned int len, int check_magic)
 {
        if (len > (buf_size * (tip->buf_subbuf + 1)) - tip->buf_offset) {
                tip->buf_subbuf++;
@@ -304,7 +304,7 @@ static int get_data(struct thread_information *tip, void *buf, int len,
                return get_data_read(tip, buf, len);
 }
 
-static void *extract_data(struct thread_information *tip, char *ofn, int nb)
+static void *extract_data(struct thread_information *tip, int nb)
 {
        unsigned char *buf;
 
@@ -333,7 +333,7 @@ static void *extract(void *arg)
 {
        struct thread_information *tip = arg;
        int ret, pdu_len;
-       char dp[64], *pdu_data;
+       char *pdu_data;
        struct blk_io_trace t;
        pid_t pid = getpid();
        cpu_set_t cpu_mask;
@@ -378,7 +378,7 @@ static void *extract(void *arg)
                trace_to_be(&t);
 
                if (pdu_len)
-                       pdu_data = extract_data(tip, dp, pdu_len);
+                       pdu_data = extract_data(tip, pdu_len);
 
                /*
                 * now we have both trace and payload, get a lock on the
@@ -621,7 +621,7 @@ static void show_usage(char *program)
        fprintf(stderr, "Usage: %s %s %s",program, blktrace_version, usage_str);
 }
 
-static void handle_sigint(int sig)
+static void handle_sigint(__attribute__((__unused__)) int sig)
 {
        done = 1;
 }
index bd704bac42defdca9fb8438e8052c1e4907130e7..799acf869613a1562eb3d75b8a31b0d91627dc82 100644 (file)
@@ -29,8 +29,8 @@ struct io_stats {
 };
 
 struct per_cpu_info {
-       int cpu;
-       int nelems;
+       unsigned int cpu;
+       unsigned int nelems;
 
        int fd;
        char fname[128];