[PATCH 10/43] conf: networkportdef: Provide only virNetworkPortDefParse

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

 



Replace the two helpers virNetworkPortDefParseString/File with the
common helper.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c            |  2 +-
 src/conf/virnetworkobj.c          |  2 +-
 src/conf/virnetworkportdef.c      | 17 +----------------
 src/conf/virnetworkportdef.h      |  8 +++-----
 src/libvirt_private.syms          |  3 +--
 src/network/bridge_driver.c       |  2 +-
 tests/virnetworkportxml2xmltest.c |  2 +-
 7 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b3202c9f76..adbd97e632 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29537,7 +29537,7 @@ virDomainNetCreatePort(virConnectPtr conn,
     VIR_FREE(portxml);

     if (!(portxml = virNetworkPortGetXMLDesc(port, 0)) ||
-        !(portdef = virNetworkPortDefParseString(portxml, 0)) ||
+        !(portdef = virNetworkPortDefParse(portxml, NULL, 0)) ||
         virDomainNetDefActualFromNetworkPort(iface, portdef) < 0) {
         virErrorPreserveLast(&save_err);
         virNetworkPortDelete(port, 0);
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index b4c61fff85..7621fa3380 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -1833,7 +1833,7 @@ virNetworkObjLoadAllPorts(virNetworkObj *net,

         file = g_strdup_printf("%s/%s.xml", dir, de->d_name);

-        portdef = virNetworkPortDefParseFile(file);
+        portdef = virNetworkPortDefParse(NULL, file, 0);
         if (!portdef) {
             VIR_WARN("Cannot parse port %s", file);
             continue;
diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c
index 651e4c3329..035e3fe758 100644
--- a/src/conf/virnetworkportdef.c
+++ b/src/conf/virnetworkportdef.c
@@ -251,7 +251,7 @@ virNetworkPortDefParseXML(xmlXPathContextPtr ctxt)
 }


-static virNetworkPortDef *
+virNetworkPortDef *
 virNetworkPortDefParse(const char *xmlStr,
                        const char *filename,
                        unsigned int flags)
@@ -268,21 +268,6 @@ virNetworkPortDefParse(const char *xmlStr,
 }


-virNetworkPortDef *
-virNetworkPortDefParseString(const char *xmlStr,
-                             unsigned int flags)
-{
-    return virNetworkPortDefParse(xmlStr, NULL, flags);
-}
-
-
-virNetworkPortDef *
-virNetworkPortDefParseFile(const char *filename)
-{
-    return virNetworkPortDefParse(NULL, filename, 0);
-}
-
-
 char *
 virNetworkPortDefFormat(const virNetworkPortDef *def)
 {
diff --git a/src/conf/virnetworkportdef.h b/src/conf/virnetworkportdef.h
index 908a7c8795..48e73dbefd 100644
--- a/src/conf/virnetworkportdef.h
+++ b/src/conf/virnetworkportdef.h
@@ -81,11 +81,9 @@ virNetworkPortDefFree(virNetworkPortDef *port);
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetworkPortDef, virNetworkPortDefFree);

 virNetworkPortDef *
-virNetworkPortDefParseString(const char *xml,
-                             unsigned int flags);
-
-virNetworkPortDef *
-virNetworkPortDefParseFile(const char *filename);
+virNetworkPortDefParse(const char *xmlStr,
+                       const char *filename,
+                       unsigned int flags);

 char *
 virNetworkPortDefFormat(const virNetworkPortDef *def);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 903c4196df..3ef3210184 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1326,8 +1326,7 @@ virNetworkObjUpdateAssignDef;
 virNetworkPortDefFormat;
 virNetworkPortDefFormatBuf;
 virNetworkPortDefFree;
-virNetworkPortDefParseFile;
-virNetworkPortDefParseString;
+virNetworkPortDefParse;
 virNetworkPortDefSaveStatus;


diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 7c6430b4e3..e4f5e93779 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -4844,7 +4844,7 @@ networkPortCreateXML(virNetworkPtr net,

     def = virNetworkObjGetDef(obj);

-    if (!(portdef = virNetworkPortDefParseString(xmldesc, flags)))
+    if (!(portdef = virNetworkPortDefParse(xmldesc, NULL, flags)))
         goto cleanup;

     if (virNetworkPortCreateXMLEnsureACL(net->conn, def, portdef) < 0)
diff --git a/tests/virnetworkportxml2xmltest.c b/tests/virnetworkportxml2xmltest.c
index 237624a752..21e3c6f697 100644
--- a/tests/virnetworkportxml2xmltest.c
+++ b/tests/virnetworkportxml2xmltest.c
@@ -38,7 +38,7 @@ testCompareXMLToXMLFiles(const char *expected)
     g_autofree char *actual = NULL;
     g_autoptr(virNetworkPortDef) dev = NULL;

-    if (!(dev = virNetworkPortDefParseFile(expected)))
+    if (!(dev = virNetworkPortDefParse(NULL, expected, 0)))
         return -1;

     if (!(actual = virNetworkPortDefFormat(dev)))
-- 
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