aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraglitke <aglitke@aglitke.localdomain>2006-08-24 10:54:44 -0500
committeraglitke <aglitke@aglitke.localdomain>2006-08-24 10:54:44 -0500
commitf498e96604ecd097b084a30b42915ba62bbdc282 (patch)
tree5512570c937c1e4f8de1b1f6743a0952fa7635be
parent40b26a7fbc402bc51c40b48e14470b30b9534236 (diff)
downloadlibhugetlbfs-f498e96604ecd097b084a30b42915ba62bbdc282.tar.gz
barrier() consolidation
I hit some build failures with a barrier() redefinition when building the libhugetlbfs source, this fixes it up and also consolidates the various implementations. The problem itself cropped up in tests/mprotect.c where barrier() had already been defined as a macro. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Acked-by: Adam Litke <agl@us.ibm.com>
-rw-r--r--tests/hugetests.h8
-rw-r--r--tests/linkhuge.c2
-rw-r--r--tests/linkshare.c2
-rw-r--r--tests/mprotect.c6
4 files changed, 8 insertions, 10 deletions
diff --git a/tests/hugetests.h b/tests/hugetests.h
index 37f9703..646a08b 100644
--- a/tests/hugetests.h
+++ b/tests/hugetests.h
@@ -36,6 +36,14 @@ ino_t get_addr_inode(void *p);
#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#ifndef barrier
+# ifdef mb
+# define barrier() mb()
+# else
+# define barrier() __asm__ __volatile__ ("" : : : "memory")
+# endif
+#endif
+
/* Each test case must define this function */
void cleanup(void);
diff --git a/tests/linkhuge.c b/tests/linkhuge.c
index 89815d5..02282c7 100644
--- a/tests/linkhuge.c
+++ b/tests/linkhuge.c
@@ -28,8 +28,6 @@
#define BLOCK_SIZE 16384
#define CONST 0xdeadbeef
-#define barrier() asm volatile ("" : : : "memory" )
-
#define BIG_INIT { \
[0] = CONST, [17] = CONST, [BLOCK_SIZE-1] = CONST, \
}
diff --git a/tests/linkshare.c b/tests/linkshare.c
index 83bafea..227af08 100644
--- a/tests/linkshare.c
+++ b/tests/linkshare.c
@@ -35,8 +35,6 @@
#define CONST 0xdeadbeef
#define SHM_KEY 0xdeadcab
-#define barrier() asm volatile ("" : : : "memory" )
-
#define BIG_INIT { \
[0] = CONST, [17] = CONST, [BLOCK_SIZE-1] = CONST, \
}
diff --git a/tests/mprotect.c b/tests/mprotect.c
index b26b1c3..173eb79 100644
--- a/tests/mprotect.c
+++ b/tests/mprotect.c
@@ -36,12 +36,6 @@ static sigjmp_buf sig_escape;
static void *sig_expected = MAP_FAILED;
static int hpage_size;
-static inline void barrier(void)
-{
- __asm__ __volatile__(""
- : : :"memory");
-}
-
static void sig_handler(int signum, siginfo_t *si, void *uc)
{
if (signum == SIGSEGV) {