a1f4227d96
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
From fdfeff0462e17e0f0e37e65e5b6be6e74a9b39fd Mon Sep 17 00:00:00 2001
|
|
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
Date: Tue, 2 Sep 2014 22:43:44 +0200
|
|
Subject: [PATCH 4/4] examples: fix uint64_t formatting issues
|
|
|
|
Using %lu to format uint64_t doesn't work for 32 bits architecture,
|
|
because uint64_t is an unsigned long long and therefore %llu should be
|
|
used. The solution is to use PRIu64 from <inttypes.h>, which is equal
|
|
to %lu on 64 bits architectures, and %llu on 32 bits architectures,
|
|
which corresponds to the definition of uint64_t.
|
|
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
---
|
|
examples/iscsi-dd.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/examples/iscsi-dd.c b/examples/iscsi-dd.c
|
|
index 4cc7c2b..33007c3 100644
|
|
--- a/examples/iscsi-dd.c
|
|
+++ b/examples/iscsi-dd.c
|
|
@@ -19,6 +19,7 @@
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
+#include <inttypes.h>
|
|
#include <poll.h>
|
|
#include <getopt.h>
|
|
#include "iscsi.h"
|
|
@@ -79,7 +80,7 @@ void write_cb(struct iscsi_context *iscsi, int status, void *command_data, void
|
|
fill_read_queue(client);
|
|
|
|
if (client->progress) {
|
|
- printf("\r%lu of %lu blocks transferred.", client->pos, client->src_num_blocks);
|
|
+ printf("\r%" PRIu64 " of %" PRIu64 " blocks transferred.", client->pos, client->src_num_blocks);
|
|
}
|
|
|
|
if ((client->in_flight == 0) && (client->pos == client->src_num_blocks)) {
|
|
@@ -378,7 +379,7 @@ int main(int argc, char *argv[])
|
|
}
|
|
|
|
if (client.src_num_blocks > client.dst_num_blocks) {
|
|
- fprintf(stderr, "source LUN is bigger than destination (%lu > %lu sectors)\n", client.src_num_blocks, client.dst_num_blocks);
|
|
+ fprintf(stderr, "source LUN is bigger than destination (%" PRIu64 " > %" PRIu64 " sectors)\n", client.src_num_blocks, client.dst_num_blocks);
|
|
exit(10);
|
|
}
|
|
|
|
--
|
|
2.0.0
|
|
|