[libvirt] [PATCH 8/8] qemu: monitor: Remove qemuMonitorHMPCommand in favor of qemuMonitorJSONHumanCommand

Peter Krempa pkrempa at redhat.com
Thu Sep 19 16:10:23 UTC 2019


Use the function directly rather than having a wrapper.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_monitor.c      | 11 -----------
 src/qemu/qemu_monitor.h      |  3 ---
 src/qemu/qemu_monitor_text.c | 11 ++++++-----
 3 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index af4c41fa16..b6d2936872 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1160,17 +1160,6 @@ qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon,
 }


-int
-qemuMonitorHMPCommand(qemuMonitorPtr mon,
-                      const char *cmd,
-                      char **reply)
-{
-    QEMU_CHECK_MONITOR(mon);
-
-    return qemuMonitorJSONHumanCommand(mon, cmd, reply);
-}
-
-
 /* Ensure proper locking around callbacks.  */
 #define QEMU_MONITOR_CALLBACK(mon, ret, callback, ...) \
     do { \
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index af1ec56525..b781a8cc89 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -426,9 +426,6 @@ int qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon,
                                      virDomainVideoDefPtr video,
                                      const char *videoName)
     ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
-int qemuMonitorHMPCommand(qemuMonitorPtr mon,
-                          const char *cmd,
-                          char **reply);

 int qemuMonitorEmitEvent(qemuMonitorPtr mon, const char *event,
                          long long seconds, unsigned int micros,
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 7bc28e54c0..b1abcacdd0 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -23,6 +23,7 @@


 #include "qemu_monitor_text.h"
+#include "qemu_monitor_json.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "virerror.h"
@@ -44,7 +45,7 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
     if (virAsprintf(&cmd, "drive_add dummy %s", drivestr) < 0)
         goto cleanup;

-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
+    if (qemuMonitorJSONHumanCommand(mon, cmd, &reply) < 0)
         goto cleanup;

     if (strstr(reply, "unknown command:")) {
@@ -94,7 +95,7 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
     if (virAsprintf(&cmd, "drive_del %s", drivestr) < 0)
         goto cleanup;

-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
+    if (qemuMonitorJSONHumanCommand(mon, cmd, &reply) < 0)
         goto cleanup;

     if (strstr(reply, "unknown command:")) {
@@ -133,7 +134,7 @@ qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon,
     if (virAsprintf(&cmd, "savevm \"%s\"", name) < 0)
         goto cleanup;

-    if (qemuMonitorHMPCommand(mon, cmd, &reply))
+    if (qemuMonitorJSONHumanCommand(mon, cmd, &reply))
         goto cleanup;

     if (strstr(reply, "Error while creating snapshot") ||
@@ -168,7 +169,7 @@ int qemuMonitorTextLoadSnapshot(qemuMonitorPtr mon, const char *name)
     if (virAsprintf(&cmd, "loadvm \"%s\"", name) < 0)
         goto cleanup;

-    if (qemuMonitorHMPCommand(mon, cmd, &reply))
+    if (qemuMonitorJSONHumanCommand(mon, cmd, &reply))
         goto cleanup;

     if (strstr(reply, "No block device supports snapshots")) {
@@ -211,7 +212,7 @@ int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char *name)

     if (virAsprintf(&cmd, "delvm \"%s\"", name) < 0)
         goto cleanup;
-    if (qemuMonitorHMPCommand(mon, cmd, &reply))
+    if (qemuMonitorJSONHumanCommand(mon, cmd, &reply))
         goto cleanup;

     if (strstr(reply, "No block device supports snapshots")) {
-- 
2.21.0




More information about the libvir-list mailing list