From: Sean Hefty Date: Thu, 26 Aug 2010 00:01:58 +0000 (-0700) Subject: refresh (create temporary patch) X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=38c7d581858583ea78ea19df5980a1e350414a0f;p=~shefty%2Fibacm.git refresh (create temporary patch) --- diff --git a/meta b/meta index 3c1fc83..753526a 100644 --- a/meta +++ b/meta @@ -1,7 +1,8 @@ Version: 1 -Previous: 7a76d01d0d42220a11c9bd2e6e214fc738c7c2f4 -Head: 1e95862665a23084eb89522ce5b47ccabf008329 +Previous: be0734ca347edc568e9854fe5d5ebd8c5e79424c +Head: d38a322fbaa608020244730906e11d55bfdb9212 Applied: atomic: 1e95862665a23084eb89522ce5b47ccabf008329 + refresh-temp: d38a322fbaa608020244730906e11d55bfdb9212 Unapplied: Hidden: diff --git a/patches/refresh-temp b/patches/refresh-temp new file mode 100644 index 0000000..680f3c8 --- /dev/null +++ b/patches/refresh-temp @@ -0,0 +1,56 @@ +Bottom: b4ed043a0fc86707acda56000b3096e59867bfbe +Top: 58672dbab4886462dc5ca2664ef7b5725ca5a6d8 +Author: Sean Hefty +Date: 2010-08-25 17:01:58 -0700 + +Refresh of atomic + +--- + +diff --git a/linux/osd.h b/linux/osd.h +index 9dacab9..28c3647 100644 +--- a/linux/osd.h ++++ b/linux/osd.h +@@ -67,19 +67,29 @@ + + #if DEFINE_ATOMICS + typedef struct { pthread_mutex_t mut; int val; } atomic_t; +-#define atomic_inc(v) { \ +- int x; +- pthread_mutex_lock(&(v)->mut); \ +- x = ++val; \ +- pthread_mutex_unlock(&(v)->mut); \ +- return x; } +-#define atomic_dec(v) { \ +- int x; +- pthread_mutex_lock(&(v)->mut); \ +- x = --val; \ +- pthread_mutex_unlock(&(v)->mut); \ +- return x; } +-#define atomic_init(v) { pthread_mutex_init(&(v)->mut, NULL); (v)->val = 0); } ++static inline int atomic_inc(atomic_t *atomic) ++{ ++ int v; ++ ++ pthread_mutex_lock(&atomic->mut); ++ v = ++(atomic->val); ++ pthread_mutex_unlock(&atomic->mut); ++ return v; ++} ++static inline int atomic_dec(atomic_t *atomic) ++{ ++ int v; ++ ++ pthread_mutex_lock(&atomic->mut); ++ v = --(atomic->val); ++ pthread_mutex_unlock(&atomic->mut); ++ return v; ++} ++static inline void atomic_init(atomic_t *atomic) ++{ ++ pthread_mutex_init(&atomic->mut, NULL); ++ atomic->val = 0; ++} + #else + typedef struct { volatile int val; } atomic_t; + #define atomic_inc(v) (__sync_add_and_fetch(&(v)->val, 1))