From 10283d240c667d5c47b45207d01aa15f7625633d Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Fri, 24 Jul 2015 19:35:00 +0200 Subject: [PATCH] conf: Pass private data to Parse function of XML options This needs a reorder of XML option definitions. It might come in handy one day. Signed-off-by: Martin Kletzander (cherry picked from commit 7c8028cda95c3af388f7485e682ed07629bb9e7a) --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 17 +++++++++-------- src/libxl/libxl_domain.c | 3 ++- src/lxc/lxc_domain.c | 3 ++- src/qemu/qemu_domain.c | 3 ++- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9a53a35be9..b7bf467f83 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16366,7 +16366,7 @@ virDomainObjParseXML(xmlDocPtr xml, VIR_FREE(nodes); if (xmlopt->privateData.parse && - xmlopt->privateData.parse(ctxt, obj) < 0) + xmlopt->privateData.parse(ctxt, obj, &xmlopt->config) < 0) goto error; return obj; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0fe6b1a47c..b816346174 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2357,14 +2357,6 @@ typedef bool (*virDomainObjListACLFilter)(virConnectPtr conn, typedef struct _virDomainXMLOption virDomainXMLOption; typedef virDomainXMLOption *virDomainXMLOptionPtr; -typedef void *(*virDomainXMLPrivateDataAllocFunc)(void); -typedef void (*virDomainXMLPrivateDataFreeFunc)(void *); -typedef virObjectPtr (*virDomainXMLPrivateDataNewFunc)(void); -typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr, - virDomainObjPtr); -typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr, - virDomainObjPtr); - /* Called once after everything else has been parsed, for adjusting * overall domain defaults. */ typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def, @@ -2393,6 +2385,15 @@ struct _virDomainDefParserConfig { unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN]; }; +typedef void *(*virDomainXMLPrivateDataAllocFunc)(void); +typedef void (*virDomainXMLPrivateDataFreeFunc)(void *); +typedef virObjectPtr (*virDomainXMLPrivateDataNewFunc)(void); +typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr, + virDomainObjPtr); +typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr, + virDomainObjPtr, + virDomainDefParserConfigPtr); + typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks; typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr; struct _virDomainXMLPrivateDataCallbacks { diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 224ff773f9..40dcea171c 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -224,7 +224,8 @@ libxlDomainObjPrivateFree(void *data) static int libxlDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, - virDomainObjPtr vm) + virDomainObjPtr vm, + virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED) { libxlDomainObjPrivatePtr priv = vm->privateData; diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index 70606f3765..2f377d8dcb 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -65,7 +65,8 @@ virLXCDomainObjPrivateXMLFormat(virBufferPtr buf, static int virLXCDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, - virDomainObjPtr vm) + virDomainObjPtr vm, + virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED) { virLXCDomainObjPrivatePtr priv = vm->privateData; unsigned long long thepid; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 66fe736ce8..7377e8cfad 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -623,7 +623,8 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, - virDomainObjPtr vm) + virDomainObjPtr vm, + virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED) { qemuDomainObjPrivatePtr priv = vm->privateData; char *monitorpath;