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 <[EMAIL PROTECTED]>

--

 tests/hugetests.h |    8 ++++++++
 tests/linkhuge.c  |    2 --
 tests/linkshare.c |    2 --
 tests/mprotect.c  |    6 ------
 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 @@ #include "hugetests.h"
 #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 BLOCK_SIZE    16384
 #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) {

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to