Fix 32-bit compile warnings
authorJens Axboe <axboe@fb.com>
Tue, 23 Sep 2014 22:06:04 +0000 (16:06 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 23 Sep 2014 22:06:04 +0000 (16:06 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
lib/zipf.c
t/btrace2fio.c
t/dedupe.c
t/lfsr-test.c

index e75dc2aa64409f923daeede3d28941da57b38f4e..c691bc51a5a57f6e84ef2450d47fb0ad12f02bcc 100644 (file)
@@ -23,7 +23,7 @@ static void zipf_update(struct zipf_state *zs)
         * 10M max, that should be doable in 1-2s on even slow machines.
         * Precision will take a slight hit, but nothing major.
         */
-       to_gen = min(zs->nranges, ZIPF_MAX_GEN);
+       to_gen = min(zs->nranges, (uint64_t) ZIPF_MAX_GEN);
 
        for (i = 0; i < to_gen; i++)
                zs->zetan += pow(1.0 / (double) (i + 1), zs->theta);
index e4e05ca4394f938f9b704bb57c51825746262c5a..5666a560c0beca15941ad596a3469a4422264d36 100644 (file)
@@ -589,7 +589,7 @@ static void __output_p_ascii(struct btrace_pid *p, unsigned long *ios)
                perc = ((float) o->merges[i] * 100.0) / (float) total;
                printf("\tmerges: %lu (perc=%3.2f%%)\n", o->merges[i], perc);
                perc = ((float) o->seq[i] * 100.0) / (float) o->ios[i];
-               printf("\tseq:    %lu (perc=%3.2f%%)\n", o->seq[i], perc);
+               printf("\tseq:    %lu (perc=%3.2f%%)\n", (unsigned long) o->seq[i], perc);
                printf("\trate:   %lu KB/sec\n", o_to_kb_rate(o, i));
 
                for (j = 0; j < o->nr_bs[i]; j++) {
index d816a09382d5b092ef64bbaa5b1cc77284e0fd46..e51e444e7b82f441d67d0d7dab9600dd09e3f081 100644 (file)
@@ -368,7 +368,7 @@ static int dedupe_check(const char *filename)
                return 1;
        }
 
-       printf("Will check <%s>, size <%lu>\n", filename, dev_size);
+       printf("Will check <%s>, size <%llu>\n", filename, (unsigned long long) dev_size);
 
        return __dedupe_check(dev_fd, dev_size);
 }
@@ -378,10 +378,10 @@ static void show_chunk(struct chunk *c)
        struct flist_head *n;
        struct extent *e;
 
-       printf("c hash %8x %8x %8x %8x, count %lu\n", c->hash[0], c->hash[1], c->hash[2], c->hash[3], c->count);
+       printf("c hash %8x %8x %8x %8x, count %lu\n", c->hash[0], c->hash[1], c->hash[2], c->hash[3], (unsigned long) c->count);
        flist_for_each(n, &c->extent_list) {
                e = flist_entry(n, struct extent, list);
-               printf("\toffset %lu\n", e->offset);
+               printf("\toffset %llu\n", (unsigned long long) e->offset);
        }
 }
 
@@ -410,7 +410,7 @@ static void iter_rb_tree(void)
 
        } while ((n = rb_next(n)) != NULL);
 
-       printf("Extents=%lu, Unique extents=%lu\n", nextents, nchunks);
+       printf("Extents=%lu, Unique extents=%lu\n", (unsigned long) nextents, (unsigned long) nchunks);
        printf("De-dupe factor: %3.2f\n", (double) nextents / (double) nchunks);
 
        perc = 1.00 - ((double) nchunks / (double) nextents);
index d371087cf42a85b3c8ded574fb2fc88bcfd5cddf..481f37e8ddf640322764f66ff9d549d665803bcb 100644 (file)
@@ -65,11 +65,11 @@ int main(int argc, char *argv[])
        printf("LFSR specs\n");
        printf("==========================\n");
        printf("Size is         %u\n", 64 - __builtin_clzl(fl->cached_bit));
-       printf("Max val is      %lu\n", fl->max_val);
-       printf("XOR-mask is     0x%lX\n", fl->xormask);
-       printf("Seed is         %lu\n", fl->last_val);
+       printf("Max val is      %lu\n", (unsigned long) fl->max_val);
+       printf("XOR-mask is     0x%lX\n", (unsigned long) fl->xormask);
+       printf("Seed is         %lu\n", (unsigned long) fl->last_val);
        printf("Spin is         %u\n", fl->spin);
-       printf("Cycle length is %lu\n", fl->cycle_length);
+       printf("Cycle length is %lu\n", (unsigned long) fl->cycle_length);
 
        /* Create verification table */
        if (verify) {
@@ -102,7 +102,8 @@ int main(int argc, char *argv[])
                for (i = 0; i < numbers; i++) {
                        if (*(uint8_t *)(v + i) != 1) {
                                fprintf(stderr, "failed (%lu = %d).\n",
-                                               i, *(uint8_t *)(v + i));
+                                               (unsigned long) i,
+                                               *(uint8_t *)(v + i));
                                r = 1;
                                break;
                        }