File offsets and sizes use QAPI type 'size' (uint64_t). MapEntry
members @start, @length and @offset are 'int' (int64_t).
get_block_status() sets @start and @length to unsigned long long
values, and @offset to a non-negative int64_t value.
Change these MapEntry members to 'size'.
"qemu-img map" now reports them correctly above 2^63-1 instead of
their (negative) two's complement.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
qapi/block-core.json | 4 ++--
qemu-img.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 3482f8c..6f62723 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -236,8 +236,8 @@
#
##
{ 'struct': 'MapEntry',
- 'data': {'start': 'int', 'length': 'int', 'data': 'bool',
- 'zero': 'bool', 'depth': 'int', '*offset': 'int',
+ 'data': {'start': 'size', 'length': 'size', 'data': 'bool',
+ 'zero': 'bool', 'depth': 'int', '*offset': 'size',
'*filename': 'str' } }
##
diff --git a/qemu-img.c b/qemu-img.c
index cf3ef3e..1c783c7 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2655,14 +2655,14 @@ static void dump_map_entry(OutputFormat output_format, MapEntry *e,
}
break;
case OFORMAT_JSON:
- printf("%s{ \"start\": %"PRId64", \"length\": %"PRId64","
+ printf("%s{ \"start\": %" PRIu64 ", \"length\": %" PRIu64 ","
" \"depth\": %"PRId64", \"zero\": %s, \"data\": %s",
(e->start == 0 ? "[" : ",\n"),
e->start, e->length, e->depth,
e->zero ? "true" : "false",
e->data ? "true" : "false");
if (e->has_offset) {
- printf(", \"offset\": %"PRId64"", e->offset);
+ printf(", \"offset\": %" PRIu64, e->offset);
}
putchar('}');
--
2.7.5