diff options
author | Patrick McHardy <kaber@trash.net> | 2006-09-20 14:57:53 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 18:19:45 -0400 |
commit | df0933dcb027e156cb5253570ad694b81bd52b69 (patch) | |
tree | 48588f78dfda69f737b5ccfff02787ca0dad6036 /include | |
parent | 1bf38a36b6a0e810dafae048fdbb999e587f0f2f (diff) |
[NETFILTER]: kill listhelp.h
Kill listhelp.h and use the list.h functions instead.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netfilter/x_tables.h | 4 | ||||
-rw-r--r-- | include/linux/netfilter_ipv4/listhelp.h | 123 |
2 files changed, 0 insertions, 127 deletions
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 03d1027fb0e8..c832295dbf61 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -138,10 +138,6 @@ struct xt_counters_info | |||
138 | 138 | ||
139 | #include <linux/netdevice.h> | 139 | #include <linux/netdevice.h> |
140 | 140 | ||
141 | #define ASSERT_READ_LOCK(x) | ||
142 | #define ASSERT_WRITE_LOCK(x) | ||
143 | #include <linux/netfilter_ipv4/listhelp.h> | ||
144 | |||
145 | #ifdef CONFIG_COMPAT | 141 | #ifdef CONFIG_COMPAT |
146 | #define COMPAT_TO_USER 1 | 142 | #define COMPAT_TO_USER 1 |
147 | #define COMPAT_FROM_USER -1 | 143 | #define COMPAT_FROM_USER -1 |
diff --git a/include/linux/netfilter_ipv4/listhelp.h b/include/linux/netfilter_ipv4/listhelp.h deleted file mode 100644 index 5d92cf044d91..000000000000 --- a/include/linux/netfilter_ipv4/listhelp.h +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | #ifndef _LISTHELP_H | ||
2 | #define _LISTHELP_H | ||
3 | #include <linux/list.h> | ||
4 | |||
5 | /* Header to do more comprehensive job than linux/list.h; assume list | ||
6 | is first entry in structure. */ | ||
7 | |||
8 | /* Return pointer to first true entry, if any, or NULL. A macro | ||
9 | required to allow inlining of cmpfn. */ | ||
10 | #define LIST_FIND(head, cmpfn, type, args...) \ | ||
11 | ({ \ | ||
12 | const struct list_head *__i, *__j = NULL; \ | ||
13 | \ | ||
14 | ASSERT_READ_LOCK(head); \ | ||
15 | list_for_each(__i, (head)) \ | ||
16 | if (cmpfn((const type)__i , ## args)) { \ | ||
17 | __j = __i; \ | ||
18 | break; \ | ||
19 | } \ | ||
20 | (type)__j; \ | ||
21 | }) | ||
22 | |||
23 | #define LIST_FIND_W(head, cmpfn, type, args...) \ | ||
24 | ({ \ | ||
25 | const struct list_head *__i, *__j = NULL; \ | ||
26 | \ | ||
27 | ASSERT_WRITE_LOCK(head); \ | ||
28 | list_for_each(__i, (head)) \ | ||
29 | if (cmpfn((type)__i , ## args)) { \ | ||
30 | __j = __i; \ | ||
31 | break; \ | ||
32 | } \ | ||
33 | (type)__j; \ | ||
34 | }) | ||
35 | |||
36 | /* Just like LIST_FIND but we search backwards */ | ||
37 | #define LIST_FIND_B(head, cmpfn, type, args...) \ | ||
38 | ({ \ | ||
39 | const struct list_head *__i, *__j = NULL; \ | ||
40 | \ | ||
41 | ASSERT_READ_LOCK(head); \ | ||
42 | list_for_each_prev(__i, (head)) \ | ||
43 | if (cmpfn((const type)__i , ## args)) { \ | ||
44 | __j = __i; \ | ||
45 | break; \ | ||
46 | } \ | ||
47 | (type)__j; \ | ||
48 | }) | ||
49 | |||
50 | static inline int | ||
51 | __list_cmp_same(const void *p1, const void *p2) { return p1 == p2; } | ||
52 | |||
53 | /* Is this entry in the list? */ | ||
54 | static inline int | ||
55 | list_inlist(struct list_head *head, const void *entry) | ||
56 | { | ||
57 | return LIST_FIND(head, __list_cmp_same, void *, entry) != NULL; | ||
58 | } | ||
59 | |||
60 | /* Delete from list. */ | ||
61 | #ifdef CONFIG_NETFILTER_DEBUG | ||
62 | #define LIST_DELETE(head, oldentry) \ | ||
63 | do { \ | ||
64 | ASSERT_WRITE_LOCK(head); \ | ||
65 | if (!list_inlist(head, oldentry)) \ | ||
66 | printk("LIST_DELETE: %s:%u `%s'(%p) not in %s.\n", \ | ||
67 | __FILE__, __LINE__, #oldentry, oldentry, #head); \ | ||
68 | else list_del((struct list_head *)oldentry); \ | ||
69 | } while(0) | ||
70 | #else | ||
71 | #define LIST_DELETE(head, oldentry) list_del((struct list_head *)oldentry) | ||
72 | #endif | ||
73 | |||
74 | /* Append. */ | ||
75 | static inline void | ||
76 | list_append(struct list_head *head, void *new) | ||
77 | { | ||
78 | ASSERT_WRITE_LOCK(head); | ||
79 | list_add((new), (head)->prev); | ||
80 | } | ||
81 | |||
82 | /* Prepend. */ | ||
83 | static inline void | ||
84 | list_prepend(struct list_head *head, void *new) | ||
85 | { | ||
86 | ASSERT_WRITE_LOCK(head); | ||
87 | list_add(new, head); | ||
88 | } | ||
89 | |||
90 | /* Insert according to ordering function; insert before first true. */ | ||
91 | #define LIST_INSERT(head, new, cmpfn) \ | ||
92 | do { \ | ||
93 | struct list_head *__i; \ | ||
94 | ASSERT_WRITE_LOCK(head); \ | ||
95 | list_for_each(__i, (head)) \ | ||
96 | if ((new), (typeof (new))__i) \ | ||
97 | break; \ | ||
98 | list_add((struct list_head *)(new), __i->prev); \ | ||
99 | } while(0) | ||
100 | |||
101 | /* If the field after the list_head is a nul-terminated string, you | ||
102 | can use these functions. */ | ||
103 | static inline int __list_cmp_name(const void *i, const char *name) | ||
104 | { | ||
105 | return strcmp(name, i+sizeof(struct list_head)) == 0; | ||
106 | } | ||
107 | |||
108 | /* Returns false if same name already in list, otherwise does insert. */ | ||
109 | static inline int | ||
110 | list_named_insert(struct list_head *head, void *new) | ||
111 | { | ||
112 | if (LIST_FIND(head, __list_cmp_name, void *, | ||
113 | new + sizeof(struct list_head))) | ||
114 | return 0; | ||
115 | list_prepend(head, new); | ||
116 | return 1; | ||
117 | } | ||
118 | |||
119 | /* Find this named element in the list. */ | ||
120 | #define list_named_find(head, name) \ | ||
121 | LIST_FIND(head, __list_cmp_name, void *, name) | ||
122 | |||
123 | #endif /*_LISTHELP_H*/ | ||