[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>
This commit is contained in:
parent
c01cd429fc
commit
0ac41e8146
@ -73,7 +73,7 @@ ipq_issue_verdict(struct ipq_queue_entry *entry, int verdict)
|
|||||||
static inline void
|
static inline void
|
||||||
__ipq_enqueue_entry(struct ipq_queue_entry *entry)
|
__ipq_enqueue_entry(struct ipq_queue_entry *entry)
|
||||||
{
|
{
|
||||||
list_add(&entry->list, &queue_list);
|
list_add_tail(&entry->list, &queue_list);
|
||||||
queue_total++;
|
queue_total++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,11 +84,9 @@ __ipq_enqueue_entry(struct ipq_queue_entry *entry)
|
|||||||
static inline struct ipq_queue_entry *
|
static inline struct ipq_queue_entry *
|
||||||
__ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data)
|
__ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data)
|
||||||
{
|
{
|
||||||
struct list_head *p;
|
struct ipq_queue_entry *entry;
|
||||||
|
|
||||||
list_for_each_prev(p, &queue_list) {
|
|
||||||
struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p;
|
|
||||||
|
|
||||||
|
list_for_each_entry(entry, &queue_list, list) {
|
||||||
if (!cmpfn || cmpfn(entry, data))
|
if (!cmpfn || cmpfn(entry, data))
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ ipq_issue_verdict(struct ipq_queue_entry *entry, int verdict)
|
|||||||
static inline void
|
static inline void
|
||||||
__ipq_enqueue_entry(struct ipq_queue_entry *entry)
|
__ipq_enqueue_entry(struct ipq_queue_entry *entry)
|
||||||
{
|
{
|
||||||
list_add(&entry->list, &queue_list);
|
list_add_tail(&entry->list, &queue_list);
|
||||||
queue_total++;
|
queue_total++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,11 +82,9 @@ __ipq_enqueue_entry(struct ipq_queue_entry *entry)
|
|||||||
static inline struct ipq_queue_entry *
|
static inline struct ipq_queue_entry *
|
||||||
__ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data)
|
__ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data)
|
||||||
{
|
{
|
||||||
struct list_head *p;
|
struct ipq_queue_entry *entry;
|
||||||
|
|
||||||
list_for_each_prev(p, &queue_list) {
|
|
||||||
struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p;
|
|
||||||
|
|
||||||
|
list_for_each_entry(entry, &queue_list, list) {
|
||||||
if (!cmpfn || cmpfn(entry, data))
|
if (!cmpfn || cmpfn(entry, data))
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ static inline void
|
|||||||
__enqueue_entry(struct nfqnl_instance *queue,
|
__enqueue_entry(struct nfqnl_instance *queue,
|
||||||
struct nfqnl_queue_entry *entry)
|
struct nfqnl_queue_entry *entry)
|
||||||
{
|
{
|
||||||
list_add(&entry->list, &queue->queue_list);
|
list_add_tail(&entry->list, &queue->queue_list);
|
||||||
queue->queue_total++;
|
queue->queue_total++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,11 +243,9 @@ static inline struct nfqnl_queue_entry *
|
|||||||
__find_entry(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn,
|
__find_entry(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn,
|
||||||
unsigned long data)
|
unsigned long data)
|
||||||
{
|
{
|
||||||
struct list_head *p;
|
struct nfqnl_queue_entry *entry;
|
||||||
|
|
||||||
list_for_each_prev(p, &queue->queue_list) {
|
|
||||||
struct nfqnl_queue_entry *entry = (struct nfqnl_queue_entry *)p;
|
|
||||||
|
|
||||||
|
list_for_each_entry(entry, &queue->queue_list, list) {
|
||||||
if (!cmpfn || cmpfn(entry, data))
|
if (!cmpfn || cmpfn(entry, data))
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user