[PATCH v3 1/2] Make virNetDevSetupControl() public.

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

 



This method is useful not only in virnetdev.c.
---
 src/libvirt_private.syms |  1 +
 src/util/virnetdev.c     | 15 +++++++++++++--
 src/util/virnetdev.h     | 15 ++++++++++++++-
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b93629f..bd5c010 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1530,6 +1530,7 @@ virNetDevSetMTUFromDevice;
 virNetDevSetName;
 virNetDevSetNamespace;
 virNetDevSetOnline;
+virNetDevSetupControl;
 virNetDevValidateConfig;
 
 
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 1a22126..f6b7e12 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -88,11 +88,22 @@ static int virNetDevSetupControlFull(const char *ifname,
 }
 
 
-static int virNetDevSetupControl(const char *ifname,
-                                 struct ifreq *ifr)
+int
+virNetDevSetupControl(const char *ifname,
+                      struct ifreq *ifr)
 {
     return virNetDevSetupControlFull(ifname, ifr, VIR_NETDEV_FAMILY, SOCK_DGRAM);
 }
+#else
+int
+virNetDevSetupControl(const char *ifname ATTRIBUTE_UNUSED,
+                      void *ifr ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS,
+                         _("Network device configuration is not supported "
+                           "on this platform"));
+    return -1;
+}
 #endif
 
 
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index bc0777c..fb5091d 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2007-2013 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,11 +23,24 @@
 #ifndef __VIR_NETDEV_H__
 # define __VIR_NETDEV_H__
 
+# include <config.h>
+# include <net/if.h>
+
 # include "virsocketaddr.h"
 # include "virnetlink.h"
 # include "virmacaddr.h"
 # include "virpci.h"
 
+# ifdef HAVE_STRUCT_IFREQ
+typedef struct ifreq virIfreq;
+# else
+struct virIfreq { };
+# endif
+
+int virNetDevSetupControl(const char *ifname,
+                          virIfreq *ifr)
+    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+
 int virNetDevExists(const char *brname)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
 
-- 
1.8.0

--
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]