From 801e6da29c0202946d44b42136cc4ee229932a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 10 Dec 2019 13:53:10 +0100 Subject: [PATCH] qemu: add private data to virDomainFSDef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wire up the allocation and disposal of private data. Signed-off-by: Ján Tomko Reviewed-by: Daniel P. Berrangé --- src/qemu/qemu_domain.c | 38 ++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 12 ++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2ec23bb52f..24e84a5966 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1407,6 +1407,43 @@ qemuDomainNetworkPrivateDispose(void *obj G_GNUC_UNUSED) } +static virClassPtr qemuDomainFSPrivateClass; +static void qemuDomainFSPrivateDispose(void *obj); + + +static int +qemuDomainFSPrivateOnceInit(void) +{ + if (!VIR_CLASS_NEW(qemuDomainFSPrivate, virClassForObject())) + return -1; + + return 0; +} + + +VIR_ONCE_GLOBAL_INIT(qemuDomainFSPrivate); + + +static virObjectPtr +qemuDomainFSPrivateNew(void) +{ + qemuDomainFSPrivatePtr priv; + + if (qemuDomainFSPrivateInitialize() < 0) + return NULL; + + if (!(priv = virObjectNew(qemuDomainFSPrivateClass))) + return NULL; + + return (virObjectPtr) priv; +} + + +static void +qemuDomainFSPrivateDispose(void *obj G_GNUC_UNUSED) +{ +} + static virClassPtr qemuDomainVideoPrivateClass; static void qemuDomainVideoPrivateDispose(void *obj); @@ -3865,6 +3902,7 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = { .graphicsNew = qemuDomainGraphicsPrivateNew, .networkNew = qemuDomainNetworkPrivateNew, .videoNew = qemuDomainVideoPrivateNew, + .fsNew = qemuDomainFSPrivateNew, .parse = qemuDomainObjPrivateXMLParse, .format = qemuDomainObjPrivateXMLFormat, .getParseOpaque = qemuDomainObjPrivateXMLGetParseOpaque, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index c93bdf4099..c6afc484f6 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -560,6 +560,18 @@ struct _qemuDomainNetworkPrivate { }; +#define QEMU_DOMAIN_FS_PRIVATE(dev) \ + ((qemuDomainFSPrivatePtr) (dev)->privateData) + +typedef struct _qemuDomainFSPrivate qemuDomainFSPrivate; +typedef qemuDomainFSPrivate *qemuDomainFSPrivatePtr; +struct _qemuDomainFSPrivate { + virObject parent; + + int dummy; +}; + + typedef enum { QEMU_PROCESS_EVENT_WATCHDOG = 0, QEMU_PROCESS_EVENT_GUESTPANIC, -- GitLab