]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
vmblock-fuse: use glib's atomic operations
authorVMware, Inc <>
Thu, 24 Feb 2011 21:27:51 +0000 (13:27 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 24 Feb 2011 21:27:51 +0000 (13:27 -0800)
Instead of using our implemenation of atomic operations from
lib/misc which has a ton of dependencies, let's use glib's
implementation.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/vmblock-fuse/Makefile.am
open-vm-tools/vmblock-fuse/fsops.c
open-vm-tools/vmblock-fuse/os.h

index d1759b490b605ab93d4da82fff5438d7581140fa..86f06740859f9478e87f414cf447dbb970d31f34 100644 (file)
@@ -29,12 +29,13 @@ AM_CFLAGS += -D_XOPEN_SOURCE=600
 AM_CFLAGS += -DUSERLEVEL
 AM_CFLAGS += -D_FILE_OFFSET_BITS=64
 AM_CFLAGS += @FUSE_CPPFLAGS@
+AM_CFLAGS += @GLIB2_CPPFLAGS@
 AM_CFLAGS += -I$(top_srcdir)/modules/shared/vmblock
 AM_CFLAGS += -I$(srcdir)
 
 vmware_vmblock_fuse_LDADD =
-vmware_vmblock_fuse_LDADD += ../lib/misc/libMisc.la
 vmware_vmblock_fuse_LDADD += @FUSE_LIBS@
+vmware_vmblock_fuse_LDADD += @GLIB2_LIBS@
 
 vmware_vmblock_fuse_SOURCES =
 vmware_vmblock_fuse_SOURCES += util.c
index b3d4006d863c4dd83de2531e633dac6500ca6e79..491ecc3dd6fd67a7b0161197d61652c3c58d1ef1 100644 (file)
@@ -724,7 +724,6 @@ VMBlockRelease(const char *path,                   // IN: Must be control file.
 void *
 VMBlockInit(void)
 {
-   Atomic_Init();
    BlockInit();
    return NULL;
 }
index ef1895972c40fd406b2085d1fa30c72e31af47b2..5bfc3d9cb15ac1d68432bbd1e0de672584452b6d 100644 (file)
@@ -34,8 +34,8 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <glib.h>
 
-#include "vm_atomic.h"
 #include "vm_assert.h"
 
 typedef pthread_rwlock_t                os_rwlock_t;
@@ -45,7 +45,7 @@ typedef struct os_completion_t {
        pthread_mutex_t mutex;
        int completed;
 }                                       os_completion_t;
-typedef Atomic_Int                      os_atomic_t;
+typedef gint                            os_atomic_t;
 typedef char *                          os_blocker_id_t;
 
 #define OS_UNKNOWN_BLOCKER              0
@@ -126,10 +126,10 @@ typedef char *                          os_blocker_id_t;
  * the value before the dec.
  */
 
-#define os_atomic_dec_and_test(atomic)  (Atomic_ReadDecInt(atomic) == 1)
-#define os_atomic_dec                   Atomic_DecInt
-#define os_atomic_set                   Atomic_WriteInt
-#define os_atomic_inc                   Atomic_IncInt
+#define os_atomic_dec_and_test(atomic)  g_atomic_int_dec_and_test(atomic)
+#define os_atomic_dec(atomic)           g_atomic_int_add((atomic), -1)
+#define os_atomic_inc(atomic)           g_atomic_int_inc(atomic)
+#define os_atomic_set(atomic, val)      g_atomic_int_set((atomic), (val))
 
 /*
  * Extra stuff fuse port needs defined (ie not in os.h for other ports).