Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0ac41e81462de20f87242caac2b9084c202c33b7
Commit:     0ac41e81462de20f87242caac2b9084c202c33b7
Parent:     c01cd429fc118c5db92475c5f08b307718aa4efc
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Wed Dec 5 01:25:03 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:56:11 2008 -0800

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/netfilter/ip_queue.c   |    8 +++-----
 net/ipv6/netfilter/ip6_queue.c  |    8 +++-----
 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 2966fbd..9e72246 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)
 static inline void
 __ipq_enqueue_entry(struct ipq_queue_entry *entry)
 {
-       list_add(&entry->list, &queue_list);
+       list_add_tail(&entry->list, &queue_list);
        queue_total++;
 }
 
@@ -84,11 +84,9 @@ __ipq_enqueue_entry(struct ipq_queue_entry *entry)
 static inline struct ipq_queue_entry *
 __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data)
 {
-       struct list_head *p;
-
-       list_for_each_prev(p, &queue_list) {
-               struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p;
+       struct ipq_queue_entry *entry;
 
+       list_for_each_entry(entry, &queue_list, list) {
                if (!cmpfn || cmpfn(entry, data))
                        return entry;
        }
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 7ff9915..243a00b 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)
 static inline void
 __ipq_enqueue_entry(struct ipq_queue_entry *entry)
 {
-       list_add(&entry->list, &queue_list);
+       list_add_tail(&entry->list, &queue_list);
        queue_total++;
 }
 
@@ -82,11 +82,9 @@ __ipq_enqueue_entry(struct ipq_queue_entry *entry)
 static inline struct ipq_queue_entry *
 __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data)
 {
-       struct list_head *p;
-
-       list_for_each_prev(p, &queue_list) {
-               struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p;
+       struct ipq_queue_entry *entry;
 
+       list_for_each_entry(entry, &queue_list, list) {
                if (!cmpfn || cmpfn(entry, data))
                        return entry;
        }
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 3a09f02..74d5ed9 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -231,7 +231,7 @@ static inline void
 __enqueue_entry(struct nfqnl_instance *queue,
                      struct nfqnl_queue_entry *entry)
 {
-       list_add(&entry->list, &queue->queue_list);
+       list_add_tail(&entry->list, &queue->queue_list);
        queue->queue_total++;
 }
 
@@ -243,11 +243,9 @@ static inline struct nfqnl_queue_entry *
 __find_entry(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn,
                   unsigned long data)
 {
-       struct list_head *p;
-
-       list_for_each_prev(p, &queue->queue_list) {
-               struct nfqnl_queue_entry *entry = (struct nfqnl_queue_entry *)p;
+       struct nfqnl_queue_entry *entry;
 
+       list_for_each_entry(entry, &queue->queue_list, list) {
                if (!cmpfn || cmpfn(entry, data))
                        return entry;
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to