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

[RFCv2 17/46] conf: Replace virNetworkDNSForwarderParseXML(hardcoded) with namesake(generated)



Signed-off-by: Shi Lei <shi_lei massclouds com>
---
 src/conf/network_conf.c | 36 +-----------------------------------
 src/conf/network_conf.h |  6 +++---
 2 files changed, 4 insertions(+), 38 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 2af537c..608843d 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -174,13 +174,6 @@ virNetworkIPDefClear(virNetworkIPDefPtr def)
 }
 
 
-static void
-virNetworkDNSForwarderClear(virNetworkDNSForwarderPtr def)
-{
-    VIR_FREE(def->domain);
-}
-
-
 static void
 virNetworkDNSDefClear(virNetworkDNSDefPtr def)
 {
@@ -870,7 +863,7 @@ virNetworkDNSTxtDefParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
 }
 
 
-static int
+int
 virNetworkDNSForwarderParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
                                    virNetworkDNSForwarderPtr def,
                                    const char *instname G_GNUC_UNUSED,
@@ -889,33 +882,6 @@ virNetworkDNSForwarderParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
 }
 
 
-static int
-virNetworkDNSForwarderParseXML(xmlNodePtr node,
-                               virNetworkDNSForwarderPtr def,
-                               const char *networkName,
-                               void *parent G_GNUC_UNUSED,
-                               void *opaque)
-{
-    g_autofree char *addr = virXMLPropString(node, "addr");
-
-    if (addr && virSocketAddrParse(&def->addr, addr, AF_UNSPEC) < 0) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("Invalid forwarder IP address '%s' "
-                         "in network '%s'"),
-                       addr, networkName);
-        return -1;
-    }
-
-    def->domain = virXMLPropString(node, "domain");
-
-    if (virNetworkDNSForwarderParseXMLHook(node, def, networkName, def, opaque,
-                                           addr) < 0)
-        return -1;
-
-    return 0;
-}
-
-
 static int
 virNetworkDNSDefParseXML(const char *networkName,
                          xmlNodePtr node,
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 61863b0..881a9f2 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -158,9 +158,9 @@ struct _virNetworkDNSHostDef {  /* genparse:withhook, genformat */
 
 typedef struct _virNetworkDNSForwarder virNetworkDNSForwarder;
 typedef virNetworkDNSForwarder *virNetworkDNSForwarderPtr;
-struct _virNetworkDNSForwarder {
-    virSocketAddr addr;
-    char *domain;
+struct _virNetworkDNSForwarder {    /* genparse:withhook */
+    virSocketAddr addr;             /* xmlattr */
+    char *domain;                   /* xmlattr */
 };
 
 typedef struct _virNetworkDNSDef virNetworkDNSDef;
-- 
2.25.1



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