File Convert-query-block-info_block-to-corout.patch of Package qemu.37352

From: Dario Faggioli <dfaggioli@suse.com>
Date: Thu, 1 Jun 2023 16:28:24 +0200
Subject: Convert query-block/info_block to coroutine

Git-commit: Not yet
References: bsc#1211000

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
---
 block/monitor/block-hmp-cmds.c | 2 +-
 block/qapi.c                   | 2 +-
 hmp-commands-info.hx           | 1 +
 include/block/block-hmp-cmds.h | 2 +-
 qapi/block-core.json           | 2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
index d15a2be827bb469340dd6cf3d797..85c9ecb3a4c7ab4e81e1ba0634e8 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
@@ -742,7 +742,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
     }
 }
 
-void hmp_info_block(Monitor *mon, const QDict *qdict)
+void coroutine_fn hmp_info_block(Monitor *mon, const QDict *qdict)
 {
     BlockInfoList *block_list, *info;
     BlockDeviceInfoList *blockdev_list, *blockdev;
diff --git a/block/qapi.c b/block/qapi.c
index 036da085eea66bd1ad866f5be06f..7a3140ec1e5c30991a519f14db3e 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -606,7 +606,7 @@ static BlockStats *bdrv_query_bds_stats(BlockDriverState *bs,
     return s;
 }
 
-BlockInfoList *qmp_query_block(Error **errp)
+BlockInfoList *coroutine_fn qmp_query_block(Error **errp)
 {
     BlockInfoList *head = NULL, **p_next = &head;
     BlockBackend *blk;
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 117ba25f91dbd8879558279b8b38..e21e601b33f9aa77085b49f8fd7a 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -65,6 +65,7 @@ ERST
         .help       = "show info of one block device or all block devices "
                       "(-n: show named nodes; -v: show details)",
         .cmd        = hmp_info_block,
+        .coroutine  = true,
     },
 
 SRST
diff --git a/include/block/block-hmp-cmds.h b/include/block/block-hmp-cmds.h
index 3412e108ca226ee69578d29bc4c6..5ef977092e338e7dc8c3d6a5717a 100644
--- a/include/block/block-hmp-cmds.h
+++ b/include/block/block-hmp-cmds.h
@@ -46,7 +46,7 @@ void hmp_eject(Monitor *mon, const QDict *qdict);
 
 void hmp_qemu_io(Monitor *mon, const QDict *qdict);
 
-void hmp_info_block(Monitor *mon, const QDict *qdict);
+void coroutine_fn hmp_info_block(Monitor *mon, const QDict *qdict);
 void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
 void hmp_info_block_jobs(Monitor *mon, const QDict *qdict);
 void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 04ad80bc1e51bb0913bc5a6153cf..955b12a2b8c911e574d17952f32e 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -742,7 +742,7 @@
 #    }
 #
 ##
-{ 'command': 'query-block', 'returns': ['BlockInfo'] }
+{ 'command': 'query-block', 'returns': ['BlockInfo'], 'coroutine': true }
 
 
 ##
openSUSE Build Service is sponsored by