From 5be4bdaf2c5a06261f0f36603190f67cc7164a7b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 27 Jan 2006 16:26:25 +0100 Subject: [PATCH] [PATCH] blktrace/blkrawverify: get rid of pesky signedness warnings --- blkrawverify.c | 12 ++++++------ blktrace.c | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/blkrawverify.c b/blkrawverify.c index 8abbda7..88d91a5 100644 --- a/blkrawverify.c +++ b/blkrawverify.c @@ -77,9 +77,9 @@ static struct act_info acts[] = { static char *act_to_str(__u32 action) { static char buf[1024]; - int i; - int act = action & 0xffff; - int trace = (action >> BLK_TC_SHIFT) & 0xffff; + unsigned int i; + unsigned int act = action & 0xffff; + unsigned int trace = (action >> BLK_TC_SHIFT) & 0xffff; if (act <= N_ACTS) { sprintf(buf, "%s ", acts[act].string); @@ -113,7 +113,7 @@ static void dump_trace(FILE *ofp, char *prefix, struct blk_io_trace *bit) MINOR(bit->device)); } -static int process(FILE *ofp, char *file, int cpu) +static int process(FILE *ofp, char *file, unsigned int cpu) { # define SWAP_BITS() do { \ if (bit_save) { \ @@ -159,7 +159,7 @@ static int process(FILE *ofp, char *file, int cpu) pdu_buf = malloc(bit->pdu_len); n = fread(pdu_buf, bit->pdu_len, 1, ifp); - if (n <= 0) { + if (n == 0) { INC_BAD("bad pdu"); nbad_seq++; break; @@ -199,7 +199,7 @@ static int process(FILE *ofp, char *file, int cpu) SWAP_BITS(); } - if (n < 0) + if (n == 0) fprintf(stderr,"%s: fread failed %d/%s\n", file, errno, strerror(errno)); fclose(ifp); diff --git a/blktrace.c b/blktrace.c index 1ddcd83..0207dec 100644 --- a/blktrace.c +++ b/blktrace.c @@ -133,8 +133,8 @@ static struct option l_opts[] = { struct tip_subbuf { struct list_head list; void *buf; - int len; - int max_len; + unsigned int len; + unsigned int max_len; }; struct thread_information { @@ -334,7 +334,7 @@ static inline void tip_fd_lock(struct thread_information *tip) static int get_subbuf(struct thread_information *tip) { struct tip_subbuf *ts; - int ts_size; + int ts_size, ret; /* * live tracing should get a lower count to make it more "realtime" @@ -348,8 +348,9 @@ static int get_subbuf(struct thread_information *tip) ts->buf = malloc(ts_size); ts->max_len = ts_size; - ts->len = read_data(tip, ts->buf, ts_size); - if (ts->len > 0) { + ret = read_data(tip, ts->buf, ts_size); + if (ret > 0) { + ts->len = ret; tip_fd_lock(tip); list_add_tail(&ts->list, &tip->subbuf_list); tip_fd_unlock(tip); -- 2.25.1