From 12ea65390bd5a46f8a70f068eb0d48922576a781 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Fri, 16 Dec 2016 14:53:45 -0500 Subject: [PATCH] radix tree test suite: Remove types.h Move the pieces we still need to tools/include and update a few implicit includes. Signed-off-by: Matthew Wilcox --- tools/include/linux/compiler.h | 4 ++++ tools/include/linux/spinlock.h | 5 +++++ tools/testing/radix-tree/linux.c | 1 + tools/testing/radix-tree/linux/gfp.h | 2 ++ tools/testing/radix-tree/linux/types.h | 23 ----------------------- 5 files changed, 12 insertions(+), 23 deletions(-) create mode 100644 tools/include/linux/spinlock.h delete mode 100644 tools/testing/radix-tree/linux/types.h diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index e33fc1df3935..9d294161c494 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h @@ -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 diff --git a/tools/include/linux/spinlock.h b/tools/include/linux/spinlock.h new file mode 100644 index 000000000000..58397dcb19d6 --- /dev/null +++ b/tools/include/linux/spinlock.h @@ -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) diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index c27c11261c37..93f06614e91b 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include diff --git a/tools/testing/radix-tree/linux/gfp.h b/tools/testing/radix-tree/linux/gfp.h index 5b09b2ce6c33..701209816a6b 100644 --- a/tools/testing/radix-tree/linux/gfp.h +++ b/tools/testing/radix-tree/linux/gfp.h @@ -1,6 +1,8 @@ #ifndef _GFP_H #define _GFP_H +#include + #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 index 8491d89873bb..000000000000 --- a/tools/testing/radix-tree/linux/types.h +++ /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 - -#endif -- 2.20.1