]> xenbits.xensource.com Git - libvirt.git/commitdiff
src: Replace virAtomicIntSet() with g_atomic_int_set()
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 31 Jan 2020 16:08:35 +0000 (17:08 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Sun, 2 Feb 2020 15:36:50 +0000 (16:36 +0100)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/nwfilter/nwfilter_dhcpsnoop.c
src/test/test_driver.c
src/util/viratomic.h
src/util/virobject.c
src/util/virsystemd.c

index 074cffecb214555cd8776b7b6dfdf83b9475f12f..b82779609d570c36188c9f1665f216869d49889e 100644 (file)
@@ -1884,7 +1884,7 @@ virNWFilterSnoopLeaseFileRefresh(void)
                              TMPLEASEFILE, LEASEFILE);
         unlink(TMPLEASEFILE);
     }
-    virAtomicIntSet(&virNWFilterSnoopState.wLeases, 0);
+    g_atomic_int_set(&virNWFilterSnoopState.wLeases, 0);
 
  skip_rename:
     virNWFilterSnoopLeaseFileOpen();
index 261c1537970cc4ee5c39c7e8056f5887f163ebb4..ba157c068630fe2612c271cf9cbc8de5041676c5 100644 (file)
@@ -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;
 
index 6c1764f7bf4d0bca7ba4b30cb334154dabc8b16c..2811447a296d87d90b4ae0866576a17ae31c1806 100644 (file)
 
 #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.
index 5af14234f26665642c1d7c8ce8591b75e77e746a..8cece6e735da0218e6355811c1c9aab252ad7d46 100644 (file)
@@ -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);
 
index 5b66094de589b4dd0270a9e6acfdcfdfe6851f9f..6b47f4fa36e9281b0a9923021d12685a1ac32710 100644 (file)
@@ -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 */