[libvirt] [PATCH 1/5] Move struct elem out of virNetDevGetFeatures

Ján Tomko jtomko at redhat.com
Mon Jun 6 07:39:24 UTC 2016


Rename struct elem to ethtool_to_virnetdev_feature and move it
out of the function to allow reusing it.
---
 src/util/virnetdev.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 7db4497..354e6f7 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3239,6 +3239,11 @@ virNetDevSendEthtoolIoctl(const char *ifname, void *cmd)
     return ret;
 }
 
+struct ethtool_to_virnetdev_feature {
+    const int cmd;
+    const virNetDevFeature feat;
+};
+
 
 /**
 * virNetDevFeatureAvailable
@@ -3303,12 +3308,8 @@ virNetDevGetFeatures(const char *ifname,
 # if HAVE_DECL_ETHTOOL_GFEATURES
     struct ethtool_gfeatures *g_cmd;
 # endif
-    struct elem{
-        const int cmd;
-        const virNetDevFeature feat;
-    };
     /* legacy ethtool getters */
-    struct elem cmds[] = {
+    struct ethtool_to_virnetdev_feature cmds[] = {
         {ETHTOOL_GRXCSUM, VIR_NET_DEV_FEAT_GRXCSUM},
         {ETHTOOL_GTXCSUM, VIR_NET_DEV_FEAT_GTXCSUM},
         {ETHTOOL_GSG, VIR_NET_DEV_FEAT_GSG},
@@ -3339,7 +3340,7 @@ virNetDevGetFeatures(const char *ifname,
 # if HAVE_DECL_ETHTOOL_GFLAGS
     size_t j = -1;
     /* ethtool masks */
-    struct elem flags[] = {
+    struct ethtool_to_virnetdev_feature flags[] = {
 #  if HAVE_DECL_ETH_FLAG_LRO
         {ETH_FLAG_LRO, VIR_NET_DEV_FEAT_LRO},
 #  endif
-- 
2.7.3




More information about the libvir-list mailing list