libvirt/libvirt-qemu-monitor-Move-declaration-of-struct-_qemuMonitor-to-qemu_monitor_priv.h.patch
Jiri Denemark bf8db99000 libvirt-8.0.0-20.el8
- qemu: monitor: Drop old monitor fields from 'struct _qemuMonitorMessage' (rhbz#2170472)
- qemu: Make 'struct _qemuMonitorMessage' private (rhbz#2170472)
- qemu: monitor: Move declaration of struct _qemuMonitor to qemu_monitor_priv.h (rhbz#2170472)
- qemu: qemuBlockGetNamedNodeData: Remove pointless error path (rhbz#2170472)
- qemu: monitor: Store whether 'query-named-block-nodes' supports 'flat' parameter (rhbz#2170472)
- qemuMonitorJSONBlockStatsUpdateCapacityBlockdev: Use 'flat' mode of query-named-block-nodes (rhbz#2170472)
- qemu: relax shared memory check for vhostuser daemons (rhbz#2177701)
- virpci: Resolve leak in virPCIVirtualFunctionList cleanup (CVE-2023-2700)
- node_device_conf: Avoid memleak in virNodeDeviceGetPCIVPDDynamicCap() (CVE-2023-2700)

Resolves: rhbz#2170472, rhbz#2177701, rhbz#2203654
2023-05-19 18:39:34 +02:00

158 lines
4.0 KiB
Diff

From c2ed5aeee7bf365877e0764699f032fb749630b0 Mon Sep 17 00:00:00 2001
Message-Id: <c2ed5aeee7bf365877e0764699f032fb749630b0@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 14 Feb 2022 16:07:41 +0100
Subject: [PATCH] qemu: monitor: Move declaration of struct _qemuMonitor to
qemu_monitor_priv.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 its declaration to the private header file.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 7c35c483eaa78eb847e0865cbb210d5355f75d7a)
https://bugzilla.redhat.com/show_bug.cgi?id=2170472
---
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 23638d3fe8..bba92592c5 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.40.1