mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 10:25:16 +00:00
src: Replace virAtomicIntSet() with g_atomic_int_set()
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
8567ff1f5c
commit
f127acfa34
@ -1884,7 +1884,7 @@ virNWFilterSnoopLeaseFileRefresh(void)
|
||||
TMPLEASEFILE, LEASEFILE);
|
||||
unlink(TMPLEASEFILE);
|
||||
}
|
||||
virAtomicIntSet(&virNWFilterSnoopState.wLeases, 0);
|
||||
g_atomic_int_set(&virNWFilterSnoopState.wLeases, 0);
|
||||
|
||||
skip_rename:
|
||||
virNWFilterSnoopLeaseFileOpen();
|
||||
|
@ -106,7 +106,7 @@ struct _testDriver {
|
||||
size_t numAuths;
|
||||
testAuthPtr auths;
|
||||
|
||||
/* virAtomic access only */
|
||||
/* g_atomic access only */
|
||||
volatile int nextDomID;
|
||||
|
||||
/* immutable pointer, immutable object after being initialized with
|
||||
@ -448,7 +448,7 @@ testDriverNew(void)
|
||||
!(ret->pools = virStoragePoolObjListNew()))
|
||||
goto error;
|
||||
|
||||
virAtomicIntSet(&ret->nextDomID, 1);
|
||||
g_atomic_int_set(&ret->nextDomID, 1);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -26,15 +26,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/**
|
||||
* virAtomicIntSet:
|
||||
* Sets the value of atomic to newval.
|
||||
*
|
||||
* This call acts as a full compiler and hardware memory barrier
|
||||
* (after the set)
|
||||
*/
|
||||
#define virAtomicIntSet(i, newv) g_atomic_int_set(i, newv)
|
||||
|
||||
/**
|
||||
* virAtomicIntInc:
|
||||
* Increments the value of atomic by 1.
|
||||
|
@ -246,7 +246,7 @@ virObjectNew(virClassPtr klass)
|
||||
|
||||
obj->u.s.magic = klass->magic;
|
||||
obj->klass = klass;
|
||||
virAtomicIntSet(&obj->u.s.refs, 1);
|
||||
g_atomic_int_set(&obj->u.s.refs, 1);
|
||||
|
||||
PROBE(OBJECT_NEW, "obj=%p classname=%s", obj, obj->klass->name);
|
||||
|
||||
|
@ -160,13 +160,13 @@ virSystemdHasMachined(void)
|
||||
|
||||
if ((ret = virDBusIsServiceEnabled("org.freedesktop.machine1")) < 0) {
|
||||
if (ret == -2)
|
||||
virAtomicIntSet(&virSystemdHasMachinedCachedValue, -2);
|
||||
g_atomic_int_set(&virSystemdHasMachinedCachedValue, -2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = virDBusIsServiceRegistered("org.freedesktop.systemd1")) == -1)
|
||||
return ret;
|
||||
virAtomicIntSet(&virSystemdHasMachinedCachedValue, ret);
|
||||
g_atomic_int_set(&virSystemdHasMachinedCachedValue, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -183,14 +183,14 @@ virSystemdHasLogind(void)
|
||||
ret = virDBusIsServiceEnabled("org.freedesktop.login1");
|
||||
if (ret < 0) {
|
||||
if (ret == -2)
|
||||
virAtomicIntSet(&virSystemdHasLogindCachedValue, -2);
|
||||
g_atomic_int_set(&virSystemdHasLogindCachedValue, -2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = virDBusIsServiceRegistered("org.freedesktop.login1")) == -1)
|
||||
return ret;
|
||||
|
||||
virAtomicIntSet(&virSystemdHasLogindCachedValue, ret);
|
||||
g_atomic_int_set(&virSystemdHasLogindCachedValue, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ int virSystemdCreateMachine(const char *name,
|
||||
VIR_INFO("CreateMachineWithNetwork isn't supported, switching "
|
||||
"to legacy CreateMachine method for systemd-machined");
|
||||
virResetError(&error);
|
||||
virAtomicIntSet(&hasCreateWithNetwork, 0);
|
||||
g_atomic_int_set(&hasCreateWithNetwork, 0);
|
||||
/* Could re-structure without Using goto, but this
|
||||
* avoids another atomic read which would trigger
|
||||
* another memory barrier */
|
||||
|
Loading…
x
Reference in New Issue
Block a user