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

[libvirt] [PATCH v2 2/5] Make virNetDevSetupControl() public.



It's useful not only inside virnetdev.
---
 src/libvirt_private.syms | 1 +
 src/util/virnetdev.c     | 7 ++++---
 src/util/virnetdev.h     | 6 ++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fc23adc..84eeebc 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1515,6 +1515,7 @@ virNetDevSetMTUFromDevice;
 virNetDevSetName;
 virNetDevSetNamespace;
 virNetDevSetOnline;
+virNetDevSetupControl;
 virNetDevValidateConfig;
 
 
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index dae267b..5100467 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -44,7 +44,7 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
-#if defined(HAVE_STRUCT_IFREQ) || defined(__FreeBSD__)
+#if (defined(HAVE_STRUCT_IFREQ) || defined(__FreeBSD__))
 static int virNetDevSetupControlFull(const char *ifname,
                                      struct ifreq *ifr,
                                      int domain,
@@ -78,8 +78,8 @@ static int virNetDevSetupControlFull(const char *ifname,
 }
 
 
-static int virNetDevSetupControl(const char *ifname,
-                                 struct ifreq *ifr)
+int virNetDevSetupControl(const char *ifname,
+                          struct ifreq *ifr)
 {
 #if defined(__FreeBSD__)
     return virNetDevSetupControlFull(ifname, ifr, AF_LOCAL, SOCK_DGRAM);
@@ -87,6 +87,7 @@ static int virNetDevSetupControl(const char *ifname,
     return virNetDevSetupControlFull(ifname, ifr, AF_PACKET, SOCK_DGRAM);
 #endif
 }
+#else /* ! (defined(HAVE_STRUCT_IFREQ) || defined(__FreeBSD__)) */
 #endif
 
 #if defined(SIOCGIFFLAGS) && (defined(HAVE_STRUCT_IFREQ) || defined(__FreeBSD__))
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index d588e89..63871cc 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -28,6 +28,12 @@
 # include "virmacaddr.h"
 # include "virpci.h"
 
+# include <net/if.h>
+
+int virNetDevSetupControl(const char *ifname,
+                          struct ifreq *ifr)
+    ATTRIBUTE_RETURN_CHECK;
+
 int virNetDevExists(const char *brname)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
 
-- 
1.8.0


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