[PATCH 15/43] conf: storage: Provide only virStoragePoolDefParse

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

 



Replace the virStoragePoolDefParseString/File thin wrappers by
virStoragePoolDefParse.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c          |  2 +-
 src/conf/storage_conf.c         | 17 +----------------
 src/conf/storage_conf.h         |  8 +++-----
 src/conf/virstorageobj.c        |  2 +-
 src/libvirt_private.syms        |  3 +--
 src/storage/storage_driver.c    |  4 ++--
 src/test/test_driver.c          |  4 ++--
 tests/storagepoolxml2argvtest.c |  2 +-
 tests/storagepoolxml2xmltest.c  |  2 +-
 tests/storagevolxml2argvtest.c  |  4 ++--
 tests/storagevolxml2xmltest.c   |  2 +-
 11 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index adbd97e632..2a3ea9641f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29914,7 +29914,7 @@ virDomainStorageSourceTranslateSourcePool(virStorageSource *src,
     if (!(poolxml = virStoragePoolGetXMLDesc(pool, 0)))
         return -1;

-    if (!(pooldef = virStoragePoolDefParseString(poolxml, 0)))
+    if (!(pooldef = virStoragePoolDefParse(poolxml, NULL, 0)))
         return -1;

     src->srcpool->pooltype = pooldef->type;
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index c11f40488d..0c095c73e0 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -972,7 +972,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
 }


-static virStoragePoolDef *
+virStoragePoolDef *
 virStoragePoolDefParse(const char *xmlStr,
                        const char *filename,
                        unsigned int flags)
@@ -990,21 +990,6 @@ virStoragePoolDefParse(const char *xmlStr,
 }


-virStoragePoolDef *
-virStoragePoolDefParseString(const char *xmlStr,
-                             unsigned int flags)
-{
-    return virStoragePoolDefParse(xmlStr, NULL, flags);
-}
-
-
-virStoragePoolDef *
-virStoragePoolDefParseFile(const char *filename)
-{
-    return virStoragePoolDefParse(NULL, filename, 0);
-}
-
-
 static int
 virStoragePoolSourceFormat(virBuffer *buf,
                            virStoragePoolOptions *options,
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 5eee5b6881..ead54ca7c6 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -272,11 +272,9 @@ virStoragePoolDef *
 virStoragePoolDefParseXML(xmlXPathContextPtr ctxt);

 virStoragePoolDef *
-virStoragePoolDefParseString(const char *xml,
-                             unsigned int flags);
-
-virStoragePoolDef *
-virStoragePoolDefParseFile(const char *filename);
+virStoragePoolDefParse(const char *xmlStr,
+                       const char *filename,
+                       unsigned int flags);

 char *
 virStoragePoolDefFormat(virStoragePoolDef *def);
diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index e1465c8376..77128a4846 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -1579,7 +1579,7 @@ virStoragePoolObjLoad(virStoragePoolObjList *pools,

     VIR_DEBUG("loading storage pool config XML '%s'", path);

-    if (!(def = virStoragePoolDefParseFile(path)))
+    if (!(def = virStoragePoolDefParse(NULL, path, 0)))
         return NULL;

     if (!virStringMatchesNameSuffix(file, def->name, ".xml")) {
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ddc2394fb9..8fec8d9027 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1053,9 +1053,8 @@ virStoragePoolCapsNew;
 virStoragePartedFsTypeToString;
 virStoragePoolDefFormat;
 virStoragePoolDefFree;
-virStoragePoolDefParseFile;
+virStoragePoolDefParse;
 virStoragePoolDefParseSourceString;
-virStoragePoolDefParseString;
 virStoragePoolFormatDiskTypeFromString;
 virStoragePoolFormatDiskTypeToString;
 virStoragePoolFormatFileSystemNetTypeToString;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index fccf0fcf52..aefe638083 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -721,7 +721,7 @@ storagePoolCreateXML(virConnectPtr conn,
     VIR_EXCLUSIVE_FLAGS_RET(VIR_STORAGE_POOL_BUILD_OVERWRITE,
                             VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, NULL);

-    if (!(newDef = virStoragePoolDefParseString(xml, 0)))
+    if (!(newDef = virStoragePoolDefParse(xml, NULL, 0)))
         goto cleanup;

     if (virStoragePoolCreateXMLEnsureACL(conn, newDef) < 0)
@@ -801,7 +801,7 @@ storagePoolDefineXML(virConnectPtr conn,

     virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL);

-    if (!(newDef = virStoragePoolDefParseString(xml, flags)))
+    if (!(newDef = virStoragePoolDefParse(xml, NULL, flags)))
         goto cleanup;

     if (virXMLCheckIllegalChars("name", newDef->name, "\n") < 0)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 27cf3ced43..4245b32c15 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -6631,7 +6631,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
     virCheckFlags(0, NULL);

     virObjectLock(privconn);
-    if (!(newDef = virStoragePoolDefParseString(xml, 0)))
+    if (!(newDef = virStoragePoolDefParse(xml, NULL, 0)))
         goto cleanup;

     if (!(obj = virStoragePoolObjListAdd(privconn->pools, &newDef,
@@ -6693,7 +6693,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
     virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL);

     virObjectLock(privconn);
-    if (!(newDef = virStoragePoolDefParseString(xml, flags)))
+    if (!(newDef = virStoragePoolDefParse(xml, NULL, flags)))
         goto cleanup;

     newDef->capacity = defaultPoolCap;
diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtest.c
index 04ff45f98d..e8e40d695e 100644
--- a/tests/storagepoolxml2argvtest.c
+++ b/tests/storagepoolxml2argvtest.c
@@ -27,7 +27,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
     g_autofree char *src = NULL;
     g_autoptr(virCommand) cmd = NULL;

-    if (!(def = virStoragePoolDefParseFile(poolxml)))
+    if (!(def = virStoragePoolDefParse(NULL, poolxml, 0)))
         goto cleanup;
     defTypeStr = virStoragePoolTypeToString(def->type);

diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
index 76d6f54b33..6a48594197 100644
--- a/tests/storagepoolxml2xmltest.c
+++ b/tests/storagepoolxml2xmltest.c
@@ -19,7 +19,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
     g_autofree char *actual = NULL;
     g_autoptr(virStoragePoolDef) dev = NULL;

-    if (!(dev = virStoragePoolDefParseFile(inxml)))
+    if (!(dev = virStoragePoolDefParse(NULL, inxml, 0)))
         return -1;

     if (!(actual = virStoragePoolDefFormat(dev)))
diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index 6f1fc7b38c..22b4cda5c5 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -48,7 +48,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
     g_autoptr(virStorageVolDef) inputvol = NULL;
     g_autoptr(virStoragePoolDef) inputpool = NULL;

-    if (!(def = virStoragePoolDefParseFile(poolxml)))
+    if (!(def = virStoragePoolDefParse(NULL, poolxml, 0)))
         goto cleanup;

     if (!(obj = virStoragePoolObjNew())) {
@@ -58,7 +58,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
     virStoragePoolObjSetDef(obj, def);

     if (inputpoolxml) {
-        if (!(inputpool = virStoragePoolDefParseFile(inputpoolxml)))
+        if (!(inputpool = virStoragePoolDefParse(NULL, inputpoolxml, 0)))
             goto cleanup;
     }

diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c
index 161cb7c6bc..7b229ac52a 100644
--- a/tests/storagevolxml2xmltest.c
+++ b/tests/storagevolxml2xmltest.c
@@ -19,7 +19,7 @@ testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
     g_autoptr(virStoragePoolDef) pool = NULL;
     g_autoptr(virStorageVolDef) dev = NULL;

-    if (!(pool = virStoragePoolDefParseFile(poolxml)))
+    if (!(pool = virStoragePoolDefParse(NULL, poolxml, 0)))
         return -1;

     if (!(dev = virStorageVolDefParseFile(pool, inxml, flags)))
-- 
2.37.3




[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]

  Powered by Linux