qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 47/56] blockjob: Make BlockJobInfo and event off


From: Markus Armbruster
Subject: [Qemu-devel] [RFC PATCH 47/56] blockjob: Make BlockJobInfo and event offsets unsigned in QAPI/QMP
Date: Mon, 7 Aug 2017 16:45:51 +0200

File offsets should use QAPI type 'size' (uint64_t).  BlockJobInfo
members @len, offset and parameters @len, @offset of events
BLOCK_JOB_COMPLETED, BLOCK_JOB_CANCELLED, BLOCK_JOB_READY are 'int'
(int64_t).  block_job_query(), block_job_event_completed(),
block_job_event_cancelled(), block_job_event_ready() get them from
BlockJob members @len and @offset, which are int64_t, but should never
be negative.

Change the BlockJobInfo members and the event parameters to 'size',
for QAPI/QMP consistency.

Signed-off-by: Markus Armbruster <address@hidden>
---
 hmp.c                |  8 ++++----
 qapi/block-core.json | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/hmp.c b/hmp.c
index fae974e..867c50b 100644
--- a/hmp.c
+++ b/hmp.c
@@ -966,16 +966,16 @@ void hmp_info_block_jobs(Monitor *mon, const QDict *qdict)
 
     while (list) {
         if (strcmp(list->value->type, "stream") == 0) {
-            monitor_printf(mon, "Streaming device %s: Completed %" PRId64
-                           " of %" PRId64 " bytes, speed limit %" PRIu64
+            monitor_printf(mon, "Streaming device %s: Completed %" PRIu64
+                           " of %" PRIu64 " bytes, speed limit %" PRIu64
                            " bytes/s\n",
                            list->value->device,
                            list->value->offset,
                            list->value->len,
                            list->value->speed);
         } else {
-            monitor_printf(mon, "Type %s, device %s: Completed %" PRId64
-                           " of %" PRId64 " bytes, speed limit %" PRIu64
+            monitor_printf(mon, "Type %s, device %s: Completed %" PRIu64
+                           " of %" PRIu64 " bytes, speed limit %" PRIu64
                            " bytes/s\n",
                            list->value->type,
                            list->value->device,
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 9e9f2d8..b8442f3 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -955,8 +955,8 @@
 # Since: 1.1
 ##
 { 'struct': 'BlockJobInfo',
-  'data': {'type': 'str', 'device': 'str', 'len': 'int',
-           'offset': 'int', 'busy': 'bool', 'paused': 'bool',
+  'data': {'type': 'str', 'device': 'str', 'len': 'size',
+           'offset': 'size', 'busy': 'bool', 'paused': 'bool',
            'speed': 'size',
            'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
 
@@ -3606,8 +3606,8 @@
 { 'event': 'BLOCK_JOB_COMPLETED',
   'data': { 'type'  : 'BlockJobType',
             'device': 'str',
-            'len'   : 'int',
-            'offset': 'int',
+            'len'   : 'size',
+            'offset': 'size',
             'speed' : 'size',
             '*error': 'str' } }
 
@@ -3642,8 +3642,8 @@
 { 'event': 'BLOCK_JOB_CANCELLED',
   'data': { 'type'  : 'BlockJobType',
             'device': 'str',
-            'len'   : 'int',
-            'offset': 'int',
+            'len'   : 'size',
+            'offset': 'size',
             'speed' : 'size' } }
 
 ##
@@ -3707,8 +3707,8 @@
 { 'event': 'BLOCK_JOB_READY',
   'data': { 'type'  : 'BlockJobType',
             'device': 'str',
-            'len'   : 'int',
-            'offset': 'int',
+            'len'   : 'size',
+            'offset': 'size',
             'speed' : 'size' } }
 
 ##
-- 
2.7.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]