[PATCH 4/5] conf: changing all the "enum" network filter structures into typedef's in "src/conf/" directory.

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

 



In "src/conf/" there are many enumeration (enum) structures like "src/util" directory, for example. Sometimes, it's better using a typedef for variable types, function types and other usages. Other enumeration and folders will be changed to typedef's in the future.
Most of the files changed in this commit included more Network Filter (nwfilter_conf.*) enum structures.

Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
---
 src/conf/nwfilter_conf.c |   36 ++++++++++++++++++------------------
 src/conf/nwfilter_conf.h |   44 ++++++++++++++++++++++----------------------
 2 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index b332f0f..41b821d 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -448,7 +448,7 @@ union data {
     unsigned int ui;
 };
 
-typedef bool (*valueValidator)(enum attrDatatype datatype, union data *valptr,
+typedef bool (*valueValidator)(attrDatatype datatype, union data *valptr,
                                virNWFilterRuleDefPtr nwf,
                                nwItemDesc *item);
 typedef bool (*valueFormatter)(virBufferPtr buf,
@@ -459,7 +459,7 @@ typedef struct _virXMLAttr2Struct virXMLAttr2Struct;
 struct _virXMLAttr2Struct
 {
     const char *name;           /* attribute name */
-    enum attrDatatype datatype;
+    attrDatatype datatype;
     int dataIdx;                /* offset of the hasXYZ boolean */
     valueValidator validator;   /* beyond-standard checkers */
     valueFormatter formatter;   /* beyond-standard formatter */
@@ -478,7 +478,7 @@ static const struct int_map macProtoMap[] = {
 
 
 static bool
-checkMacProtocolID(enum attrDatatype datatype, union data *value,
+checkMacProtocolID(attrDatatype datatype, union data *value,
                    virNWFilterRuleDefPtr nwf ATTRIBUTE_UNUSED,
                    nwItemDesc *item ATTRIBUTE_UNUSED)
 {
@@ -528,7 +528,7 @@ macProtocolIDFormatter(virBufferPtr buf,
 
 
 static bool
-checkVlanVlanID(enum attrDatatype datatype, union data *value,
+checkVlanVlanID(attrDatatype datatype, union data *value,
                 virNWFilterRuleDefPtr nwf,
                 nwItemDesc *item ATTRIBUTE_UNUSED)
 {
@@ -549,7 +549,7 @@ checkVlanVlanID(enum attrDatatype datatype, union data *value,
 }
 
 static bool
-checkVlanProtocolID(enum attrDatatype datatype, union data *value,
+checkVlanProtocolID(attrDatatype datatype, union data *value,
                     virNWFilterRuleDefPtr nwf,
                     nwItemDesc *item ATTRIBUTE_UNUSED)
 {
@@ -626,7 +626,7 @@ checkValidMask(unsigned char *data, int len)
 
 
 static bool
-checkMACMask(enum attrDatatype datatype ATTRIBUTE_UNUSED,
+checkMACMask(attrDatatype datatype ATTRIBUTE_UNUSED,
              union data *macMask,
              virNWFilterRuleDefPtr nwf ATTRIBUTE_UNUSED,
              nwItemDesc *item ATTRIBUTE_UNUSED)
@@ -653,7 +653,7 @@ static const struct int_map arpOpcodeMap[] = {
 
 
 static bool
-arpOpcodeValidator(enum attrDatatype datatype,
+arpOpcodeValidator(attrDatatype datatype,
                    union data *value,
                    virNWFilterRuleDefPtr nwf,
                    nwItemDesc *item ATTRIBUTE_UNUSED)
@@ -715,7 +715,7 @@ static const struct int_map ipProtoMap[] = {
 
 
 static bool
-checkIPProtocolID(enum attrDatatype datatype,
+checkIPProtocolID(attrDatatype datatype,
                   union data *value,
                   virNWFilterRuleDefPtr nwf,
                   nwItemDesc *item ATTRIBUTE_UNUSED)
@@ -763,7 +763,7 @@ formatIPProtocolID(virBufferPtr buf,
 
 
 static bool
-dscpValidator(enum attrDatatype datatype, union data *val,
+dscpValidator(attrDatatype datatype, union data *val,
               virNWFilterRuleDefPtr nwf,
               nwItemDesc *item ATTRIBUTE_UNUSED)
 {
@@ -875,7 +875,7 @@ virNWFilterPrintStateMatchFlags(virBufferPtr buf, const char *prefix,
 
 
 static bool
-stateValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
+stateValidator(attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
                virNWFilterRuleDefPtr nwf,
                nwItemDesc *item)
 {
@@ -920,7 +920,7 @@ static const struct int_map tcpFlags[] = {
 
 
 static bool
-tcpFlagsValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
+tcpFlagsValidator(attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
                   virNWFilterRuleDefPtr nwf ATTRIBUTE_UNUSED,
                   nwItemDesc *item)
 {
@@ -988,7 +988,7 @@ tcpFlagsFormatter(virBufferPtr buf,
 }
 
 static bool
-ipsetValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
+ipsetValidator(attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
                virNWFilterRuleDefPtr nwf ATTRIBUTE_UNUSED,
                nwItemDesc *item)
 {
@@ -1025,7 +1025,7 @@ ipsetFormatter(virBufferPtr buf,
 }
 
 static bool
-ipsetFlagsValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
+ipsetFlagsValidator(attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
                     virNWFilterRuleDefPtr nwf ATTRIBUTE_UNUSED, nwItemDesc *item)
 {
     const char *errmsg = NULL;
@@ -1753,7 +1753,7 @@ typedef struct _virAttributes virAttributes;
 struct _virAttributes {
     const char *id;
     const virXMLAttr2Struct *att;
-    enum virNWFilterRuleProtocolType prtclType;
+    virNWFilterRuleProtocolType prtclType;
 };
 
 #define PROTOCOL_ENTRY(ID, ATT, PRTCLTYPE) \
@@ -1798,8 +1798,8 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
     int idx = 0;
     char *prop;
     bool found = false;
-    enum attrDatatype datatype, att_datatypes;
-    enum virNWFilterEntryItemFlags *flags, match_flag = 0, flags_set = 0;
+    attrDatatype datatype, att_datatypes;
+    virNWFilterEntryItemFlags *flags, match_flag = 0, flags_set = 0;
     nwItemDesc *item;
     int int_val;
     unsigned int uint_val;
@@ -2449,7 +2449,7 @@ virNWFilterIsValidChainName(const char *chainname)
 static const char *
 virNWFilterIsAllowedChain(const char *chainname)
 {
-    enum virNWFilterChainSuffixType i;
+    virNWFilterChainSuffixType i;
     const char *name;
     char *msg;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -3225,7 +3225,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
         VIR_WARNINGS_NO_CAST_ALIGN
         item = (nwItemDesc *)((char *)def + att[i].dataIdx);
         VIR_WARNINGS_RESET
-        enum virNWFilterEntryItemFlags flags = item->flags;
+        virNWFilterEntryItemFlags flags = item->flags;
         if ((flags & NWFILTER_ENTRY_ITEM_FLAG_EXISTS)) {
             if (!typeShown) {
                 virBufferAsprintf(buf, "<%s", type);
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 3c7985c..a14b4a1 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -69,11 +69,11 @@
 # define MAX_CHAIN_SUFFIX_SIZE	12
 
 
-enum virNWFilterEntryItemFlags {
+typedef enum {
     NWFILTER_ENTRY_ITEM_FLAG_EXISTS   = 1 << 0,
     NWFILTER_ENTRY_ITEM_FLAG_IS_NEG   = 1 << 1,
     NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR  = 1 << 2,
-};
+} virNWFilterEntryItemFlags;
 
 
 # define MAX_COMMENT_LENGTH  256
@@ -86,7 +86,7 @@ enum virNWFilterEntryItemFlags {
   (((data)->flags) & NWFILTER_ENTRY_ITEM_FLAG_IS_NEG)
 
 /* datatypes appearing in rule attributes */
-enum attrDatatype {
+typedef enum {
     DATATYPE_UINT16           = (1 << 0),
     DATATYPE_UINT8            = (1 << 1),
     DATATYPE_UINT16_HEX       = (1 << 2),
@@ -106,7 +106,7 @@ enum attrDatatype {
     DATATYPE_IPSETFLAGS       = (1 << 16),
 
     DATATYPE_LAST             = (1 << 17),
-};
+} attrDatatype;
 
 # define NWFILTER_MAC_BGA "01:80:c2:00:00:00"
 
@@ -114,9 +114,9 @@ enum attrDatatype {
 typedef struct _nwItemDesc nwItemDesc;
 typedef nwItemDesc *nwItemDescPtr;
 struct _nwItemDesc {
-    enum virNWFilterEntryItemFlags flags;
+    virNWFilterEntryItemFlags flags;
     virNWFilterVarAccessPtr varAccess;
-    enum attrDatatype datatype;
+    attrDatatype datatype;
     union {
         virMacAddr macaddr;
         virSocketAddr ipaddr;
@@ -348,7 +348,7 @@ struct _udpliteHdrFilterDef {
 };
 
 
-enum virNWFilterRuleActionType {
+typedef enum {
     VIR_NWFILTER_RULE_ACTION_DROP = 0,
     VIR_NWFILTER_RULE_ACTION_ACCEPT,
     VIR_NWFILTER_RULE_ACTION_REJECT,
@@ -356,29 +356,29 @@ enum virNWFilterRuleActionType {
     VIR_NWFILTER_RULE_ACTION_CONTINUE,
 
     VIR_NWFILTER_RULE_ACTION_LAST,
-};
+} virNWFilterRuleActionType;
 
-enum virNWFilterRuleDirectionType {
+typedef enum {
     VIR_NWFILTER_RULE_DIRECTION_IN = 0,
     VIR_NWFILTER_RULE_DIRECTION_OUT,
     VIR_NWFILTER_RULE_DIRECTION_INOUT,
 
     VIR_NWFILTER_RULE_DIRECTION_LAST,
-};
+} virNWFilterRuleDirectionType;
 
-enum virNWFilterChainPolicyType {
+typedef enum {
     VIR_NWFILTER_CHAIN_POLICY_ACCEPT = 0,
     VIR_NWFILTER_CHAIN_POLICY_DROP,
 
     VIR_NWFILTER_CHAIN_POLICY_LAST,
-};
+} virNWFilterChainPolicyType;
 
 
 /*
  * If adding protocols be sure to update the
  * virNWFilterRuleIsProtocolXXXX function impls
  */
-enum virNWFilterRuleProtocolType {
+typedef enum {
     /* Ethernet layer protocols */
     VIR_NWFILTER_RULE_PROTOCOL_NONE = 0,
     VIR_NWFILTER_RULE_PROTOCOL_MAC,
@@ -411,15 +411,15 @@ enum virNWFilterRuleProtocolType {
     VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6,
 
     VIR_NWFILTER_RULE_PROTOCOL_LAST
-};
+} virNWFilterRuleProtocolType;
 
-enum virNWFilterEbtablesTableType {
+typedef enum {
     VIR_NWFILTER_EBTABLES_TABLE_FILTER = 0,
     VIR_NWFILTER_EBTABLES_TABLE_NAT,
     VIR_NWFILTER_EBTABLES_TABLE_BROUTE,
 
     VIR_NWFILTER_EBTABLES_TABLE_LAST,
-};
+} virNWFilterEbtablesTableType;
 
 
 # define MIN_RULE_PRIORITY  -1000
@@ -437,14 +437,14 @@ enum virNWFilterEbtablesTableType {
 # define NWFILTER_ARP_FILTER_PRI  -500
 # define NWFILTER_RARP_FILTER_PRI -400
 
-enum virNWFilterRuleFlags {
+typedef enum {
     RULE_FLAG_NO_STATEMATCH      = (1 << 0),
     RULE_FLAG_STATE_NEW          = (1 << 1),
     RULE_FLAG_STATE_ESTABLISHED  = (1 << 2),
     RULE_FLAG_STATE_RELATED      = (1 << 3),
     RULE_FLAG_STATE_INVALID      = (1 << 4),
     RULE_FLAG_STATE_NONE         = (1 << 5),
-};
+} virNWFilterRuleFlags;
 
 
 # define IPTABLES_STATE_FLAGS \
@@ -463,10 +463,10 @@ typedef struct _virNWFilterRuleDef  virNWFilterRuleDef;
 typedef virNWFilterRuleDef *virNWFilterRuleDefPtr;
 struct _virNWFilterRuleDef {
     virNWFilterRulePriority priority;
-    enum virNWFilterRuleFlags flags;
+    virNWFilterRuleFlags flags;
     int action; /*enum virNWFilterRuleActionType*/
     int tt; /*enum virNWFilterRuleDirectionType*/
-    enum virNWFilterRuleProtocolType prtclType;
+    virNWFilterRuleProtocolType prtclType;
     union {
         ethHdrFilterDef  ethHdrFilter;
         vlanHdrFilterDef vlanHdrFilter;
@@ -508,7 +508,7 @@ struct _virNWFilterEntry {
     virNWFilterIncludeDef *include;
 };
 
-enum virNWFilterChainSuffixType {
+typedef enum {
     VIR_NWFILTER_CHAINSUFFIX_ROOT = 0,
     VIR_NWFILTER_CHAINSUFFIX_MAC,
     VIR_NWFILTER_CHAINSUFFIX_VLAN,
@@ -519,7 +519,7 @@ enum virNWFilterChainSuffixType {
     VIR_NWFILTER_CHAINSUFFIX_IPv6,
 
     VIR_NWFILTER_CHAINSUFFIX_LAST,
-};
+} virNWFilterChainSuffixType;
 
 # define VALID_CHAINNAME \
   "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:-"
-- 
1.7.10.4

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