[PATCH 3/6] qemu: monitor: Move declaration of struct _qemuMonitor to qemu_monitor_priv.h

Peter Krempa pkrempa at redhat.com
Mon Feb 14 15:58:04 UTC 2022


In order to mock the SCM_RIGHTS sendmsg to simulate sending
filedescriptors to fake qemu in tests we need access to some fields of
'struct _qemuMonitor'. Move it's declaration to the private header file.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_monitor.c      | 50 ---------------------------------
 src/qemu/qemu_monitor_priv.h | 54 ++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 50 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 3de04eb1cc..327d6d978a 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -65,56 +65,6 @@ VIR_LOG_INIT("qemu.qemu_monitor");
  */
 #define QEMU_MONITOR_MAX_RESPONSE (10 * 1024 * 1024)

-struct _qemuMonitor {
-    virObjectLockable parent;
-
-    virCond notify;
-
-    int fd;
-
-    GMainContext *context;
-    GSocket *socket;
-    GSource *watch;
-
-    virDomainObj *vm;
-    char *domainName;
-
-    qemuMonitorCallbacks *cb;
-    void *callbackOpaque;
-
-    /* If there's a command being processed this will be
-     * non-NULL */
-    qemuMonitorMessage *msg;
-
-    /* Buffer incoming data ready for Text/QMP monitor
-     * code to process & find message boundaries */
-    size_t bufferOffset;
-    size_t bufferLength;
-    char *buffer;
-
-    /* If anything went wrong, this will be fed back
-     * the next monitor msg */
-    virError lastError;
-
-    /* Set to true when EOF is detected on the monitor */
-    bool goteof;
-
-    int nextSerial;
-
-    bool waitGreeting;
-
-    /* If found, path to the virtio memballoon driver */
-    char *balloonpath;
-    bool ballooninit;
-
-    /* Log file context of the qemu process to dig for usable info */
-    qemuMonitorReportDomainLogError logFunc;
-    void *logOpaque;
-    virFreeCallback logDestroy;
-
-    /* true if qemu no longer wants 'props' sub-object of object-add */
-    bool objectAddNoWrap;
-};

 /**
  * QEMU_CHECK_MONITOR_FULL:
diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h
index 6115f830de..606aa79fbd 100644
--- a/src/qemu/qemu_monitor_priv.h
+++ b/src/qemu/qemu_monitor_priv.h
@@ -24,6 +24,8 @@

 #include "qemu_monitor.h"

+#include <gio/gio.h>
+

 struct _qemuMonitorMessage {
     int txFD;
@@ -40,5 +42,57 @@ struct _qemuMonitorMessage {
 };


+struct _qemuMonitor {
+    virObjectLockable parent;
+
+    virCond notify;
+
+    int fd;
+
+    GMainContext *context;
+    GSocket *socket;
+    GSource *watch;
+
+    virDomainObj *vm;
+    char *domainName;
+
+    qemuMonitorCallbacks *cb;
+    void *callbackOpaque;
+
+    /* If there's a command being processed this will be
+     * non-NULL */
+    qemuMonitorMessage *msg;
+
+    /* Buffer incoming data ready for Text/QMP monitor
+     * code to process & find message boundaries */
+    size_t bufferOffset;
+    size_t bufferLength;
+    char *buffer;
+
+    /* If anything went wrong, this will be fed back
+     * the next monitor msg */
+    virError lastError;
+
+    /* Set to true when EOF is detected on the monitor */
+    bool goteof;
+
+    int nextSerial;
+
+    bool waitGreeting;
+
+    /* If found, path to the virtio memballoon driver */
+    char *balloonpath;
+    bool ballooninit;
+
+    /* Log file context of the qemu process to dig for usable info */
+    qemuMonitorReportDomainLogError logFunc;
+    void *logOpaque;
+    virFreeCallback logDestroy;
+
+    /* true if qemu no longer wants 'props' sub-object of object-add */
+    bool objectAddNoWrap;
+};
+
+
 void
 qemuMonitorResetCommandID(qemuMonitor *mon);
-- 
2.34.1




More information about the libvir-list mailing list