radix tree test suite: Remove types.h
authorMatthew Wilcox <mawilcox@microsoft.com>
Fri, 16 Dec 2016 19:53:45 +0000 (14:53 -0500)
committerMatthew Wilcox <mawilcox@microsoft.com>
Mon, 13 Feb 2017 21:09:41 +0000 (16:09 -0500)
Move the pieces we still need to tools/include and update a few implicit
includes.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
tools/include/linux/compiler.h
tools/include/linux/spinlock.h [new file with mode: 0644]
tools/testing/radix-tree/linux.c
tools/testing/radix-tree/linux/gfp.h
tools/testing/radix-tree/linux/types.h [deleted file]

index e33fc1df3935e3164280fab29ca0a34908ae5b16..9d294161c494abdf9ea2702d1854b7356b50f92a 100644 (file)
@@ -21,6 +21,8 @@
 #endif
 
 #define __user
+#define __rcu
+#define __read_mostly
 
 #ifndef __attribute_const__
 # define __attribute_const__
@@ -50,6 +52,8 @@
 # define unlikely(x)           __builtin_expect(!!(x), 0)
 #endif
 
+#define uninitialized_var(x) x = *(&(x))
+
 #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
 
 #include <linux/types.h>
diff --git a/tools/include/linux/spinlock.h b/tools/include/linux/spinlock.h
new file mode 100644 (file)
index 0000000..58397dc
--- /dev/null
@@ -0,0 +1,5 @@
+#define spinlock_t             pthread_mutex_t
+#define DEFINE_SPINLOCK(x)     pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER;
+
+#define spin_lock_irqsave(x, f)                (void)f, pthread_mutex_lock(x)
+#define spin_unlock_irqrestore(x, f)   (void)f, pthread_mutex_unlock(x)
index c27c11261c376a6e6eff4406a3380e6fa04ae843..93f06614e91bae2a2f67aafa7e069915afd78737 100644 (file)
@@ -5,6 +5,7 @@
 #include <unistd.h>
 #include <assert.h>
 
+#include <linux/gfp.h>
 #include <linux/poison.h>
 #include <linux/slab.h>
 #include <linux/radix-tree.h>
index 5b09b2ce6c33ad0e732a70e65347258e00f5a741..701209816a6b9a215be45d3a9a8df3813b491fef 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _GFP_H
 #define _GFP_H
 
+#include <linux/types.h>
+
 #define __GFP_BITS_SHIFT 26
 #define __GFP_BITS_MASK ((gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
 
diff --git a/tools/testing/radix-tree/linux/types.h b/tools/testing/radix-tree/linux/types.h
deleted file mode 100644 (file)
index 8491d89..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _TYPES_H
-#define _TYPES_H
-
-#include "../../include/linux/types.h"
-
-#define __rcu
-#define __read_mostly
-
-static inline void INIT_LIST_HEAD(struct list_head *list)
-{
-       list->next = list;
-       list->prev = list;
-}
-
-typedef struct {
-       unsigned int x;
-} spinlock_t;
-
-#define uninitialized_var(x) x = x
-
-#include <linux/gfp.h>
-
-#endif