[PATCH 02/26] Remove virDomainNetType parameter from nwfilter drivers

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

 



The 'virDomainNetType' is unused in every impl of the
virNWFilterRuleCreateInstance driver method. Remove it
from the code to avoid the dependancy on the external
enum.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/nwfilter/nwfilter_dhcpsnoop.c         |  6 ------
 src/nwfilter/nwfilter_dhcpsnoop.h         |  1 -
 src/nwfilter/nwfilter_ebiptables_driver.c | 18 +++++++-----------
 src/nwfilter/nwfilter_gentech_driver.c    | 17 +++--------------
 src/nwfilter/nwfilter_gentech_driver.h    |  1 -
 src/nwfilter/nwfilter_learnipaddr.c       |  5 -----
 src/nwfilter/nwfilter_learnipaddr.h       |  2 --
 src/nwfilter/nwfilter_tech_driver.h       |  5 +----
 8 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index df46a72..bfd0553 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -137,7 +137,6 @@ struct _virNWFilterSnoopReq {
     char                                *ifname;
     int                                  ifindex;
     char                                *linkdev;
-    enum virDomainNetType                nettype;
     char                                 ifkey[VIR_IFKEY_LEN];
     virMacAddr                           macaddr;
     char                                *filtername;
@@ -493,7 +492,6 @@ virNWFilterSnoopIPLeaseInstallRule(virNWFilterSnoopIPLeasePtr ipl,
                                               req->ifname,
                                               req->ifindex,
                                               req->linkdev,
-                                              req->nettype,
                                               &req->macaddr,
                                               req->filtername,
                                               req->vars);
@@ -879,7 +877,6 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req,
                                                req->ifname,
                                                req->ifindex,
                                                req->linkdev,
-                                               req->nettype,
                                                &req->macaddr,
                                                req->filtername,
                                                req->vars);
@@ -1592,7 +1589,6 @@ int
 virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
                         const char *ifname,
                         const char *linkdev,
-                        enum virDomainNetType nettype,
                         const unsigned char *vmuuid,
                         const virMacAddr *macaddr,
                         const char *filtername,
@@ -1628,7 +1624,6 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
     req->driver = driver;
     req->techdriver = techdriver;
     tmp = virNetDevGetIndex(ifname, &req->ifindex);
-    req->nettype = nettype;
     virMacAddrSet(&req->macaddr, macaddr);
     req->vars = virNWFilterHashTableCreate(0);
     req->linkdev = NULL;
@@ -2230,7 +2225,6 @@ int
 virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
                         const char *ifname ATTRIBUTE_UNUSED,
                         const char *linkdev ATTRIBUTE_UNUSED,
-                        enum virDomainNetType nettype ATTRIBUTE_UNUSED,
                         const unsigned char *vmuuid ATTRIBUTE_UNUSED,
                         const virMacAddr *macaddr ATTRIBUTE_UNUSED,
                         const char *filtername ATTRIBUTE_UNUSED,
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.h b/src/nwfilter/nwfilter_dhcpsnoop.h
index 6e73eb3..3ef96fa 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.h
+++ b/src/nwfilter/nwfilter_dhcpsnoop.h
@@ -32,7 +32,6 @@ void virNWFilterDHCPSnoopShutdown(void);
 int virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
                             const char *ifname,
                             const char *linkdev,
-                            enum virDomainNetType nettype,
                             const unsigned char *vmuuid,
                             const virMacAddr *macaddr,
                             const char *filtername,
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index ce0b7e3..4365c1f 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -2649,8 +2649,7 @@ ebtablesCreateRuleInstance(char chainPrefix,
  * pointed to by res, -1 otherwise
  */
 static int
-ebiptablesCreateRuleInstance(enum virDomainNetType nettype ATTRIBUTE_UNUSED,
-                             virNWFilterDefPtr nwfilter,
+ebiptablesCreateRuleInstance(virNWFilterDefPtr nwfilter,
                              virNWFilterRuleDefPtr rule,
                              const char *ifname,
                              virNWFilterVarCombIterPtr vars,
@@ -2740,13 +2739,11 @@ ebiptablesCreateRuleInstance(enum virDomainNetType nettype ATTRIBUTE_UNUSED,
 }
 
 static int
-ebiptablesCreateRuleInstanceIterate(
-                             enum virDomainNetType nettype ATTRIBUTE_UNUSED,
-                             virNWFilterDefPtr nwfilter,
-                             virNWFilterRuleDefPtr rule,
-                             const char *ifname,
-                             virNWFilterHashTablePtr vars,
-                             virNWFilterRuleInstPtr res)
+ebiptablesCreateRuleInstanceIterate(virNWFilterDefPtr nwfilter,
+                                    virNWFilterRuleDefPtr rule,
+                                    const char *ifname,
+                                    virNWFilterHashTablePtr vars,
+                                    virNWFilterRuleInstPtr res)
 {
     int rc = 0;
     virNWFilterVarCombIterPtr vciter, tmp;
@@ -2761,8 +2758,7 @@ ebiptablesCreateRuleInstanceIterate(
         return -1;
 
     do {
-        rc = ebiptablesCreateRuleInstance(nettype,
-                                          nwfilter,
+        rc = ebiptablesCreateRuleInstance(nwfilter,
                                           rule,
                                           ifname,
                                           tmp,
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 1ce5e70..82ff628 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -289,7 +289,6 @@ virNWFilterPrintVars(virHashTablePtr vars,
  */
 static virNWFilterRuleInstPtr
 virNWFilterRuleInstantiate(virNWFilterTechDriverPtr techdriver,
-                           enum virDomainNetType nettype,
                            virNWFilterDefPtr filter,
                            virNWFilterRuleDefPtr rule,
                            const char *ifname,
@@ -304,7 +303,7 @@ virNWFilterRuleInstantiate(virNWFilterTechDriverPtr techdriver,
 
     ret->techdriver = techdriver;
 
-    rc = techdriver->createRuleInstance(nettype, filter,
+    rc = techdriver->createRuleInstance(filter,
                                         rule, ifname, vars, ret);
 
     if (rc) {
@@ -376,7 +375,6 @@ virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
  */
 static int
 _virNWFilterInstantiateRec(virNWFilterTechDriverPtr techdriver,
-                           enum virDomainNetType nettype,
                            virNWFilterDefPtr filter,
                            const char *ifname,
                            virNWFilterHashTablePtr vars,
@@ -396,7 +394,6 @@ _virNWFilterInstantiateRec(virNWFilterTechDriverPtr techdriver,
         virNWFilterIncludeDefPtr inc  = filter->filterEntries[i]->include;
         if (rule) {
             inst = virNWFilterRuleInstantiate(techdriver,
-                                              nettype,
                                               filter,
                                               rule,
                                               ifname,
@@ -449,7 +446,6 @@ _virNWFilterInstantiateRec(virNWFilterTechDriverPtr techdriver,
                 }
 
                 rc = _virNWFilterInstantiateRec(techdriver,
-                                                nettype,
                                                 next_filter,
                                                 ifname,
                                                 tmpvars,
@@ -634,7 +630,6 @@ virNWFilterRuleInstancesToArray(int nEntries,
 static int
 virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
                        virNWFilterTechDriverPtr techdriver,
-                       enum virDomainNetType nettype,
                        virNWFilterDefPtr filter,
                        const char *ifname,
                        int ifindex,
@@ -690,7 +685,7 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
             }
             if (STRCASEEQ(learning, "dhcp")) {
                 rc = virNWFilterDHCPSnoopReq(techdriver, ifname, linkdev,
-                                             nettype, vmuuid, macaddr,
+                                             vmuuid, macaddr,
                                              filter->name, vars, driver);
                 goto err_exit;
             } else if (STRCASEEQ(learning, "any")) {
@@ -699,7 +694,7 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
                                                    ifname,
                                                    ifindex,
                                                    linkdev,
-                                                   nettype, macaddr,
+                                                   macaddr,
                                                    filter->name,
                                                    vars, driver,
                                                    DETECT_DHCP|DETECT_STATIC);
@@ -723,7 +718,6 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
     }
 
     rc = _virNWFilterInstantiateRec(techdriver,
-                                    nettype,
                                     filter,
                                     ifname,
                                     vars,
@@ -805,7 +799,6 @@ __virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
                                const char *ifname,
                                int ifindex,
                                const char *linkdev,
-                               enum virDomainNetType nettype,
                                const virMacAddr *macaddr,
                                const char *filtername,
                                virNWFilterHashTablePtr filterparams,
@@ -892,7 +885,6 @@ __virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
 
     rc = virNWFilterInstantiate(vmuuid,
                                 techdriver,
-                                nettype,
                                 filter,
                                 ifname,
                                 ifindex,
@@ -953,7 +945,6 @@ _virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
                                         net->ifname,
                                         ifindex,
                                         linkdev,
-                                        net->type,
                                         &net->mac,
                                         net->filter,
                                         net->filterparams,
@@ -974,7 +965,6 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
                                  const char *ifname,
                                  int ifindex,
                                  const char *linkdev,
-                                 enum virDomainNetType nettype,
                                  const virMacAddr *macaddr,
                                  const char *filtername,
                                  virNWFilterHashTablePtr filterparams)
@@ -991,7 +981,6 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
                                         ifname,
                                         ifindex,
                                         linkdev,
-                                        nettype,
                                         macaddr,
                                         filtername,
                                         filterparams,
diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter_gentech_driver.h
index da85508..8349ab4 100644
--- a/src/nwfilter/nwfilter_gentech_driver.h
+++ b/src/nwfilter/nwfilter_gentech_driver.h
@@ -51,7 +51,6 @@ int virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
                                      const char *ifname,
                                      int ifindex,
                                      const char *linkdev,
-                                     enum virDomainNetType nettype,
                                      const virMacAddr *macaddr,
                                      const char *filtername,
                                      virNWFilterHashTablePtr filterparams);
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index a6cdc87..4cea9cf 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -622,7 +622,6 @@ learnIPAddressThread(void *arg)
                                                    req->ifname,
                                                    req->ifindex,
                                                    req->linkdev,
-                                                   req->nettype,
                                                    &req->macaddr,
                                                    req->filtername,
                                                    req->filterparams);
@@ -661,7 +660,6 @@ learnIPAddressThread(void *arg)
  * @ifindex: the index of the interface
  * @linkdev : the name of the link device; currently only used in case of a
  *     macvtap device
- * @nettype : the type of interface
  * @macaddr : the MAC address of the interface
  * @filtername : the name of the top-level filter to apply to the interface
  *               once its IP address has been detected
@@ -681,7 +679,6 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
                           const char *ifname,
                           int ifindex,
                           const char *linkdev,
-                          enum virDomainNetType nettype,
                           const virMacAddr *macaddr,
                           const char *filtername,
                           virNWFilterHashTablePtr filterparams,
@@ -733,7 +730,6 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
     }
 
     req->ifindex = ifindex;
-    req->nettype = nettype;
     virMacAddrSet(&req->macaddr, macaddr);
     req->driver = driver;
     req->filterparams = ht;
@@ -771,7 +767,6 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
                           const char *ifname ATTRIBUTE_UNUSED,
                           int ifindex ATTRIBUTE_UNUSED,
                           const char *linkdev ATTRIBUTE_UNUSED,
-                          enum virDomainNetType nettype ATTRIBUTE_UNUSED,
                           const virMacAddr *macaddr ATTRIBUTE_UNUSED,
                           const char *filtername ATTRIBUTE_UNUSED,
                           virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
diff --git a/src/nwfilter/nwfilter_learnipaddr.h b/src/nwfilter/nwfilter_learnipaddr.h
index 0195d10..1cc881a 100644
--- a/src/nwfilter/nwfilter_learnipaddr.h
+++ b/src/nwfilter/nwfilter_learnipaddr.h
@@ -42,7 +42,6 @@ struct _virNWFilterIPAddrLearnReq {
     char ifname[IF_NAMESIZE];
     int ifindex;
     char linkdev[IF_NAMESIZE];
-    enum virDomainNetType nettype;
     virMacAddr macaddr;
     char *filtername;
     virNWFilterHashTablePtr filterparams;
@@ -58,7 +57,6 @@ int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
                               const char *ifname,
                               int ifindex,
                               const char *linkdev,
-                              enum virDomainNetType nettype,
                               const virMacAddr *macaddr,
                               const char *filtername,
                               virNWFilterHashTablePtr filterparams,
diff --git a/src/nwfilter/nwfilter_tech_driver.h b/src/nwfilter/nwfilter_tech_driver.h
index 5777757..03588e2 100644
--- a/src/nwfilter/nwfilter_tech_driver.h
+++ b/src/nwfilter/nwfilter_tech_driver.h
@@ -44,10 +44,7 @@ struct _virNWFilterRuleInst {
 typedef int (*virNWFilterTechDrvInit)(bool privileged);
 typedef void (*virNWFilterTechDrvShutdown)(void);
 
-enum virDomainNetType;
-
-typedef int (*virNWFilterRuleCreateInstance)(enum virDomainNetType nettype,
-                                             virNWFilterDefPtr filter,
+typedef int (*virNWFilterRuleCreateInstance)(virNWFilterDefPtr filter,
                                              virNWFilterRuleDefPtr rule,
                                              const char *ifname,
                                              virNWFilterHashTablePtr vars,
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




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