2018-05-04 14:26:08 +00:00
|
|
|
/*
|
|
|
|
* qemu_monitor_priv.h: interaction with QEMU monitor console (private)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-12-13 14:53:50 +00:00
|
|
|
#ifndef LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
|
2018-05-04 14:26:08 +00:00
|
|
|
# error "qemu_monitor_priv.h may only be included by qemu_monitor.c or test suites"
|
2018-12-13 14:53:50 +00:00
|
|
|
#endif /* LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW */
|
2018-05-04 14:26:08 +00:00
|
|
|
|
2019-06-18 16:12:37 +00:00
|
|
|
#pragma once
|
2018-05-04 14:26:08 +00:00
|
|
|
|
2019-06-18 16:12:37 +00:00
|
|
|
#include "qemu_monitor.h"
|
2018-05-04 14:26:08 +00:00
|
|
|
|
2022-02-14 15:07:41 +00:00
|
|
|
#include <gio/gio.h>
|
|
|
|
|
2022-02-14 14:57:21 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-02-14 15:07:41 +00:00
|
|
|
struct _qemuMonitor {
|
|
|
|
virObjectLockable parent;
|
|
|
|
|
|
|
|
virCond notify;
|
|
|
|
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
GMainContext *context;
|
|
|
|
GSocket *socket;
|
|
|
|
GSource *watch;
|
|
|
|
|
|
|
|
virDomainObj *vm;
|
|
|
|
char *domainName;
|
|
|
|
|
|
|
|
qemuMonitorCallbacks *cb;
|
|
|
|
|
|
|
|
/* 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;
|
2022-11-09 09:53:49 +00:00
|
|
|
/* query-named-block-nodes supports the 'flat' option */
|
|
|
|
bool queryNamedBlockNodesFlat;
|
2022-02-14 15:07:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-05-04 14:26:08 +00:00
|
|
|
void
|
2021-03-11 07:16:13 +00:00
|
|
|
qemuMonitorResetCommandID(qemuMonitor *mon);
|
2022-02-14 14:51:37 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuMonitorIOWriteWithFD(qemuMonitor *mon,
|
|
|
|
const char *data,
|
|
|
|
size_t len,
|
|
|
|
int fd)
|
2022-07-18 11:02:19 +00:00
|
|
|
G_NO_INLINE;
|