In "src/conf/" there are many enumeration (enum) declarations. Similar to the
recent cleanup to "src/util" directory, it's better to use 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 are
related to network filter (nwfilter_conf) enums.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/nwfilter_conf.c | 8 ++++----
src/conf/nwfilter_conf.h | 44 ++++++++++++++++++++++----------------------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index b9f6d51..c675967 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -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) \
@@ -1799,7 +1799,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
char *prop;
bool found = false;
enum attrDatatype datatype, att_datatypes;
- enum virNWFilterEntryItemFlags *flags, match_flag = 0, flags_set = 0;
+ virNWFilterEntryItemFlags *flags, match_flag = 0, flags_set = 0;
nwItemDesc *item;
int int_val;
unsigned int uint_val;
@@ -2511,7 +2511,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;
@@ -3287,7 +3287,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..79116b1 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
@@ -114,7 +114,7 @@ enum attrDatatype {
typedef struct _nwItemDesc nwItemDesc;
typedef nwItemDesc *nwItemDescPtr;
struct _nwItemDesc {
- enum virNWFilterEntryItemFlags flags;
+ virNWFilterEntryItemFlags flags;
virNWFilterVarAccessPtr varAccess;
enum attrDatatype datatype;
union {
@@ -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_.:-"
@@ -577,16 +577,16 @@ struct _virNWFilterDriverState {
};
-enum UpdateStep {
+typedef enum {
STEP_APPLY_NEW,
STEP_TEAR_NEW,
STEP_TEAR_OLD,
STEP_APPLY_CURRENT,
-};
+} UpdateStep;
struct domUpdateCBStruct {
void *opaque;
- enum UpdateStep step;
+ UpdateStep step;
virHashTablePtr skipInterfaces;
};
--
1.7.10.4