mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-04 05:15:46 +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);
|
TMPLEASEFILE, LEASEFILE);
|
||||||
unlink(TMPLEASEFILE);
|
unlink(TMPLEASEFILE);
|
||||||
}
|
}
|
||||||
virAtomicIntSet(&virNWFilterSnoopState.wLeases, 0);
|
g_atomic_int_set(&virNWFilterSnoopState.wLeases, 0);
|
||||||
|
|
||||||
skip_rename:
|
skip_rename:
|
||||||
virNWFilterSnoopLeaseFileOpen();
|
virNWFilterSnoopLeaseFileOpen();
|
||||||
|
@ -106,7 +106,7 @@ struct _testDriver {
|
|||||||
size_t numAuths;
|
size_t numAuths;
|
||||||
testAuthPtr auths;
|
testAuthPtr auths;
|
||||||
|
|
||||||
/* virAtomic access only */
|
/* g_atomic access only */
|
||||||
volatile int nextDomID;
|
volatile int nextDomID;
|
||||||
|
|
||||||
/* immutable pointer, immutable object after being initialized with
|
/* immutable pointer, immutable object after being initialized with
|
||||||
@ -448,7 +448,7 @@ testDriverNew(void)
|
|||||||
!(ret->pools = virStoragePoolObjListNew()))
|
!(ret->pools = virStoragePoolObjListNew()))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
virAtomicIntSet(&ret->nextDomID, 1);
|
g_atomic_int_set(&ret->nextDomID, 1);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -26,15 +26,6 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#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:
|
* virAtomicIntInc:
|
||||||
* Increments the value of atomic by 1.
|
* Increments the value of atomic by 1.
|
||||||
|
@ -246,7 +246,7 @@ virObjectNew(virClassPtr klass)
|
|||||||
|
|
||||||
obj->u.s.magic = klass->magic;
|
obj->u.s.magic = klass->magic;
|
||||||
obj->klass = klass;
|
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);
|
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 = virDBusIsServiceEnabled("org.freedesktop.machine1")) < 0) {
|
||||||
if (ret == -2)
|
if (ret == -2)
|
||||||
virAtomicIntSet(&virSystemdHasMachinedCachedValue, -2);
|
g_atomic_int_set(&virSystemdHasMachinedCachedValue, -2);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = virDBusIsServiceRegistered("org.freedesktop.systemd1")) == -1)
|
if ((ret = virDBusIsServiceRegistered("org.freedesktop.systemd1")) == -1)
|
||||||
return ret;
|
return ret;
|
||||||
virAtomicIntSet(&virSystemdHasMachinedCachedValue, ret);
|
g_atomic_int_set(&virSystemdHasMachinedCachedValue, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,14 +183,14 @@ virSystemdHasLogind(void)
|
|||||||
ret = virDBusIsServiceEnabled("org.freedesktop.login1");
|
ret = virDBusIsServiceEnabled("org.freedesktop.login1");
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (ret == -2)
|
if (ret == -2)
|
||||||
virAtomicIntSet(&virSystemdHasLogindCachedValue, -2);
|
g_atomic_int_set(&virSystemdHasLogindCachedValue, -2);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = virDBusIsServiceRegistered("org.freedesktop.login1")) == -1)
|
if ((ret = virDBusIsServiceRegistered("org.freedesktop.login1")) == -1)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
virAtomicIntSet(&virSystemdHasLogindCachedValue, ret);
|
g_atomic_int_set(&virSystemdHasLogindCachedValue, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ int virSystemdCreateMachine(const char *name,
|
|||||||
VIR_INFO("CreateMachineWithNetwork isn't supported, switching "
|
VIR_INFO("CreateMachineWithNetwork isn't supported, switching "
|
||||||
"to legacy CreateMachine method for systemd-machined");
|
"to legacy CreateMachine method for systemd-machined");
|
||||||
virResetError(&error);
|
virResetError(&error);
|
||||||
virAtomicIntSet(&hasCreateWithNetwork, 0);
|
g_atomic_int_set(&hasCreateWithNetwork, 0);
|
||||||
/* Could re-structure without Using goto, but this
|
/* Could re-structure without Using goto, but this
|
||||||
* avoids another atomic read which would trigger
|
* avoids another atomic read which would trigger
|
||||||
* another memory barrier */
|
* another memory barrier */
|
||||||
|
Loading…
Reference in New Issue
Block a user