verify: don't use void* for pointer arithmetic (gcc)
authorTomohiro Kusumi <tkusumi@tuxera.com>
Fri, 23 Jun 2017 22:08:00 +0000 (01:08 +0300)
committerJens Axboe <axboe@kernel.dk>
Fri, 23 Jun 2017 22:19:53 +0000 (16:19 -0600)
I think gcc extension should be avoided when it can be done by
just changing a pointer type.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
t/verify-state.c
verify-state.h
verify.c

index 9a2c3df68cb1db568844ad263a600b3a43285167..78a56dafd26878e3a5fec7bced3382fe20385c43 100644 (file)
@@ -58,7 +58,8 @@ static void show(struct thread_io_list *s, size_t size)
                show_s(s, no_s);
                no_s++;
                size -= __thread_io_list_sz(s->depth, s->nofiles);
-               s = (void *) s + __thread_io_list_sz(s->depth, s->nofiles);
+               s = (struct thread_io_list *)((char *) s +
+                       __thread_io_list_sz(s->depth, s->nofiles));
        } while (size != 0);
 }
 
index e46265e48d7a6c4ddbbac34a458e26d3272d60da..1586f63fb0f0a61f7eea2a6db90876b24f895960 100644 (file)
@@ -77,7 +77,7 @@ static inline size_t thread_io_list_sz(struct thread_io_list *s)
 
 static inline struct thread_io_list *io_list_next(struct thread_io_list *s)
 {
-       return (void *) s + thread_io_list_sz(s);
+       return (struct thread_io_list *)((char *) s + thread_io_list_sz(s));
 }
 
 static inline void verify_state_gen_name(char *out, size_t size,
index ffd8707fc44cb3e2cc7c8edb39212c217c5dd5c1..1f177d756d24a6e6059f46bb5337870a4dc65214 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -388,7 +388,7 @@ static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc)
        (void)paste_format_inplace(pattern, pattern_size,
                                   td->o.verify_fmt, td->o.verify_fmt_sz, io_u);
 
-       buf = (void *) hdr + header_size;
+       buf = (char *) hdr + header_size;
        len = get_hdr_inc(td, io_u) - header_size;
        mod = (get_hdr_inc(td, io_u) * vc->hdr_num + header_size) % pattern_size;
 
@@ -1188,9 +1188,10 @@ static void populate_hdr(struct thread_data *td, struct io_u *io_u,
                         unsigned int header_len)
 {
        unsigned int data_len;
-       void *data, *p;
+       void *data;
+       char *p;
 
-       p = (void *) hdr;
+       p = (char *) hdr;
 
        fill_hdr(td, io_u, hdr, header_num, header_len, io_u->rand_seed);