From e820abd79354e5b8596e1ec8105ffe36d36f9c20 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 29 Sep 2005 12:01:37 +0200 Subject: [PATCH] [PATCH] Assorted compiler warnings --- blkparse.c | 6 +++--- blkparse_fmt.c | 20 ++++++++++---------- blktrace.c | 18 +++++++++--------- blktrace.h | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/blkparse.c b/blkparse.c index 93b6f09..bf930e7 100644 --- a/blkparse.c +++ b/blkparse.c @@ -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(); diff --git a/blkparse_fmt.c b/blkparse_fmt.c index ebf97c6..30bab91 100644 --- a/blkparse_fmt.c +++ b/blkparse_fmt.c @@ -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; } diff --git a/blktrace.c b/blktrace.c index 0fc69eb..d9a8910 100644 --- a/blktrace.c +++ b/blktrace.c @@ -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; } diff --git a/blktrace.h b/blktrace.h index bd704ba..799acf8 100644 --- a/blktrace.h +++ b/blktrace.h @@ -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]; -- 2.25.1