[libvirt] [PATCH 05/21] util: introduce virXMLNamespace

Ján Tomko jtomko at redhat.com
Tue Aug 20 23:15:27 UTC 2019


For various XMLs, we allow a custom namespace for passing unsupported
configurations.

Introduce a single structure to hold all the driver-specific functions
to remove duplication.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/util/virxml.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/util/virxml.h b/src/util/virxml.h
index 6208977dd1..5b209bb040 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -246,3 +246,17 @@ VIR_DEFINE_AUTOCLEAN_FUNC(virXPathContextNodeSave, virXPathContextNodeRestore);
 
 VIR_DEFINE_AUTOPTR_FUNC(xmlDoc, xmlFreeDoc);
 VIR_DEFINE_AUTOPTR_FUNC(xmlXPathContext, xmlXPathFreeContext);
+
+typedef int (*virXMLNamespaceParse)(xmlXPathContextPtr, void **);
+typedef void (*virXMLNamespaceFree)(void *);
+typedef int (*virXMLNamespaceFormat)(virBufferPtr, void *);
+typedef const char *(*virXMLNamespaceHref)(void);
+
+struct _virXMLNamespace {
+    virXMLNamespaceParse parse;
+    virXMLNamespaceFree free;
+    virXMLNamespaceFormat format;
+    virXMLNamespaceHref href;
+};
+typedef struct _virXMLNamespace virXMLNamespace;
+typedef virXMLNamespace *virXMLNamespacePtr;
-- 
2.19.2




More information about the libvir-list mailing list