[RFCv3 21/25] conf: Replace virNetworkDNSForwarderParseXML(hardcoded) with namesake(generated)

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

 



Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx>
---
 src/conf/network_conf.c | 36 +-----------------------------------
 src/conf/network_conf.h |  7 ++++---
 2 files changed, 5 insertions(+), 38 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index cf9e77d3..ef28bb4d 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -174,13 +174,6 @@ virNetworkIPDefClear(virNetworkIPDef *def)
 }
 
 
-static void
-virNetworkDNSForwarderClear(virNetworkDNSForwarder *def)
-{
-    VIR_FREE(def->domain);
-}
-
-
 static void
 virNetworkDNSDefClear(virNetworkDNSDef *def)
 {
@@ -871,7 +864,7 @@ virNetworkDNSTxtDefParseHook(xmlNodePtr node G_GNUC_UNUSED,
 }
 
 
-static int
+int
 virNetworkDNSForwarderParseHook(xmlNodePtr node G_GNUC_UNUSED,
                                 virNetworkDNSForwarder *def,
                                 const char *instname G_GNUC_UNUSED,
@@ -890,33 +883,6 @@ virNetworkDNSForwarderParseHook(xmlNodePtr node G_GNUC_UNUSED,
 }
 
 
-static int
-virNetworkDNSForwarderParseXML(xmlNodePtr node,
-                               virNetworkDNSForwarder *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 (virNetworkDNSForwarderParseHook(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 836d088d..17f6c309 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -150,9 +150,9 @@ struct _virNetworkDNSHostDef {  /* genparse, genformat */
 
 
 typedef struct _virNetworkDNSForwarder virNetworkDNSForwarder;
-struct _virNetworkDNSForwarder {
-    virSocketAddr addr;
-    char *domain;
+struct _virNetworkDNSForwarder {    /* genparse */
+    virSocketAddr addr;             /* xmlattr */
+    char *domain;                   /* xmlattr */
 };
 
 typedef struct _virNetworkDNSDef virNetworkDNSDef;
@@ -429,6 +429,7 @@ virNetworkDefUpdateSection(virNetworkDef *def,
 
 VIR_ENUM_DECL(virNetworkTaint);
 
+#define ENABLE_VIR_NETWORK_DNSFORWARDER_PARSE_HOOK
 #define ENABLE_VIR_NETWORK_DNSHOST_DEF_PARSE_HOOK
 #define ENABLE_VIR_NETWORK_DNSSRV_DEF_PARSE_HOOK
 #define ENABLE_VIR_NETWORK_DNSTXT_DEF_PARSE_HOOK
-- 
2.25.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