[PATCH 2/5] conf: changing all the "enum" network and interface 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. 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 Network (network_conf.* and interface_conf.*) enum structures.

Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
---
 src/conf/interface_conf.c   |    2 +-
 src/conf/interface_conf.h   |   26 +++++++++++++-------------
 src/conf/network_conf.c     |    2 +-
 src/conf/network_conf.h     |   14 +++++++-------
 src/network/bridge_driver.c |    4 ++--
 5 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index b1b56c8..1f67446 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -1030,7 +1030,7 @@ virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDef *def)
 
 static int
 virInterfaceStartmodeDefFormat(virBufferPtr buf,
-                               enum virInterfaceStartMode startmode)
+                               virInterfaceStartMode startmode)
 {
     const char *mode;
     switch (startmode) {
diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h
index 2c759bc..b3c92b2 100644
--- a/src/conf/interface_conf.h
+++ b/src/conf/interface_conf.h
@@ -34,27 +34,27 @@
 
 /* There is currently 3 types of interfaces */
 
-enum virInterfaceType {
+typedef enum {
     VIR_INTERFACE_TYPE_ETHERNET,  /* simple ethernet */
     VIR_INTERFACE_TYPE_BRIDGE,    /* bridge interface */
     VIR_INTERFACE_TYPE_BOND,      /* bonding interface */
     VIR_INTERFACE_TYPE_VLAN,      /* vlan description */
 
     VIR_INTERFACE_TYPE_LAST,
-};
+} virInterfaceType;
 
 VIR_ENUM_DECL(virInterface)
 
 /* types of start mode */
 
-enum virInterfaceStartMode {
+typedef enum {
     VIR_INTERFACE_START_UNSPECIFIED = 0, /* not given in config */
     VIR_INTERFACE_START_NONE,     /* specified as not defined */
     VIR_INTERFACE_START_ONBOOT,   /* startup at boot */
     VIR_INTERFACE_START_HOTPLUG,  /* on hotplug */
-};
+} virInterfaceStartMode;
 
-enum virInterfaceBondMode {
+typedef enum {
     VIR_INTERFACE_BOND_NONE = 0,
     VIR_INTERFACE_BOND_BALRR,     /* balance-rr */
     VIR_INTERFACE_BOND_ABACKUP,   /* active backup */
@@ -63,26 +63,26 @@ enum virInterfaceBondMode {
     VIR_INTERFACE_BOND_8023AD,    /* 802.3ad */
     VIR_INTERFACE_BOND_BALTLB,    /* balance-tlb */
     VIR_INTERFACE_BOND_BALALB,    /* balance-alb */
-};
+} virInterfaceBondMode;
 
-enum virInterfaceBondMonit {
+typedef enum {
     VIR_INTERFACE_BOND_MONIT_NONE = 0,
     VIR_INTERFACE_BOND_MONIT_MII, /* mii based monitoring */
     VIR_INTERFACE_BOND_MONIT_ARP, /* arp based monitoring */
-};
+} virInterfaceBondMonit;
 
-enum virInterfaceBondMiiCarrier {
+typedef enum {
     VIR_INTERFACE_BOND_MII_NONE = 0,
     VIR_INTERFACE_BOND_MII_IOCTL, /* mii/ethtool ioctl */
     VIR_INTERFACE_BOND_MII_NETIF, /* netif_carrier_ok */
-};
+} virInterfaceBondMiiCarrier;
 
-enum virInterfaceBondArpValid {
+typedef enum {
     VIR_INTERFACE_BOND_ARP_NONE = 0,
     VIR_INTERFACE_BOND_ARP_ACTIVE, /* validate active */
     VIR_INTERFACE_BOND_ARP_BACKUP, /* validate backup */
     VIR_INTERFACE_BOND_ARP_ALL,    /* validate all */
-};
+} virInterfaceBondArpValid;
 
 struct _virInterfaceDef; /* forward declaration required for bridge/bond */
 
@@ -147,7 +147,7 @@ struct _virInterfaceDef {
     unsigned int mtu;        /* maximum transmit size in byte */
     char *mac;               /* MAC address */
 
-    enum virInterfaceStartMode startmode; /* how it is started */
+    virInterfaceStartMode startmode; /* how it is started */
 
     union {
         virInterfaceBridgeDef bridge;
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 41465c2..30b9916 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -77,7 +77,7 @@ VIR_ENUM_IMPL(virNetworkTaint, VIR_NETWORK_TAINT_LAST,
 
 bool
 virNetworkObjTaint(virNetworkObjPtr obj,
-                   enum virNetworkTaintFlags taint)
+                   virNetworkTaintFlags taint)
 {
     unsigned int flag = (1 << taint);
 
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 90da16f..c4e9d92 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -40,7 +40,7 @@
 # include "device_conf.h"
 # include "virbitmap.h"
 
-enum virNetworkForwardType {
+typedef enum {
     VIR_NETWORK_FORWARD_NONE   = 0,
     VIR_NETWORK_FORWARD_NAT,
     VIR_NETWORK_FORWARD_ROUTE,
@@ -51,16 +51,16 @@ enum virNetworkForwardType {
     VIR_NETWORK_FORWARD_HOSTDEV,
 
     VIR_NETWORK_FORWARD_LAST,
-};
+} virNetworkForwardType;
 
-enum virNetworkForwardHostdevDeviceType {
+typedef enum {
     VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NONE = 0,
     VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI,
     VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV,
     /* USB Device to be added here when supported */
 
     VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_LAST,
-};
+} virNetworkForwardHostdevDeviceType;
 
 /* The backend driver used for devices from the pool. Currently used
  * only for PCI devices (vfio vs. kvm), but could be used for other
@@ -298,7 +298,7 @@ struct _virNetworkObjList {
     virNetworkObjPtr *objs;
 };
 
-enum virNetworkTaintFlags {
+typedef enum {
     VIR_NETWORK_TAINT_HOOK,                 /* Hook script was executed over
                                                network. We can't guarantee
                                                connectivity or other settings
@@ -307,7 +307,7 @@ enum virNetworkTaintFlags {
                                              */
 
     VIR_NETWORK_TAINT_LAST
-};
+} virNetworkTaintFlags;
 
 static inline int
 virNetworkObjIsActive(const virNetworkObj *net)
@@ -316,7 +316,7 @@ virNetworkObjIsActive(const virNetworkObj *net)
 }
 
 bool virNetworkObjTaint(virNetworkObjPtr obj,
-                        enum virNetworkTaintFlags taint);
+                        virNetworkTaintFlags taint);
 
 virNetworkObjPtr virNetworkFindByUUID(virNetworkObjListPtr nets,
                                       const unsigned char *uuid);
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 4e8375d..ee8e8a0 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -116,7 +116,7 @@ static int networkUnplugBandwidth(virNetworkObjPtr net,
                                   virDomainNetDefPtr iface);
 
 static void networkNetworkObjTaint(virNetworkObjPtr net,
-                                   enum virNetworkTaintFlags taint);
+                                   virNetworkTaintFlags taint);
 
 static virNetworkDriverStatePtr driverState = NULL;
 
@@ -4532,7 +4532,7 @@ networkUnplugBandwidth(virNetworkObjPtr net,
 
 static void
 networkNetworkObjTaint(virNetworkObjPtr net,
-                       enum virNetworkTaintFlags taint)
+                       virNetworkTaintFlags taint)
 {
     if (virNetworkObjTaint(net, taint)) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
-- 
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]