flashbench: fix building on 32 bits
This fixes all warnings and one confusion of off_t and size_t
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/dev.h b/dev.h
index 9d30197..774e733 100644
--- a/dev.h
+++ b/dev.h
@@ -7,7 +7,7 @@
void *readbuf;
void *writebuf[3];
int fd;
- ssize_t size;
+ off_t size;
};
enum writebuf {
diff --git a/flashbench.c b/flashbench.c
index 5a7cbe2..0e93e52 100644
--- a/flashbench.c
+++ b/flashbench.c
@@ -185,7 +185,7 @@
format_ns(avg, ns_avg(count, times));
format_ns(max, ns_max(count, times));
- printf("%ld bytes: min %s avg %s max %s: %g MB/s\n", blocksize,
+ printf("%lld bytes: min %s avg %s max %s: %g MB/s\n", (long long)blocksize,
min, avg, max, blocksize / (ns_min(count, times) / 1000.0));
}
@@ -264,8 +264,8 @@
format_ns(buf_a, aligned[i]);
format_ns(buf_u, unaligned[i]);
- printf("%ld bytes: aligned %s unaligned %s diff %lld, %02g%% min %02g%% avg\n",
- blocksize, buf_a, buf_u, unaligned[i] - aligned[i],
+ printf("%lld bytes: aligned %s unaligned %s diff %lld, %02g%% min %02g%% avg\n",
+ (long long)blocksize, buf_a, buf_u, unaligned[i] - aligned[i],
100.0 * (unaligned[i] - aligned[i]) / aligned[i],
100.0 * (avg_u - avg_a) / avg_a);
}
@@ -389,7 +389,7 @@
format_ns(on_s, ns_avg(count, on));
format_ns(post_s, ns_avg(count, post));
format_ns(diff_s, ns_avg(count, on) - (ns_avg(count, pre) + ns_avg(count, post)) / 2);
- printf("align %ld\tpre %s\ton %s\tpost %s\tdiff %s\n", align, pre_s, on_s, post_s, diff_s);
+ printf("align %lld\tpre %s\ton %s\tpost %s\tdiff %s\n", (long long)align, pre_s, on_s, post_s, diff_s);
return 0;
}
diff --git a/vm.c b/vm.c
index e65770c..7a23694 100644
--- a/vm.c
+++ b/vm.c
@@ -53,7 +53,8 @@
if (!op)
return_err("internal error: NULL operation\n");
- pr_debug("call %s %ld %ld %ld\n", syntax[op->code].name, off, max, len);
+ pr_debug("call %s %lld %lld %ld\n", syntax[op->code].name,
+ (long long)off, (long long)max, (long)len);
if (op->code > O_MAX)
return_err("illegal command code %d\n", op->code);
@@ -468,8 +469,8 @@
if (op->val == -1) {
if (len == 0 || max < (off_t)len)
- return_err("cannot fill %ld bytes with %ld byte chunks\n",
- max, len);
+ return_err("cannot fill %lld bytes with %ld byte chunks\n",
+ (long long)max, (long)len);
num = max/len;
val = max/num;
@@ -551,8 +552,8 @@
if (op->val == -1) {
if (len == 0 || max < (off_t)len)
- return_err("cannot fill %ld bytes with %ld byte chunks\n",
- max, len);
+ return_err("cannot fill %lld bytes with %ld byte chunks\n",
+ (long long)max, (long)len);
num = max/len;
val = max/num;