mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
nwfilter: change methods returning virNWFilterIPAddrLearnReq to use bool
Various methods return a virNWFilterIPAddrLearnReq struct, but the callers are only interested in whether the return value is non-NULL. It is thus preferrable to just return a bool. Reviewed-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
d60896321b
commit
b6ac5a82b9
@ -655,7 +655,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
|
|||||||
filter->name, vars, driver);
|
filter->name, vars, driver);
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
} else if (STRCASEEQ(learning, "any")) {
|
} else if (STRCASEEQ(learning, "any")) {
|
||||||
if (virNWFilterLookupLearnReq(ifindex) == NULL) {
|
if (!virNWFilterHasLearnReq(ifindex)) {
|
||||||
rc = virNWFilterLearnIPAddress(techdriver,
|
rc = virNWFilterLearnIPAddress(techdriver,
|
||||||
ifname,
|
ifname,
|
||||||
ifindex,
|
ifindex,
|
||||||
@ -680,7 +680,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
|
|||||||
} else if (virHashSize(missing_vars) > 1) {
|
} else if (virHashSize(missing_vars) > 1) {
|
||||||
goto err_unresolvable_vars;
|
goto err_unresolvable_vars;
|
||||||
} else if (!forceWithPendingReq &&
|
} else if (!forceWithPendingReq &&
|
||||||
virNWFilterLookupLearnReq(ifindex) != NULL) {
|
virNWFilterHasLearnReq(ifindex)) {
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -976,7 +976,7 @@ virNWFilterRollbackUpdateFilter(const virDomainNetDef *net)
|
|||||||
/* don't tear anything while the address is being learned */
|
/* don't tear anything while the address is being learned */
|
||||||
if (virNetDevGetIndex(net->ifname, &ifindex) < 0)
|
if (virNetDevGetIndex(net->ifname, &ifindex) < 0)
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
else if (virNWFilterLookupLearnReq(ifindex) != NULL)
|
else if (virNWFilterHasLearnReq(ifindex))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return techdriver->tearNewRules(net->ifname);
|
return techdriver->tearNewRules(net->ifname);
|
||||||
@ -1002,7 +1002,7 @@ virNWFilterTearOldFilter(virDomainNetDefPtr net)
|
|||||||
/* don't tear anything while the address is being learned */
|
/* don't tear anything while the address is being learned */
|
||||||
if (virNetDevGetIndex(net->ifname, &ifindex) < 0)
|
if (virNetDevGetIndex(net->ifname, &ifindex) < 0)
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
else if (virNWFilterLookupLearnReq(ifindex) != NULL)
|
else if (virNWFilterHasLearnReq(ifindex))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return techdriver->tearOldRules(net->ifname);
|
return techdriver->tearOldRules(net->ifname);
|
||||||
|
@ -279,8 +279,8 @@ virNWFilterTerminateLearnReq(const char *ifname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virNWFilterIPAddrLearnReqPtr
|
bool
|
||||||
virNWFilterLookupLearnReq(int ifindex)
|
virNWFilterHasLearnReq(int ifindex)
|
||||||
{
|
{
|
||||||
void *res;
|
void *res;
|
||||||
IFINDEX2STR(ifindex_str, ifindex);
|
IFINDEX2STR(ifindex_str, ifindex);
|
||||||
@ -291,7 +291,7 @@ virNWFilterLookupLearnReq(int ifindex)
|
|||||||
|
|
||||||
virMutexUnlock(&pendingLearnReqLock);
|
virMutexUnlock(&pendingLearnReqLock);
|
||||||
|
|
||||||
return res;
|
return res != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
|||||||
virNWFilterDriverStatePtr driver,
|
virNWFilterDriverStatePtr driver,
|
||||||
enum howDetect howDetect);
|
enum howDetect howDetect);
|
||||||
|
|
||||||
virNWFilterIPAddrLearnReqPtr virNWFilterLookupLearnReq(int ifindex);
|
bool virNWFilterHasLearnReq(int ifindex);
|
||||||
int virNWFilterTerminateLearnReq(const char *ifname);
|
int virNWFilterTerminateLearnReq(const char *ifname);
|
||||||
|
|
||||||
int virNWFilterLockIface(const char *ifname) ATTRIBUTE_RETURN_CHECK;
|
int virNWFilterLockIface(const char *ifname) ATTRIBUTE_RETURN_CHECK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user