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

[libvirt] [PATCH 23/33] Rename interface MAC address replacement APIs



From: "Daniel P. Berrange" <berrange redhat com>

Rename ifaceReplaceMacAddress to virNetDevReplaceMacAddress
and ifaceRestoreMacAddress to virNetDevRestoreMacAddress.

* util/interface.c, util/interface.h, util/virnetdevmacvlan.c:
  Rename APIs
---
 src/libvirt_private.syms    |    4 ++--
 src/util/interface.c        |   14 +++++++-------
 src/util/interface.h        |   15 +++++++++------
 src/util/virnetdevmacvlan.c |    5 ++---
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 27a9fdf..9706efc 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -586,8 +586,8 @@ ifaceIsVirtualFunction;
 virNetDevMacVLanCreate;
 virNetDevMacVLanDelete;
 ifaceMacvtapLinkDump;
-ifaceReplaceMacAddress;
-ifaceRestoreMacAddress;
+virNetDevReplaceMacAddress;
+virNetDevRestoreMacAddress;
 
 
 # interface_conf.h
diff --git a/src/util/interface.c b/src/util/interface.c
index e757c6f..df2aa88 100644
--- a/src/util/interface.c
+++ b/src/util/interface.c
@@ -554,7 +554,7 @@ ifaceGetNthParent(int ifindex ATTRIBUTE_UNUSED,
 #endif
 
 /**
- * ifaceReplaceMacAddress:
+ * virNetDevReplaceMacAddress:
  * @macaddress: new MAC address for interface
  * @linkdev: name of interface
  * @stateDir: directory to store old MAC address
@@ -563,9 +563,9 @@ ifaceGetNthParent(int ifindex ATTRIBUTE_UNUSED,
  *
  */
 int
-ifaceReplaceMacAddress(const unsigned char *macaddress,
-                       const char *linkdev,
-                       const char *stateDir)
+virNetDevReplaceMacAddress(const char *linkdev,
+                           const unsigned char *macaddress,
+                           const char *stateDir)
 {
     unsigned char oldmac[6];
     char *path = NULL;
@@ -595,7 +595,7 @@ ifaceReplaceMacAddress(const unsigned char *macaddress,
 }
 
 /**
- * ifaceRestoreMacAddress:
+ * virNetDevRestoreMacAddress:
  * @linkdev: name of interface
  * @stateDir: directory containing old MAC address
  *
@@ -603,8 +603,8 @@ ifaceReplaceMacAddress(const unsigned char *macaddress,
  *
  */
 int
-ifaceRestoreMacAddress(const char *linkdev,
-                       const char *stateDir)
+virNetDevRestoreMacAddress(const char *linkdev,
+                           const char *stateDir)
 {
     int rc;
     char *oldmacname = NULL;
diff --git a/src/util/interface.h b/src/util/interface.h
index 1dd8f35..6a4631c 100644
--- a/src/util/interface.h
+++ b/src/util/interface.h
@@ -49,12 +49,15 @@ int ifaceGetNthParent(int ifindex, const char *ifname, unsigned int nthParent,
     ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5)
     ATTRIBUTE_NONNULL(6);
 
-int ifaceReplaceMacAddress(const unsigned char *macaddress,
-                           const char *linkdev,
-                           const char *stateDir);
-
-int ifaceRestoreMacAddress(const char *linkdev,
-                           const char *stateDir);
+int virNetDevReplaceMacAddress(const char *linkdev,
+                               const unsigned char *macaddress,
+                               const char *stateDir)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+    ATTRIBUTE_RETURN_CHECK;
+
+int virNetDevRestoreMacAddress(const char *linkdev,
+                               const char *stateDir)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
 
 int ifaceIsVirtualFunction(const char *ifname);
 
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index a4bad18..6e09440 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -497,9 +497,8 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
      * emulate their switch in firmware.
      */
     if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
-        if (ifaceReplaceMacAddress(macaddress, linkdev, stateDir) < 0) {
+        if (virNetDevReplaceMacAddress(linkdev, macaddress, stateDir) < 0)
             return -1;
-        }
     }
 
     if (tgifname) {
@@ -604,7 +603,7 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
 {
     int ret = 0;
     if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
-        ifaceRestoreMacAddress(linkdev, stateDir);
+        ignore_value(virNetDevRestoreMacAddress(linkdev, stateDir));
     }
 
     if (ifname) {
-- 
1.7.6.4


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