[RFC 20/29] conf: Replace virNetworkDNSTxtDefParseXML(hardcoded) with namesake(generated)

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

 



Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx>
---
 docs/schemas/network.rng |  1 +
 src/conf/network_conf.c  | 37 +++++--------------------------------
 2 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index b0f4a64..07fbd5b 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -294,6 +294,7 @@
                   "structure": {"output": "src/conf/network_conf"},
                   "clearfunc": {"output": "src/conf/network_conf"},
                   "parsefunc": {
+                    "output": "src/conf/network_conf",
                     "post": true,
                     "args.noctxt": true,
                     "args.instname": true,
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index f83799f..5180508 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -488,7 +488,7 @@ virSocketAddrRangeParseXML(const char *networkName,
 }
 
 
-static int
+int
 virNetworkDNSTxtDefParseXMLPost(xmlNodePtr curnode G_GNUC_UNUSED,
                                 virNetworkDNSTxtDefPtr def,
                                 const char *networkName,
@@ -746,34 +746,6 @@ virNetworkDNSHostDefParseXMLPost(xmlNodePtr curnode G_GNUC_UNUSED,
 }
 
 
-static int
-virNetworkDNSTxtDefParseXML(const char *networkName,
-                            xmlNodePtr node,
-                            virNetworkDNSTxtDefPtr def,
-                            bool partialOkay)
-{
-    if (!(def->name = virXMLPropString(node, "name"))) {
-        virReportError(VIR_ERR_XML_DETAIL,
-                       _("missing required name attribute in DNS TXT record "
-                         "of network %s"), networkName);
-        goto error;
-    }
-
-    def->value = virXMLPropString(node, "value");
-
-    if (virNetworkDNSTxtDefParseXMLPost(node, def,
-                                        networkName, partialOkay,
-                                        def->name, def->value) < 0)
-        goto error;
-
-    return 0;
-
- error:
-    virNetworkDNSTxtDefClear(def);
-    return -1;
-}
-
-
 static int
 virNetworkDNSDefParseXML(const char *networkName,
                          xmlNodePtr node,
@@ -907,8 +879,9 @@ virNetworkDNSDefParseXML(const char *networkName,
             goto cleanup;
 
         for (i = 0; i < ntxts; i++) {
-            if (virNetworkDNSTxtDefParseXML(networkName, txtNodes[i],
-                                            &def->txts[def->ntxts], false) < 0) {
+            if (virNetworkDNSTxtDefParseXML(txtNodes[i],
+                                            &def->txts[def->ntxts],
+                                            networkName, false) < 0) {
                 goto cleanup;
             }
             def->ntxts++;
@@ -3513,7 +3486,7 @@ virNetworkDefUpdateDNSTxt(virNetworkDefPtr def,
     if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "txt") < 0)
         goto cleanup;
 
-    if (virNetworkDNSTxtDefParseXML(def->name, ctxt->node, &txt, !isAdd) < 0)
+    if (virNetworkDNSTxtDefParseXML(ctxt->node, &txt, def->name, !isAdd) < 0)
         goto cleanup;
 
     for (foundIdx = 0; foundIdx < dns->ntxts; foundIdx++) {
-- 
2.17.1







[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