From 3d21ff72e0e37ebfb3305c93c003ab0ec36b98e4 Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Mon, 26 Aug 2019 01:51:40 -0400 Subject: [PATCH] util: make a couple virNetDevMacVlan*() functions public MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Daniel P. Berrangé --- src/libvirt_private.syms | 2 ++ src/util/virnetdevmacvlan.c | 12 +++++------- src/util/virnetdevmacvlan.h | 9 +++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 7adb07aac0..0ee2014beb 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2529,6 +2529,8 @@ virNetDevMacVLanModeTypeFromString; virNetDevMacVLanReleaseName; virNetDevMacVLanReserveName; virNetDevMacVLanRestartWithVPortProfile; +virNetDevMacVLanTapOpen; +virNetDevMacVLanTapSetup; virNetDevMacVLanVPortProfileRegisterCallback; 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,