[PATCH 7/8] qemu: monitor: Don't handle HMP in qemuMonitorJSONArbitraryCommand

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

 



Call to qemuMonitorJSONHumanCommand directly from
qemuMonitorArbitraryCommand.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      |  5 ++++-
 src/qemu/qemu_monitor_json.c | 19 +++++++------------
 src/qemu/qemu_monitor_json.h |  3 +--
 3 files changed, 12 insertions(+), 15 deletions(-)

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);

-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux