提交 3d21ff72 编写于 作者: L Laine Stump

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: NLaine Stump <laine@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 1b46566e
......@@ -2529,6 +2529,8 @@ virNetDevMacVLanModeTypeFromString;
virNetDevMacVLanReleaseName;
virNetDevMacVLanReserveName;
virNetDevMacVLanRestartWithVPortProfile;
virNetDevMacVLanTapOpen;
virNetDevMacVLanTapSetup;
virNetDevMacVLanVPortProfileRegisterCallback;
......
......@@ -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)
......
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册