The top level API is unused so it can be removed but internally the JSON version is called by other monitor commands which extract information from the reply. Thus qemuMonitorJSONQueryNamedBlockNodes is unexported and moved appropriately. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_monitor.c | 9 ------- src/qemu/qemu_monitor.h | 2 -- src/qemu/qemu_monitor_json.c | 52 +++++++++++++++++++++--------------- src/qemu/qemu_monitor_json.h | 5 ---- 4 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a58aa5622f..a4b1b90c7c 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3995,15 +3995,6 @@ qemuMonitorSetBlockThreshold(qemuMonitor *mon, } -virJSONValue * -qemuMonitorQueryNamedBlockNodes(qemuMonitor *mon) -{ - QEMU_CHECK_MONITOR_NULL(mon); - - return qemuMonitorJSONQueryNamedBlockNodes(mon, false); -} - - char * qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfo *info) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 0e3640c1da..352cf0ada5 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1335,8 +1335,6 @@ int qemuMonitorSetBlockThreshold(qemuMonitor *mon, const char *nodename, unsigned long long threshold); -virJSONValue *qemuMonitorQueryNamedBlockNodes(qemuMonitor *mon); - int qemuMonitorSetWatchdogAction(qemuMonitor *mon, const char *action); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 4584786872..9363f86a55 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2056,6 +2056,36 @@ qemuMonitorJSONSetDBusVMStateIdList(qemuMonitor *mon, } +/* qemuMonitorJSONQueryNamedBlockNodes: + * @mon: Monitor pointer + * + * This helper will attempt to make a "query-named-block-nodes" call and check for + * errors before returning with the reply. + * + * Returns: NULL on error, reply on success + */ +static virJSONValue * +qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon, + bool flat) +{ + g_autoptr(virJSONValue) cmd = NULL; + g_autoptr(virJSONValue) reply = NULL; + + if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes", + "B:flat", flat, + NULL))) + return NULL; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return NULL; + + if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) + return NULL; + + return virJSONValueObjectStealArray(reply, "return"); +} + + /* qemuMonitorJSONQueryBlock: * @mon: Monitor pointer * @@ -7882,28 +7912,6 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitor *mon, } -virJSONValue * -qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon, - bool flat) -{ - g_autoptr(virJSONValue) cmd = NULL; - g_autoptr(virJSONValue) reply = NULL; - - if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes", - "B:flat", flat, - NULL))) - return NULL; - - if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - return NULL; - - if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) - return NULL; - - return virJSONValueObjectStealArray(reply, "return"); -} - - int qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon, const char *action) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 613b251908..31f6214ec4 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -713,11 +713,6 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitor *mon, unsigned long long threshold) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -virJSONValue * -qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon, - bool flat) - ATTRIBUTE_NONNULL(1); - int qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon, const char *action) -- 2.36.1