mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu: Typedef monitor callbacks
Otherwise defining variables that hold callbacks pointers is ugly and several places have to be changed when new parameters are added.
This commit is contained in:
parent
784cca89c5
commit
6ac7cc8edc
@ -660,8 +660,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
|
||||
* but is this safe ? I think it is, because the callback
|
||||
* will try to acquire the virDomainObjPtr mutex next */
|
||||
if (eof) {
|
||||
void (*eofNotify)(qemuMonitorPtr, virDomainObjPtr)
|
||||
= mon->cb->eofNotify;
|
||||
qemuMonitorEofNotifyCallback eofNotify = mon->cb->eofNotify;
|
||||
virDomainObjPtr vm = mon->vm;
|
||||
|
||||
/* Make sure anyone waiting wakes up now */
|
||||
@ -671,8 +670,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
|
||||
VIR_DEBUG("Triggering EOF callback");
|
||||
(eofNotify)(mon, vm);
|
||||
} else if (error) {
|
||||
void (*errorNotify)(qemuMonitorPtr, virDomainObjPtr)
|
||||
= mon->cb->errorNotify;
|
||||
qemuMonitorErrorNotifyCallback errorNotify = mon->cb->errorNotify;
|
||||
virDomainObjPtr vm = mon->vm;
|
||||
|
||||
/* Make sure anyone waiting wakes up now */
|
||||
|
@ -67,84 +67,105 @@ struct _qemuMonitorMessage {
|
||||
void *passwordOpaque;
|
||||
};
|
||||
|
||||
|
||||
typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef void (*qemuMonitorEofNotifyCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef void (*qemuMonitorErrorNotifyCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
/* XXX we'd really like to avoid virConnectPtr here
|
||||
* It is required so the callback can find the active
|
||||
* secret driver. Need to change this to work like the
|
||||
* security drivers do, to avoid this
|
||||
*/
|
||||
typedef int (*qemuMonitorDiskSecretLookupCallback)(qemuMonitorPtr mon,
|
||||
virConnectPtr conn,
|
||||
virDomainObjPtr vm,
|
||||
const char *path,
|
||||
char **secret,
|
||||
size_t *secretLen);
|
||||
typedef int (*qemuMonitorDomainShutdownCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainResetCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainPowerdownCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainStopCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainResumeCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainRTCChangeCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
long long offset);
|
||||
typedef int (*qemuMonitorDomainWatchdogCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
int action);
|
||||
typedef int (*qemuMonitorDomainIOErrorCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
const char *diskAlias,
|
||||
int action,
|
||||
const char *reason);
|
||||
typedef int (*qemuMonitorDomainGraphicsCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
int phase,
|
||||
int localFamily,
|
||||
const char *localNode,
|
||||
const char *localService,
|
||||
int remoteFamily,
|
||||
const char *remoteNode,
|
||||
const char *remoteService,
|
||||
const char *authScheme,
|
||||
const char *x509dname,
|
||||
const char *saslUsername);
|
||||
typedef int (*qemuMonitorDomainBlockJobCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
const char *diskAlias,
|
||||
int type,
|
||||
int status);
|
||||
typedef int (*qemuMonitorDomainTrayChangeCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
const char *devAlias,
|
||||
int reason);
|
||||
typedef int (*qemuMonitorDomainPMWakeupCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainPMSuspendCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainBalloonChangeCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
unsigned long long actual);
|
||||
typedef int (*qemuMonitorDomainPMSuspendDiskCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainGuestPanicCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
typedef int (*qemuMonitorDomainDeviceDeletedCallback)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
const char *devAlias);
|
||||
|
||||
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
|
||||
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
|
||||
struct _qemuMonitorCallbacks {
|
||||
void (*destroy)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
|
||||
void (*eofNotify)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
void (*errorNotify)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
/* XXX we'd really like to avoid virConnectPtr here
|
||||
* It is required so the callback can find the active
|
||||
* secret driver. Need to change this to work like the
|
||||
* security drivers do, to avoid this
|
||||
*/
|
||||
int (*diskSecretLookup)(qemuMonitorPtr mon,
|
||||
virConnectPtr conn,
|
||||
virDomainObjPtr vm,
|
||||
const char *path,
|
||||
char **secret,
|
||||
size_t *secretLen);
|
||||
|
||||
int (*domainShutdown)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainReset)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainPowerdown)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainStop)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainResume)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainRTCChange)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
long long offset);
|
||||
int (*domainWatchdog)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
int action);
|
||||
int (*domainIOError)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
const char *diskAlias,
|
||||
int action,
|
||||
const char *reason);
|
||||
int (*domainGraphics)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
int phase,
|
||||
int localFamily,
|
||||
const char *localNode,
|
||||
const char *localService,
|
||||
int remoteFamily,
|
||||
const char *remoteNode,
|
||||
const char *remoteService,
|
||||
const char *authScheme,
|
||||
const char *x509dname,
|
||||
const char *saslUsername);
|
||||
int (*domainBlockJob)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
const char *diskAlias,
|
||||
int type,
|
||||
int status);
|
||||
int (*domainTrayChange)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
const char *devAlias,
|
||||
int reason);
|
||||
int (*domainPMWakeup)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainPMSuspend)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainBalloonChange)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
unsigned long long actual);
|
||||
int (*domainPMSuspendDisk)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainGuestPanic)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm);
|
||||
int (*domainDeviceDeleted)(qemuMonitorPtr mon,
|
||||
virDomainObjPtr vm,
|
||||
const char *devAlias);
|
||||
qemuMonitorDestroyCallback destroy;
|
||||
qemuMonitorEofNotifyCallback eofNotify;
|
||||
qemuMonitorErrorNotifyCallback errorNotify;
|
||||
qemuMonitorDiskSecretLookupCallback diskSecretLookup;
|
||||
qemuMonitorDomainShutdownCallback domainShutdown;
|
||||
qemuMonitorDomainResetCallback domainReset;
|
||||
qemuMonitorDomainPowerdownCallback domainPowerdown;
|
||||
qemuMonitorDomainStopCallback domainStop;
|
||||
qemuMonitorDomainResumeCallback domainResume;
|
||||
qemuMonitorDomainRTCChangeCallback domainRTCChange;
|
||||
qemuMonitorDomainWatchdogCallback domainWatchdog;
|
||||
qemuMonitorDomainIOErrorCallback domainIOError;
|
||||
qemuMonitorDomainGraphicsCallback domainGraphics;
|
||||
qemuMonitorDomainBlockJobCallback domainBlockJob;
|
||||
qemuMonitorDomainTrayChangeCallback domainTrayChange;
|
||||
qemuMonitorDomainPMWakeupCallback domainPMWakeup;
|
||||
qemuMonitorDomainPMSuspendCallback domainPMSuspend;
|
||||
qemuMonitorDomainBalloonChangeCallback domainBalloonChange;
|
||||
qemuMonitorDomainPMSuspendDiskCallback domainPMSuspendDisk;
|
||||
qemuMonitorDomainGuestPanicCallback domainGuestPanic;
|
||||
qemuMonitorDomainDeviceDeletedCallback domainDeviceDeleted;
|
||||
};
|
||||
|
||||
char *qemuMonitorEscapeArg(const char *in);
|
||||
|
Loading…
x
Reference in New Issue
Block a user