qemu: monitor: Move declaration of struct _qemuMonitor to qemu_monitor_priv.h

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>
This commit is contained in:
Peter Krempa 2022-02-14 16:07:41 +01:00
parent f9ae469a6e
commit 7c35c483ea
2 changed files with 54 additions and 50 deletions

View File

@ -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:

View File

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