So that they can format private data (e.g., disk private data) stored
elsewhere in the domain object.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
ACKed in version 2
Version 2, 3:
- no changes
src/conf/domain_conf.c | 4 ++--
src/conf/domain_conf.h | 6 ++++--
src/libxl/libxl_domain.c | 10 ++++++----
src/lxc/lxc_domain.c | 12 ++++++++----
src/qemu/qemu_domain.c | 10 ++++++----
5 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 433183f..350640f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15974,7 +15974,7 @@ virDomainObjParseXML(xmlDocPtr xml,
VIR_FREE(nodes);
if (xmlopt->privateData.parse &&
- ((xmlopt->privateData.parse)(ctxt, obj->privateData)) < 0)
+ xmlopt->privateData.parse(ctxt, obj) < 0)
goto error;
return obj;
@@ -21863,7 +21863,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
}
if (xmlopt->privateData.format &&
- ((xmlopt->privateData.format)(&buf, obj->privateData)) < 0)
+ xmlopt->privateData.format(&buf, obj) < 0)
goto error;
if (virDomainDefFormatInternal(obj->def, flags, &buf) < 0)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ac29ce5..44ecd4a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2357,8 +2357,10 @@ typedef virDomainXMLOption *virDomainXMLOptionPtr;
typedef void *(*virDomainXMLPrivateDataAllocFunc)(void);
typedef void (*virDomainXMLPrivateDataFreeFunc)(void *);
typedef virObjectPtr (*virDomainXMLPrivateDataNewFunc)(void);
-typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr, void *);
-typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr, void *);
+typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr,
+ virDomainObjPtr);
+typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr,
+ virDomainObjPtr);
/* Called once after everything else has been parsed, for adjusting
* overall domain defaults. */
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 0652270..ebd7964 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -223,9 +223,10 @@ libxlDomainObjPrivateFree(void *data)
}
static int
-libxlDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
+libxlDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
+ virDomainObjPtr vm)
{
- libxlDomainObjPrivatePtr priv = data;
+ libxlDomainObjPrivatePtr priv = vm->privateData;
priv->lockState = virXPathString("string(./lockstate)", ctxt);
@@ -233,9 +234,10 @@ libxlDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
}
static int
-libxlDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
+libxlDomainObjPrivateXMLFormat(virBufferPtr buf,
+ virDomainObjPtr vm)
{
- libxlDomainObjPrivatePtr priv = data;
+ libxlDomainObjPrivatePtr priv = vm->privateData;
if (priv->lockState)
virBufferAsprintf(buf, "<lockstate>%s</lockstate>\n",
priv->lockState);
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index c2180cb..70606f3 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -51,9 +51,11 @@ static void virLXCDomainObjPrivateFree(void *data)
}
-static int virLXCDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
+static int
+virLXCDomainObjPrivateXMLFormat(virBufferPtr buf,
+ virDomainObjPtr vm)
{
- virLXCDomainObjPrivatePtr priv = data;
+ virLXCDomainObjPrivatePtr priv = vm->privateData;
virBufferAsprintf(buf, "<init pid='%llu'/>\n",
(unsigned long long)priv->initpid);
@@ -61,9 +63,11 @@ static int virLXCDomainObjPrivateXMLFormat(virBufferPtr buf, void
*data)
return 0;
}
-static int virLXCDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
+static int
+virLXCDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
+ virDomainObjPtr vm)
{
- virLXCDomainObjPrivatePtr priv = data;
+ virLXCDomainObjPrivatePtr priv = vm->privateData;
unsigned long long thepid;
if (virXPathULongLong("string(./init[1]/@pid)", ctxt, &thepid) < 0)
{
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0b5ebe1..24ff020 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -511,9 +511,10 @@ qemuDomainObjPrivateFree(void *data)
static int
-qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
+qemuDomainObjPrivateXMLFormat(virBufferPtr buf,
+ virDomainObjPtr vm)
{
- qemuDomainObjPrivatePtr priv = data;
+ qemuDomainObjPrivatePtr priv = vm->privateData;
const char *monitorpath;
qemuDomainJob job;
@@ -600,9 +601,10 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
}
static int
-qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
+qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
+ virDomainObjPtr vm)
{
- qemuDomainObjPrivatePtr priv = data;
+ qemuDomainObjPrivatePtr priv = vm->privateData;
char *monitorpath;
char *tmp;
int n;
--
2.4.3