diff options
author | Patrick McHardy <kaber@trash.net> | 2007-12-05 04:25:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:56:11 -0500 |
commit | 0ac41e81462de20f87242caac2b9084c202c33b7 (patch) | |
tree | 4978450cfe485614fc2c0ef962ebbfbc9dff5cf9 | |
parent | c01cd429fc118c5db92475c5f08b307718aa4efc (diff) |
[NETFILTER]: {nf_netlink,ip,ip6}_queue: use list_for_each_entry
Use list_add_tail/list_for_each_entry instead of list_add and
list_for_each_prev as a preparation for switching to RCU.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/netfilter/ip_queue.c | 8 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_queue.c | 8 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue.c | 8 |
3 files changed, 9 insertions, 15 deletions
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 2966fbddce8b..9e72246ede25 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -73,7 +73,7 @@ ipq_issue_verdict(struct ipq_queue_entry *entry, int verdict) | |||
73 | static inline void | 73 | static inline void |
74 | __ipq_enqueue_entry(struct ipq_queue_entry *entry) | 74 | __ipq_enqueue_entry(struct ipq_queue_entry *entry) |
75 | { | 75 | { |
76 | list_add(&entry->list, &queue_list); | 76 | list_add_tail(&entry->list, &queue_list); |
77 | queue_total++; | 77 | queue_total++; |
78 | } | 78 | } |
79 | 79 | ||
@@ -84,11 +84,9 @@ __ipq_enqueue_entry(struct ipq_queue_entry *entry) | |||
84 | static inline struct ipq_queue_entry * | 84 | static inline struct ipq_queue_entry * |
85 | __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data) | 85 | __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data) |
86 | { | 86 | { |
87 | struct list_head *p; | 87 | struct ipq_queue_entry *entry; |
88 | |||
89 | list_for_each_prev(p, &queue_list) { | ||
90 | struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p; | ||
91 | 88 | ||
89 | list_for_each_entry(entry, &queue_list, list) { | ||
92 | if (!cmpfn || cmpfn(entry, data)) | 90 | if (!cmpfn || cmpfn(entry, data)) |
93 | return entry; | 91 | return entry; |
94 | } | 92 | } |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 7ff9915750a3..243a00bcd3df 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -71,7 +71,7 @@ ipq_issue_verdict(struct ipq_queue_entry *entry, int verdict) | |||
71 | static inline void | 71 | static inline void |
72 | __ipq_enqueue_entry(struct ipq_queue_entry *entry) | 72 | __ipq_enqueue_entry(struct ipq_queue_entry *entry) |
73 | { | 73 | { |
74 | list_add(&entry->list, &queue_list); | 74 | list_add_tail(&entry->list, &queue_list); |
75 | queue_total++; | 75 | queue_total++; |
76 | } | 76 | } |
77 | 77 | ||
@@ -82,11 +82,9 @@ __ipq_enqueue_entry(struct ipq_queue_entry *entry) | |||
82 | static inline struct ipq_queue_entry * | 82 | static inline struct ipq_queue_entry * |
83 | __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data) | 83 | __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data) |
84 | { | 84 | { |
85 | struct list_head *p; | 85 | struct ipq_queue_entry *entry; |
86 | |||
87 | list_for_each_prev(p, &queue_list) { | ||
88 | struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p; | ||
89 | 86 | ||
87 | list_for_each_entry(entry, &queue_list, list) { | ||
90 | if (!cmpfn || cmpfn(entry, data)) | 88 | if (!cmpfn || cmpfn(entry, data)) |
91 | return entry; | 89 | return entry; |
92 | } | 90 | } |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 3a09f021065a..74d5ed9490a9 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -231,7 +231,7 @@ static inline void | |||
231 | __enqueue_entry(struct nfqnl_instance *queue, | 231 | __enqueue_entry(struct nfqnl_instance *queue, |
232 | struct nfqnl_queue_entry *entry) | 232 | struct nfqnl_queue_entry *entry) |
233 | { | 233 | { |
234 | list_add(&entry->list, &queue->queue_list); | 234 | list_add_tail(&entry->list, &queue->queue_list); |
235 | queue->queue_total++; | 235 | queue->queue_total++; |
236 | } | 236 | } |
237 | 237 | ||
@@ -243,11 +243,9 @@ static inline struct nfqnl_queue_entry * | |||
243 | __find_entry(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, | 243 | __find_entry(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, |
244 | unsigned long data) | 244 | unsigned long data) |
245 | { | 245 | { |
246 | struct list_head *p; | 246 | struct nfqnl_queue_entry *entry; |
247 | |||
248 | list_for_each_prev(p, &queue->queue_list) { | ||
249 | struct nfqnl_queue_entry *entry = (struct nfqnl_queue_entry *)p; | ||
250 | 247 | ||
248 | list_for_each_entry(entry, &queue->queue_list, list) { | ||
251 | if (!cmpfn || cmpfn(entry, data)) | 249 | if (!cmpfn || cmpfn(entry, data)) |
252 | return entry; | 250 | return entry; |
253 | } | 251 | } |