[libvirt] [PATCH 2/9] util: make a couple virNetDevMacVlan*() functions public

Laine Stump laine at redhat.com
Wed Aug 28 01:46:32 UTC 2019


In virNetDevMacVLanOpen(), The "retries" arg has been removed and the
value hardcoded as 10, since previously the function was only called
from one place, so it was always 10.

Signed-off-by: Laine Stump <laine at redhat.com>
---
 src/util/virnetdevmacvlan.c | 12 +++++-------
 src/util/virnetdevmacvlan.h |  9 +++++++++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 79aa7ed5ac..9a9750f24a 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -374,19 +374,17 @@ int virNetDevMacVLanDelete(const char *ifname)
  * @ifname: Name of the macvtap interface
  * @tapfd: array of file descriptor return value for the new macvtap device
  * @tapfdSize: number of file descriptors in @tapfd
- * @retries : Number of retries in case udev for example may need to be
- *            waited for to create the tap chardev
  *
  * Open the macvtap's tap device, possibly multiple times if @tapfdSize > 1.
  *
  * Returns 0 on success, -1 otherwise.
  */
-static int
+int
 virNetDevMacVLanTapOpen(const char *ifname,
                         int *tapfd,
-                        size_t tapfdSize,
-                        int retries)
+                        size_t tapfdSize)
 {
+    int retries = 10;
     int ret = -1;
     int ifindex;
     size_t i = 0;
@@ -446,7 +444,7 @@ virNetDevMacVLanTapOpen(const char *ifname,
  *
  * Returns 0 on success, -1 in case of fatal error.
  */
-static int
+int
 virNetDevMacVLanTapSetup(int *tapfd, size_t tapfdSize, bool vnet_hdr)
 {
     unsigned int features;
@@ -1040,7 +1038,7 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested,
     }
 
     if (flags & VIR_NETDEV_MACVLAN_CREATE_WITH_TAP) {
-        if (virNetDevMacVLanTapOpen(ifnameCreated, tapfd, tapfdSize, 10) < 0)
+        if (virNetDevMacVLanTapOpen(ifnameCreated, tapfd, tapfdSize) < 0)
             goto disassociate_exit;
 
         if (virNetDevMacVLanTapSetup(tapfd, tapfdSize, vnet_hdr) < 0)
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index 8ac7643e49..24b17b4bd0 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -88,6 +88,15 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
     ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(6)
     ATTRIBUTE_NONNULL(8) ATTRIBUTE_NONNULL(10) ATTRIBUTE_RETURN_CHECK;
 
+int virNetDevMacVLanTapOpen(const char *ifname,
+                            int *tapfd,
+                            size_t tapfdSize)
+   ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+   ATTRIBUTE_RETURN_CHECK;
+
+int virNetDevMacVLanTapSetup(int *tapfd, size_t tapfdSize, bool vnet_hdr)
+   ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+
 int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
                                            const virMacAddr *macaddress,
                                            const char *linkdev,
-- 
2.21.0




More information about the libvir-list mailing list