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
reltaed to Network (node_device_conf.h and nwfilter_params.*) enums.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/node_device_conf.h | 24 ++++++++++++------------
src/conf/nwfilter_params.c | 2 +-
src/conf/nwfilter_params.h | 14 +++++++-------
3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index 9b5d172..50e6805 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -35,7 +35,7 @@
# define CREATE_DEVICE 1
# define EXISTING_DEVICE 0
-enum virNodeDevCapType {
+typedef enum {
/* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */
VIR_NODE_DEV_CAP_SYSTEM, /* System capability */
VIR_NODE_DEV_CAP_PCI_DEV, /* PCI device */
@@ -51,38 +51,38 @@ enum virNodeDevCapType {
VIR_NODE_DEV_CAP_SCSI_GENERIC, /* SCSI generic device */
VIR_NODE_DEV_CAP_LAST
-};
+} virNodeDevCapType;
-enum virNodeDevNetCapType {
+typedef enum {
/* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */
VIR_NODE_DEV_CAP_NET_80203, /* 802.03 network device */
VIR_NODE_DEV_CAP_NET_80211, /* 802.11 network device */
VIR_NODE_DEV_CAP_NET_LAST
-};
+} virNodeDevNetCapType;
VIR_ENUM_DECL(virNodeDevCap)
VIR_ENUM_DECL(virNodeDevNetCap)
-enum virNodeDevStorageCapFlags {
+typedef enum {
VIR_NODE_DEV_CAP_STORAGE_REMOVABLE = (1 << 0),
VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE = (1 << 1),
VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE = (1 << 2),
-};
+} virNodeDevStorageCapFlags;
-enum virNodeDevSCSIHostCapFlags {
+typedef enum {
VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST = (1 << 0),
VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS = (1 << 1),
-};
+} virNodeDevSCSIHostCapFlags;
-enum virNodeDevPCICapFlags {
+typedef enum {
VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION = (1 << 0),
VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION = (1 << 1),
-};
+} virNodeDevPCICapFlags;
typedef struct _virNodeDevCapsDef virNodeDevCapsDef;
typedef virNodeDevCapsDef *virNodeDevCapsDefPtr;
struct _virNodeDevCapsDef {
- enum virNodeDevCapType type;
+ virNodeDevCapType type;
union _virNodeDevCapData {
struct {
char *product_name;
@@ -135,7 +135,7 @@ struct _virNodeDevCapsDef {
char *address;
unsigned int address_len;
char *ifname;
- enum virNodeDevNetCapType subtype; /* LAST -> no subtype */
+ virNodeDevNetCapType subtype; /* LAST -> no subtype */
} net;
struct {
unsigned int host;
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index ac4d4a8..a12e645 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -1061,7 +1061,7 @@ virNWFilterVarAccessGetVarName(const virNWFilterVarAccess *vap)
return vap->varName;
}
-enum virNWFilterVarAccessType
+virNWFilterVarAccessType
virNWFilterVarAccessGetType(const virNWFilterVarAccess *vap)
{
return vap->accessType;
diff --git a/src/conf/nwfilter_params.h b/src/conf/nwfilter_params.h
index 08e448f..98610a7 100644
--- a/src/conf/nwfilter_params.h
+++ b/src/conf/nwfilter_params.h
@@ -27,17 +27,17 @@
# include "virbuffer.h"
# include "virmacaddr.h"
-enum virNWFilterVarValueType {
+typedef enum {
NWFILTER_VALUE_TYPE_SIMPLE,
NWFILTER_VALUE_TYPE_ARRAY,
NWFILTER_VALUE_TYPE_LAST
-};
+} virNWFilterVarValueType;
typedef struct _virNWFilterVarValue virNWFilterVarValue;
typedef virNWFilterVarValue *virNWFilterVarValuePtr;
struct _virNWFilterVarValue {
- enum virNWFilterVarValueType valType;
+ virNWFilterVarValueType valType;
union {
struct {
char *value;
@@ -98,17 +98,17 @@ bool virNWFilterHashTableEqual(virNWFilterHashTablePtr a,
# define NWFILTER_VARNAME_CTRL_IP_LEARNING "CTRL_IP_LEARNING"
# define NWFILTER_VARNAME_DHCPSERVER "DHCPSERVER"
-enum virNWFilterVarAccessType {
+typedef enum {
VIR_NWFILTER_VAR_ACCESS_ELEMENT = 0,
VIR_NWFILTER_VAR_ACCESS_ITERATOR = 1,
VIR_NWFILTER_VAR_ACCESS_LAST,
-};
+} virNWFilterVarAccessType;
typedef struct _virNWFilterVarAccess virNWFilterVarAccess;
typedef virNWFilterVarAccess *virNWFilterVarAccessPtr;
struct _virNWFilterVarAccess {
- enum virNWFilterVarAccessType accessType;
+ virNWFilterVarAccessType accessType;
union {
struct {
unsigned int index;
@@ -128,7 +128,7 @@ virNWFilterVarAccessPtr virNWFilterVarAccessParse(const char
*varAccess);
void virNWFilterVarAccessPrint(virNWFilterVarAccessPtr vap,
virBufferPtr buf);
const char *virNWFilterVarAccessGetVarName(const virNWFilterVarAccess *vap);
-enum virNWFilterVarAccessType virNWFilterVarAccessGetType(
+virNWFilterVarAccessType virNWFilterVarAccessGetType(
const virNWFilterVarAccess *vap);
unsigned int virNWFilterVarAccessGetIterId(const virNWFilterVarAccess *vap);
unsigned int virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap);
--
1.7.10.4