[libvirt] [PATCH v2] nwfilter: enum cleanups in "src/nwfilter/*"

Julio Faracco jcfaracco at gmail.com
Thu Jun 26 00:16:55 UTC 2014


As we are doing with the enum structures, a cleanup in
"src/nwfilter/" directory was done now. All the enums that were
defined in the header files were converted to typedefs in this
directory. This patch includes all the adjustments to remove
conflicts when you do this kind of change. "Enum-to-typedef"'s
conversions were made in "src/nwfilter/nwfilter_{gentech_driver,
learnipaddr, tech_driver}.h".

Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
---
 src/nwfilter/nwfilter_gentech_driver.c |   12 ++++++------
 src/nwfilter/nwfilter_gentech_driver.h |    4 ++--
 src/nwfilter/nwfilter_learnipaddr.c    |    8 ++++----
 src/nwfilter/nwfilter_learnipaddr.h    |    8 ++++----
 src/nwfilter/nwfilter_tech_driver.h    |    6 +++---
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 5bed106..e267cf1 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -332,7 +332,7 @@ static int
 virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
                      virNWFilterDefPtr def,
                      virNWFilterHashTablePtr vars,
-                     enum instCase useNewFilter,
+                     virInstCase useNewFilter,
                      bool *foundNewFilter,
                      virNWFilterInstPtr inst);
 
@@ -374,7 +374,7 @@ static int
 virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
                                 virNWFilterIncludeDefPtr inc,
                                 virNWFilterHashTablePtr vars,
-                                enum instCase useNewFilter,
+                                virInstCase useNewFilter,
                                 bool *foundNewFilter,
                                 virNWFilterInstPtr inst)
 {
@@ -464,7 +464,7 @@ static int
 virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
                      virNWFilterDefPtr def,
                      virNWFilterHashTablePtr vars,
-                     enum instCase useNewFilter,
+                     virInstCase useNewFilter,
                      bool *foundNewFilter,
                      virNWFilterInstPtr inst)
 {
@@ -630,7 +630,7 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
                        int ifindex,
                        const char *linkdev,
                        virNWFilterHashTablePtr vars,
-                       enum instCase useNewFilter, bool *foundNewFilter,
+                       virInstCase useNewFilter, bool *foundNewFilter,
                        bool teardownOld,
                        const virMacAddr *macaddr,
                        virNWFilterDriverStatePtr driver,
@@ -782,7 +782,7 @@ __virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
                                const virMacAddr *macaddr,
                                const char *filtername,
                                virNWFilterHashTablePtr filterparams,
-                               enum instCase useNewFilter,
+                               virInstCase useNewFilter,
                                bool forceWithPendingReq,
                                bool *foundNewFilter)
 {
@@ -896,7 +896,7 @@ _virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
                               const unsigned char *vmuuid,
                               const virDomainNetDef *net,
                               bool teardownOld,
-                              enum instCase useNewFilter,
+                              virInstCase useNewFilter,
                               bool *foundNewFilter)
 {
     const char *linkdev = (net->type == VIR_DOMAIN_NET_TYPE_DIRECT)
diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter_gentech_driver.h
index 8349ab4..4d14603 100644
--- a/src/nwfilter/nwfilter_gentech_driver.h
+++ b/src/nwfilter/nwfilter_gentech_driver.h
@@ -32,10 +32,10 @@ virNWFilterTechDriverPtr virNWFilterTechDriverForName(const char *name);
 int virNWFilterTechDriversInit(bool privileged);
 void virNWFilterTechDriversShutdown(void);
 
-enum instCase {
+typedef enum {
     INSTANTIATE_ALWAYS,
     INSTANTIATE_FOLLOW_NEWFILTER,
-};
+} virInstCase;
 
 
 int virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 4cea9cf..ff73515 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -326,7 +326,7 @@ virNWFilterDeregisterLearnReq(int ifindex)
 static void
 procDHCPOpts(struct dhcp *dhcp, int dhcp_opts_len,
              uint32_t *vmaddr, uint32_t *bcastaddr,
-             enum howDetect *howDetected)
+             virHowDetect *howDetected)
 {
     struct dhcp_option *dhcpopt = &dhcp->options[0];
 
@@ -395,7 +395,7 @@ learnIPAddressThread(void *arg)
     char *filter = NULL;
     uint16_t etherType;
     bool showError = true;
-    enum howDetect howDetected = 0;
+    virHowDetect howDetected = 0;
     virNWFilterTechDriverPtr techdriver = req->techdriver;
 
     if (virNWFilterLockIface(req->ifname) < 0)
@@ -683,7 +683,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
                           const char *filtername,
                           virNWFilterHashTablePtr filterparams,
                           virNWFilterDriverStatePtr driver,
-                          enum howDetect howDetect)
+                          virHowDetect howDetect)
 {
     int rc;
     virNWFilterIPAddrLearnReqPtr req = NULL;
@@ -771,7 +771,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
                           const char *filtername ATTRIBUTE_UNUSED,
                           virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
                           virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED,
-                          enum howDetect howDetect ATTRIBUTE_UNUSED)
+                          virHowDetect howdetect ATTRIBUTE_UNUSED)
 {
     virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                    _("IP parameter must be given since libvirt "
diff --git a/src/nwfilter/nwfilter_learnipaddr.h b/src/nwfilter/nwfilter_learnipaddr.h
index 1cc881a..19f8881 100644
--- a/src/nwfilter/nwfilter_learnipaddr.h
+++ b/src/nwfilter/nwfilter_learnipaddr.h
@@ -30,10 +30,10 @@
 # include "nwfilter_tech_driver.h"
 # include <net/if.h>
 
-enum howDetect {
+typedef enum {
   DETECT_DHCP = 1,
   DETECT_STATIC = 2,
-};
+} virHowDetect;
 
 typedef struct _virNWFilterIPAddrLearnReq virNWFilterIPAddrLearnReq;
 typedef virNWFilterIPAddrLearnReq *virNWFilterIPAddrLearnReqPtr;
@@ -46,7 +46,7 @@ struct _virNWFilterIPAddrLearnReq {
     char *filtername;
     virNWFilterHashTablePtr filterparams;
     virNWFilterDriverStatePtr driver;
-    enum howDetect howDetect;
+    virHowDetect howDetect;
 
     int status;
     pthread_t thread;
@@ -61,7 +61,7 @@ int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
                               const char *filtername,
                               virNWFilterHashTablePtr filterparams,
                               virNWFilterDriverStatePtr driver,
-                              enum howDetect howDetect);
+                              virHowDetect howDetect);
 
 virNWFilterIPAddrLearnReqPtr virNWFilterLookupLearnReq(int ifindex);
 int virNWFilterTerminateLearnReq(const char *ifname);
diff --git a/src/nwfilter/nwfilter_tech_driver.h b/src/nwfilter/nwfilter_tech_driver.h
index 7b6f56f..05d2561 100644
--- a/src/nwfilter/nwfilter_tech_driver.h
+++ b/src/nwfilter/nwfilter_tech_driver.h
@@ -70,13 +70,13 @@ typedef int (*virNWFilterRemoveBasicRules)(const char *ifname);
 
 typedef int (*virNWFilterDropAllRules)(const char *ifname);
 
-enum techDrvFlags {
+typedef enum {
     TECHDRV_FLAG_INITIALIZED = (1 << 0),
-};
+} techDrvFlags;
 
 struct _virNWFilterTechDriver {
     const char *name;
-    enum techDrvFlags flags;
+    techDrvFlags flags;
 
     virNWFilterTechDrvInit init;
     virNWFilterTechDrvShutdown shutdown;
-- 
1.7.10.4




More information about the libvir-list mailing list