diff options
-rw-r--r-- | tools/testing/radix-tree/linux/init.h | 2 | ||||
-rw-r--r-- | tools/testing/radix-tree/linux/kernel.h | 39 | ||||
-rw-r--r-- | tools/testing/radix-tree/linux/preempt.h | 10 |
3 files changed, 12 insertions, 39 deletions
diff --git a/tools/testing/radix-tree/linux/init.h b/tools/testing/radix-tree/linux/init.h index 360cabb3c4e7..1bb0afc21309 100644 --- a/tools/testing/radix-tree/linux/init.h +++ b/tools/testing/radix-tree/linux/init.h | |||
@@ -1 +1 @@ | |||
/* An empty file stub that allows radix-tree.c to compile. */ | #define __init | ||
diff --git a/tools/testing/radix-tree/linux/kernel.h b/tools/testing/radix-tree/linux/kernel.h index 9681463c91e2..dd1d9aefb14f 100644 --- a/tools/testing/radix-tree/linux/kernel.h +++ b/tools/testing/radix-tree/linux/kernel.h | |||
@@ -1,10 +1,9 @@ | |||
1 | #ifndef _KERNEL_H | 1 | #ifndef _KERNEL_H |
2 | #define _KERNEL_H | 2 | #define _KERNEL_H |
3 | 3 | ||
4 | #include <assert.h> | 4 | #include "../../include/linux/kernel.h" |
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | #include <stddef.h> | ||
8 | #include <limits.h> | 7 | #include <limits.h> |
9 | 8 | ||
10 | #include <linux/compiler.h> | 9 | #include <linux/compiler.h> |
@@ -19,47 +18,11 @@ | |||
19 | #define RADIX_TREE_MAP_SHIFT 3 | 18 | #define RADIX_TREE_MAP_SHIFT 3 |
20 | #endif | 19 | #endif |
21 | 20 | ||
22 | #ifndef NULL | ||
23 | #define NULL 0 | ||
24 | #endif | ||
25 | |||
26 | #define BUG_ON(expr) assert(!(expr)) | ||
27 | #define __init | ||
28 | #define __must_check | ||
29 | #define panic(expr) | ||
30 | #define printk printf | 21 | #define printk printf |
31 | #define __force | ||
32 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | ||
33 | #define pr_debug printk | 22 | #define pr_debug printk |
34 | 23 | ||
35 | #define smp_rmb() barrier() | ||
36 | #define smp_wmb() barrier() | ||
37 | #define cpu_relax() barrier() | ||
38 | |||
39 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | 24 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
40 | 25 | ||
41 | #define container_of(ptr, type, member) ({ \ | ||
42 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | ||
43 | (type *)( (char *)__mptr - offsetof(type, member) );}) | ||
44 | #define min(a, b) ((a) < (b) ? (a) : (b)) | ||
45 | |||
46 | #define cond_resched() sched_yield() | ||
47 | |||
48 | static inline int in_interrupt(void) | ||
49 | { | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * This looks more complex than it should be. But we need to | ||
55 | * get the type for the ~ right in round_down (it needs to be | ||
56 | * as wide as the result!), and we want to evaluate the macro | ||
57 | * arguments just once each. | ||
58 | */ | ||
59 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | ||
60 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | ||
61 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | ||
62 | |||
63 | #define xchg(ptr, x) uatomic_xchg(ptr, x) | 26 | #define xchg(ptr, x) uatomic_xchg(ptr, x) |
64 | 27 | ||
65 | #endif /* _KERNEL_H */ | 28 | #endif /* _KERNEL_H */ |
diff --git a/tools/testing/radix-tree/linux/preempt.h b/tools/testing/radix-tree/linux/preempt.h index 65c04c226965..35c5ac81529f 100644 --- a/tools/testing/radix-tree/linux/preempt.h +++ b/tools/testing/radix-tree/linux/preempt.h | |||
@@ -1,4 +1,14 @@ | |||
1 | #ifndef __LINUX_PREEMPT_H | ||
2 | #define __LINUX_PREEMPT_H | ||
3 | |||
1 | extern int preempt_count; | 4 | extern int preempt_count; |
2 | 5 | ||
3 | #define preempt_disable() uatomic_inc(&preempt_count) | 6 | #define preempt_disable() uatomic_inc(&preempt_count) |
4 | #define preempt_enable() uatomic_dec(&preempt_count) | 7 | #define preempt_enable() uatomic_dec(&preempt_count) |
8 | |||
9 | static inline int in_interrupt(void) | ||
10 | { | ||
11 | return 0; | ||
12 | } | ||
13 | |||
14 | #endif /* __LINUX_PREEMPT_H */ | ||