[PATCH 1/3] conf: Pass private data to Parse function of XML options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This needs a reorder of XML option definitions.  It might come in handy
one day.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 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 73ac5374fd8b..ef7d31d972f4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16339,7 +16339,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 0fe6b1a47c8f..b816346174aa 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 224ff773f938..40dcea171c06 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 70606f376583..2f377d8dcba3 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 8b050a043995..5bc033f908a1 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;
-- 
2.4.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]