mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-27 18:03:50 +03: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);
|
||||
goto err_exit;
|
||||
} else if (STRCASEEQ(learning, "any")) {
|
||||
if (virNWFilterLookupLearnReq(ifindex) == NULL) {
|
||||
if (!virNWFilterHasLearnReq(ifindex)) {
|
||||
rc = virNWFilterLearnIPAddress(techdriver,
|
||||
ifname,
|
||||
ifindex,
|
||||
@ -680,7 +680,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
|
||||
} else if (virHashSize(missing_vars) > 1) {
|
||||
goto err_unresolvable_vars;
|
||||
} else if (!forceWithPendingReq &&
|
||||
virNWFilterLookupLearnReq(ifindex) != NULL) {
|
||||
virNWFilterHasLearnReq(ifindex)) {
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
@ -976,7 +976,7 @@ virNWFilterRollbackUpdateFilter(const virDomainNetDef *net)
|
||||
/* don't tear anything while the address is being learned */
|
||||
if (virNetDevGetIndex(net->ifname, &ifindex) < 0)
|
||||
virResetLastError();
|
||||
else if (virNWFilterLookupLearnReq(ifindex) != NULL)
|
||||
else if (virNWFilterHasLearnReq(ifindex))
|
||||
return 0;
|
||||
|
||||
return techdriver->tearNewRules(net->ifname);
|
||||
@ -1002,7 +1002,7 @@ virNWFilterTearOldFilter(virDomainNetDefPtr net)
|
||||
/* don't tear anything while the address is being learned */
|
||||
if (virNetDevGetIndex(net->ifname, &ifindex) < 0)
|
||||
virResetLastError();
|
||||
else if (virNWFilterLookupLearnReq(ifindex) != NULL)
|
||||
else if (virNWFilterHasLearnReq(ifindex))
|
||||
return 0;
|
||||
|
||||
return techdriver->tearOldRules(net->ifname);
|
||||
|
@ -279,8 +279,8 @@ virNWFilterTerminateLearnReq(const char *ifname)
|
||||
}
|
||||
|
||||
|
||||
virNWFilterIPAddrLearnReqPtr
|
||||
virNWFilterLookupLearnReq(int ifindex)
|
||||
bool
|
||||
virNWFilterHasLearnReq(int ifindex)
|
||||
{
|
||||
void *res;
|
||||
IFINDEX2STR(ifindex_str, ifindex);
|
||||
@ -291,7 +291,7 @@ virNWFilterLookupLearnReq(int ifindex)
|
||||
|
||||
virMutexUnlock(&pendingLearnReqLock);
|
||||
|
||||
return res;
|
||||
return res != NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
||||
virNWFilterDriverStatePtr driver,
|
||||
enum howDetect howDetect);
|
||||
|
||||
virNWFilterIPAddrLearnReqPtr virNWFilterLookupLearnReq(int ifindex);
|
||||
bool virNWFilterHasLearnReq(int ifindex);
|
||||
int virNWFilterTerminateLearnReq(const char *ifname);
|
||||
|
||||
int virNWFilterLockIface(const char *ifname) ATTRIBUTE_RETURN_CHECK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user