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

[libvirt] [PATCH 07/21] conf: storage: use generic XML namespace types



There is no need to copy and paste the same types pointing
to void all over the place.

Signed-off-by: Ján Tomko <jtomko redhat com>
---
 src/conf/storage_conf.c           |  4 ++--
 src/conf/storage_conf.h           | 23 ++++-------------------
 src/storage/storage_backend_fs.c  |  2 +-
 src/storage/storage_backend_rbd.c |  2 +-
 src/storage/storage_util.c        |  2 +-
 src/storage/storage_util.h        |  2 +-
 6 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index a2b977989f..fb8a16a119 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -140,7 +140,7 @@ struct _virStoragePoolOptions {
     int defaultFormat;
     int lastFormat;
 
-    virStoragePoolXMLNamespace ns;
+    virXMLNamespace ns;
 
     virStoragePoolFormatToString formatToString;
     virStoragePoolFormatFromString formatFromString;
@@ -341,7 +341,7 @@ virStoragePoolOptionsForPoolType(int type)
  */
 int
 virStoragePoolOptionsPoolTypeSetXMLNamespace(int type,
-                                             virStoragePoolXMLNamespacePtr ns)
+                                             virXMLNamespacePtr ns)
 {
     int ret = -1;
     virStoragePoolTypeInfoPtr backend = virStoragePoolTypeInfoLookup(type);
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index f399ac6192..1f62803a9d 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -31,28 +31,13 @@
 #include "storage_adapter_conf.h"
 #include "virautoclean.h"
 #include "virenum.h"
+#include "virxml.h"
+
 
-#include <libxml/tree.h>
-
-/* Various callbacks needed to parse/create Storage Pool XML's using
- * a private namespace */
-typedef int (*virStoragePoolDefNamespaceParse)(xmlXPathContextPtr, void **);
-typedef void (*virStoragePoolDefNamespaceFree)(void *);
-typedef int (*virStoragePoolDefNamespaceXMLFormat)(virBufferPtr, void *);
-typedef const char *(*virStoragePoolDefNamespaceHref)(void);
-
-typedef struct _virStoragePoolXMLNamespace virStoragePoolXMLNamespace;
-typedef virStoragePoolXMLNamespace *virStoragePoolXMLNamespacePtr;
-struct _virStoragePoolXMLNamespace {
-    virStoragePoolDefNamespaceParse parse;
-    virStoragePoolDefNamespaceFree free;
-    virStoragePoolDefNamespaceXMLFormat format;
-    virStoragePoolDefNamespaceHref href;
-};
 
 int
 virStoragePoolOptionsPoolTypeSetXMLNamespace(int type,
-                                             virStoragePoolXMLNamespacePtr ns);
+                                             virXMLNamespacePtr ns);
 
 int
 virStoragePoolOptionsFormatPool(virBufferPtr buf,
@@ -277,7 +262,7 @@ struct _virStoragePoolDef {
 
     /* Pool backend specific XML namespace data */
     void *namespaceData;
-    virStoragePoolXMLNamespace ns;
+    virXMLNamespace ns;
 };
 
 typedef struct _virStoragePoolSourceList virStoragePoolSourceList;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index ae4e9a03a3..d575b75449 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -701,7 +701,7 @@ virStorageBackend virStorageBackendNetFileSystem = {
     .wipeVol = virStorageBackendVolWipeLocal,
 };
 
-static virStoragePoolXMLNamespace virStoragePoolFSXMLNamespace = {
+static virXMLNamespace virStoragePoolFSXMLNamespace = {
     .parse = virStoragePoolDefFSNamespaceParse,
     .free = virStoragePoolDefFSNamespaceFree,
     .format = virStoragePoolDefFSNamespaceFormatXML,
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index f3104ba310..e490c690f5 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -1542,7 +1542,7 @@ virStorageBackend virStorageBackendRBD = {
 };
 
 
-static virStoragePoolXMLNamespace virStoragePoolRBDXMLNamespace = {
+static virXMLNamespace virStoragePoolRBDXMLNamespace = {
     .parse = virStoragePoolDefRBDNamespaceParse,
     .free = virStoragePoolDefRBDNamespaceFree,
     .format = virStoragePoolDefRBDNamespaceFormatXML,
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 62f857f9ea..3dc5ad2969 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -92,7 +92,7 @@ VIR_LOG_INIT("storage.storage_util");
  */
 int
 virStorageBackendNamespaceInit(int poolType,
-                               virStoragePoolXMLNamespacePtr xmlns)
+                               virXMLNamespacePtr xmlns)
 {
     return virStoragePoolOptionsPoolTypeSetXMLNamespace(poolType, xmlns);
 }
diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h
index 6df5928d9b..705e23631d 100644
--- a/src/storage/storage_util.h
+++ b/src/storage/storage_util.h
@@ -36,7 +36,7 @@ struct _virStoragePoolFSMountOptionsDef {
 
 int
 virStorageBackendNamespaceInit(int poolType,
-                               virStoragePoolXMLNamespacePtr xmlns);
+                               virXMLNamespacePtr xmlns);
 
 
 /* File creation/cloning functions used for cloning between backends */
-- 
2.19.2


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