[PATCH 2/6] qemu: Privatize 'struct _qemuMonitorMessage'

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


Move the declaration of the struct into 'qemu_monitor_priv.h' as other
code has no business in peeking into the monitor messages.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_monitor.h      | 14 --------------
 src/qemu/qemu_monitor_json.c |  3 +++
 src/qemu/qemu_monitor_priv.h | 16 ++++++++++++++++
 tests/qemucapsprobemock.c    |  3 +++
 4 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 12005ac624..1d21183d82 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -34,21 +34,7 @@
 #include "virenum.h"

 typedef struct _qemuMonitor qemuMonitor;
-
 typedef struct _qemuMonitorMessage qemuMonitorMessage;
-struct _qemuMonitorMessage {
-    int txFD;
-
-    const char *txBuffer;
-    int txOffset;
-    int txLength;
-
-    /* Used by the JSON monitor to hold reply / error */
-    void *rxObject;
-
-    /* True if rxObject is ready, or a fatal error occurred on the monitor channel */
-    bool finished;
-};

 typedef enum {
     QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE = 0,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5bc1b2342c..1de932f638 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -44,6 +44,9 @@
 # include "libvirt_qemu_probes.h"
 #endif

+#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
+#include "qemu_monitor_priv.h"
+
 #define VIR_FROM_THIS VIR_FROM_QEMU

 VIR_LOG_INIT("qemu.qemu_monitor_json");
diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h
index 31bb3526b9..6115f830de 100644
--- a/src/qemu/qemu_monitor_priv.h
+++ b/src/qemu/qemu_monitor_priv.h
@@ -24,5 +24,21 @@

 #include "qemu_monitor.h"

+
+struct _qemuMonitorMessage {
+    int txFD;
+
+    const char *txBuffer;
+    int txOffset;
+    int txLength;
+
+    /* Used by the JSON monitor to hold reply / error */
+    void *rxObject;
+
+    /* True if rxObject is ready, or a fatal error occurred on the monitor channel */
+    bool finished;
+};
+
+
 void
 qemuMonitorResetCommandID(qemuMonitor *mon);
diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c
index 915036d178..2717ed5d84 100644
--- a/tests/qemucapsprobemock.c
+++ b/tests/qemucapsprobemock.c
@@ -25,6 +25,9 @@
 #include "qemu/qemu_monitor.h"
 #include "qemu/qemu_monitor_json.h"

+#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
+#include "qemu/qemu_monitor_priv.h"
+
 #define REAL_SYM(realFunc) \
     do { \
         if (!realFunc && !(realFunc = dlsym(RTLD_NEXT, __FUNCTION__))) { \
-- 
2.34.1




More information about the libvir-list mailing list