From: Peter Krempa Date: Thu, 19 Sep 2019 15:53:45 +0000 (+0200) Subject: qemu: monitor: Don't handle HMP in qemuMonitorJSONArbitraryCommand X-Git-Tag: v5.8.0-rc1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19f8309a3b7681aa963fe94b763c99b0aebda2f0;p=thirdparty%2Flibvirt.git qemu: monitor: Don't handle HMP in qemuMonitorJSONArbitraryCommand Call to qemuMonitorJSONHumanCommand directly from qemuMonitorArbitraryCommand. Signed-off-by: Peter Krempa Reviewed-by: Jiri Denemark --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f52a381982..af4c41fa16 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3191,7 +3191,10 @@ qemuMonitorArbitraryCommand(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONArbitraryCommand(mon, cmd, reply, hmp); + if (hmp) + return qemuMonitorJSONHumanCommand(mon, cmd, reply); + else + return qemuMonitorJSONArbitraryCommand(mon, cmd, reply); } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 891d2c3089..b8ec9ac59a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4624,25 +4624,20 @@ qemuMonitorJSONDiskNameLookup(qemuMonitorPtr mon, int qemuMonitorJSONArbitraryCommand(qemuMonitorPtr mon, const char *cmd_str, - char **reply_str, - bool hmp) + char **reply_str) { virJSONValuePtr cmd = NULL; virJSONValuePtr reply = NULL; int ret = -1; - if (hmp) { - return qemuMonitorJSONHumanCommand(mon, cmd_str, reply_str); - } else { - if (!(cmd = virJSONValueFromString(cmd_str))) - goto cleanup; + if (!(cmd = virJSONValueFromString(cmd_str))) + goto cleanup; - if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; - if (!(*reply_str = virJSONValueToString(reply, false))) - goto cleanup; - } + if (!(*reply_str = virJSONValueToString(reply, false))) + goto cleanup; ret = 0; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 5330697885..a608410703 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -286,8 +286,7 @@ char *qemuMonitorJSONDiskNameLookup(qemuMonitorPtr mon, int qemuMonitorJSONArbitraryCommand(qemuMonitorPtr mon, const char *cmd_str, - char **reply_str, - bool hmp); + char **reply_str); int qemuMonitorJSONInjectNMI(qemuMonitorPtr mon);