virnwfilterobj: Don't use virObjectLockGuard() with virNWFilterObj

While its name would suggest that virNWFilterObj is an actual
virObject it is not. It's a plain structure (with virMutex as its
first member). Therefore, when locking the struct
virObjectLockGuard() can' be used and virLockGuardLock() must be
used instead.

Spotted-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Michal Privoznik 2022-03-18 11:36:47 +01:00
parent 45dcb1a881
commit 17fe6a090b

View File

@ -386,7 +386,7 @@ virNWFilterObjListCount(void *key G_GNUC_UNUSED,
{ {
virNWFilterObj *obj = payload; virNWFilterObj *obj = payload;
struct virNWFilterObjListData *data = opaque; struct virNWFilterObjListData *data = opaque;
VIR_LOCK_GUARD lock = virObjectLockGuard(obj); VIR_LOCK_GUARD lock = virLockGuardLock(&obj->lock);
if (data->filter(data->conn, obj->def)) if (data->filter(data->conn, obj->def))
data->count++; data->count++;
@ -423,7 +423,7 @@ virNWFilterObjListCopyNames(void *key G_GNUC_UNUSED,
{ {
virNWFilterObj *obj = payload; virNWFilterObj *obj = payload;
struct virNWFilterNameData *data = opaque; struct virNWFilterNameData *data = opaque;
VIR_LOCK_GUARD lock = virObjectLockGuard(obj); VIR_LOCK_GUARD lock = virLockGuardLock(&obj->lock);
if (data->filter && if (data->filter &&
!data->filter(data->conn, obj->def)) !data->filter(data->conn, obj->def))