util: make a couple virNetDevMacVlan*() functions public

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@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Laine Stump 2019-08-26 01:51:40 -04:00
parent 1b46566eed
commit 3d21ff72e0
3 changed files with 16 additions and 7 deletions

View File

@ -2529,6 +2529,8 @@ virNetDevMacVLanModeTypeFromString;
virNetDevMacVLanReleaseName;
virNetDevMacVLanReserveName;
virNetDevMacVLanRestartWithVPortProfile;
virNetDevMacVLanTapOpen;
virNetDevMacVLanTapSetup;
virNetDevMacVLanVPortProfileRegisterCallback;

View File

@ -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)

View File

@ -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,