7a3408
From f7cf89a71e2850d227a623909c7d8fada2990538 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <f7cf89a71e2850d227a623909c7d8fada2990538@dist-git>
7a3408
From: Martin Kletzander <mkletzan@redhat.com>
7a3408
Date: Thu, 13 Aug 2015 15:11:46 +0200
7a3408
Subject: [PATCH] conf: Pass private data to Parse function of XML options
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1162947
7a3408
7a3408
This needs a reorder of XML option definitions.  It might come in handy
7a3408
one day.
7a3408
7a3408
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7a3408
(cherry picked from commit 7c8028cda95c3af388f7485e682ed07629bb9e7a)
7a3408
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/conf/domain_conf.c   |  2 +-
7a3408
 src/conf/domain_conf.h   | 17 +++++++++--------
7a3408
 src/libxl/libxl_domain.c |  3 ++-
7a3408
 src/lxc/lxc_domain.c     |  3 ++-
7a3408
 src/qemu/qemu_domain.c   |  3 ++-
7a3408
 5 files changed, 16 insertions(+), 12 deletions(-)
7a3408
7a3408
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
7a3408
index 8784367..9aee04f 100644
7a3408
--- a/src/conf/domain_conf.c
7a3408
+++ b/src/conf/domain_conf.c
7a3408
@@ -16343,7 +16343,7 @@ virDomainObjParseXML(xmlDocPtr xml,
7a3408
     VIR_FREE(nodes);
7a3408
 
7a3408
     if (xmlopt->privateData.parse &&
7a3408
-        xmlopt->privateData.parse(ctxt, obj) < 0)
7a3408
+        xmlopt->privateData.parse(ctxt, obj, &xmlopt->config) < 0)
7a3408
         goto error;
7a3408
 
7a3408
     return obj;
7a3408
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
7a3408
index 1be8e63..ed0ccba 100644
7a3408
--- a/src/conf/domain_conf.h
7a3408
+++ b/src/conf/domain_conf.h
7a3408
@@ -2357,14 +2357,6 @@ typedef bool (*virDomainObjListACLFilter)(virConnectPtr conn,
7a3408
 typedef struct _virDomainXMLOption virDomainXMLOption;
7a3408
 typedef virDomainXMLOption *virDomainXMLOptionPtr;
7a3408
 
7a3408
-typedef void *(*virDomainXMLPrivateDataAllocFunc)(void);
7a3408
-typedef void (*virDomainXMLPrivateDataFreeFunc)(void *);
7a3408
-typedef virObjectPtr (*virDomainXMLPrivateDataNewFunc)(void);
7a3408
-typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr,
7a3408
-                                                 virDomainObjPtr);
7a3408
-typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr,
7a3408
-                                                virDomainObjPtr);
7a3408
-
7a3408
 /* Called once after everything else has been parsed, for adjusting
7a3408
  * overall domain defaults.  */
7a3408
 typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def,
7a3408
@@ -2393,6 +2385,15 @@ struct _virDomainDefParserConfig {
7a3408
     unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
7a3408
 };
7a3408
 
7a3408
+typedef void *(*virDomainXMLPrivateDataAllocFunc)(void);
7a3408
+typedef void (*virDomainXMLPrivateDataFreeFunc)(void *);
7a3408
+typedef virObjectPtr (*virDomainXMLPrivateDataNewFunc)(void);
7a3408
+typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr,
7a3408
+                                                 virDomainObjPtr);
7a3408
+typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr,
7a3408
+                                                virDomainObjPtr,
7a3408
+                                                virDomainDefParserConfigPtr);
7a3408
+
7a3408
 typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks;
7a3408
 typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr;
7a3408
 struct _virDomainXMLPrivateDataCallbacks {
7a3408
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
7a3408
index 8e8a292..7bc4d92 100644
7a3408
--- a/src/libxl/libxl_domain.c
7a3408
+++ b/src/libxl/libxl_domain.c
7a3408
@@ -224,7 +224,8 @@ libxlDomainObjPrivateFree(void *data)
7a3408
 
7a3408
 static int
7a3408
 libxlDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
7a3408
-                              virDomainObjPtr vm)
7a3408
+                              virDomainObjPtr vm,
7a3408
+                              virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED)
7a3408
 {
7a3408
     libxlDomainObjPrivatePtr priv = vm->privateData;
7a3408
 
7a3408
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
7a3408
index 70606f3..2f377d8 100644
7a3408
--- a/src/lxc/lxc_domain.c
7a3408
+++ b/src/lxc/lxc_domain.c
7a3408
@@ -65,7 +65,8 @@ virLXCDomainObjPrivateXMLFormat(virBufferPtr buf,
7a3408
 
7a3408
 static int
7a3408
 virLXCDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
7a3408
-                               virDomainObjPtr vm)
7a3408
+                               virDomainObjPtr vm,
7a3408
+                               virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED)
7a3408
 {
7a3408
     virLXCDomainObjPrivatePtr priv = vm->privateData;
7a3408
     unsigned long long thepid;
7a3408
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
7a3408
index d95f24f..ca41ca4 100644
7a3408
--- a/src/qemu/qemu_domain.c
7a3408
+++ b/src/qemu/qemu_domain.c
7a3408
@@ -623,7 +623,8 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf,
7a3408
 
7a3408
 static int
7a3408
 qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
7a3408
-                             virDomainObjPtr vm)
7a3408
+                             virDomainObjPtr vm,
7a3408
+                             virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED)
7a3408
 {
7a3408
     qemuDomainObjPrivatePtr priv = vm->privateData;
7a3408
     char *monitorpath;
7a3408
-- 
7a3408
2.5.0
7a3408