From fc4ccd896f60d9d733b995fd91979e32bb2a6e76 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Wed, 25 Aug 2010 17:01:58 -0700 Subject: [PATCH] refresh --- meta | 7 +++--- patches/atomic | 42 ++++++++++++++++++++------------- patches/refresh-temp | 56 -------------------------------------------- 3 files changed, 29 insertions(+), 76 deletions(-) delete mode 100644 patches/refresh-temp diff --git a/meta b/meta index 753526a..a1ac266 100644 --- a/meta +++ b/meta @@ -1,8 +1,7 @@ Version: 1 -Previous: be0734ca347edc568e9854fe5d5ebd8c5e79424c -Head: d38a322fbaa608020244730906e11d55bfdb9212 +Previous: dc8d6a0dabfc1438650f6e11eacc8e8fcb20dca1 +Head: 0b477b15ac308e22db226f41776eb394deb63b15 Applied: - atomic: 1e95862665a23084eb89522ce5b47ccabf008329 - refresh-temp: d38a322fbaa608020244730906e11d55bfdb9212 + atomic: 0b477b15ac308e22db226f41776eb394deb63b15 Unapplied: Hidden: diff --git a/patches/atomic b/patches/atomic index e774f40..a3df170 100644 --- a/patches/atomic +++ b/patches/atomic @@ -1,5 +1,5 @@ Bottom: 44cd90e52fd7bd946e34e9acdfcf1cef88293c9a -Top: b4ed043a0fc86707acda56000b3096e59867bfbe +Top: 58672dbab4886462dc5ca2664ef7b5725ca5a6d8 Author: Sean Hefty Date: 2010-08-25 10:26:22 -0700 @@ -41,28 +41,38 @@ index 997c775..dfddeac if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then ac_cv_version_script=yes diff --git a/linux/osd.h b/linux/osd.h -index 722e1b1..9dacab9 100644 +index 722e1b1..28c3647 100644 --- a/linux/osd.h +++ b/linux/osd.h -@@ -65,9 +65,27 @@ +@@ -65,9 +65,37 @@ #endif #define ntohll(x) htonll(x) +#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_fetch_and_add(&(v)->val, 1) + 1) diff --git a/patches/refresh-temp b/patches/refresh-temp deleted file mode 100644 index 680f3c8..0000000 --- a/patches/refresh-temp +++ /dev/null @@ -1,56 +0,0 @@ -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)) -- 2.41.0