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 <mkletzan@redhat.com>
(cherry picked from commit 7c8028cda9)
This commit is contained in:
Martin Kletzander 2015-07-24 19:35:00 +02:00 committed by Cole Robinson
parent edf314d710
commit 10283d240c
5 changed files with 16 additions and 12 deletions

View File

@ -16366,7 +16366,7 @@ virDomainObjParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
if (xmlopt->privateData.parse && if (xmlopt->privateData.parse &&
xmlopt->privateData.parse(ctxt, obj) < 0) xmlopt->privateData.parse(ctxt, obj, &xmlopt->config) < 0)
goto error; goto error;
return obj; return obj;

View File

@ -2357,14 +2357,6 @@ typedef bool (*virDomainObjListACLFilter)(virConnectPtr conn,
typedef struct _virDomainXMLOption virDomainXMLOption; typedef struct _virDomainXMLOption virDomainXMLOption;
typedef virDomainXMLOption *virDomainXMLOptionPtr; 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 /* Called once after everything else has been parsed, for adjusting
* overall domain defaults. */ * overall domain defaults. */
typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def, typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def,
@ -2393,6 +2385,15 @@ struct _virDomainDefParserConfig {
unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN]; 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 struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks;
typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr; typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr;
struct _virDomainXMLPrivateDataCallbacks { struct _virDomainXMLPrivateDataCallbacks {

View File

@ -224,7 +224,8 @@ libxlDomainObjPrivateFree(void *data)
static int static int
libxlDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, libxlDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
virDomainObjPtr vm) virDomainObjPtr vm,
virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED)
{ {
libxlDomainObjPrivatePtr priv = vm->privateData; libxlDomainObjPrivatePtr priv = vm->privateData;

View File

@ -65,7 +65,8 @@ virLXCDomainObjPrivateXMLFormat(virBufferPtr buf,
static int static int
virLXCDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, virLXCDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
virDomainObjPtr vm) virDomainObjPtr vm,
virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED)
{ {
virLXCDomainObjPrivatePtr priv = vm->privateData; virLXCDomainObjPrivatePtr priv = vm->privateData;
unsigned long long thepid; unsigned long long thepid;

View File

@ -623,7 +623,8 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf,
static int static int
qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
virDomainObjPtr vm) virDomainObjPtr vm,
virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
char *monitorpath; char *monitorpath;