[NETFILTER]: replace list_for_each with list_for_each_entry
authorLi Zefan <lizf@cn.fujitsu.com>
Wed, 5 Dec 2007 07:22:26 +0000 (23:22 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:55:52 +0000 (14:55 -0800)
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/netfilter/core.c

index 2f544dac72df7708f7753d74e70de22b2869c46d..311361e1272ce09464ca1b9cad4fb6bbd5873b02 100644 (file)
@@ -109,11 +109,9 @@ clusterip_config_entry_put(struct clusterip_config *c)
 static struct clusterip_config *
 __clusterip_config_find(__be32 clusterip)
 {
 static struct clusterip_config *
 __clusterip_config_find(__be32 clusterip)
 {
-       struct list_head *pos;
+       struct clusterip_config *c;
 
 
-       list_for_each(pos, &clusterip_configs) {
-               struct clusterip_config *c = list_entry(pos,
-                                       struct clusterip_config, list);
+       list_for_each_entry(c, &clusterip_configs, list) {
                if (c->clusterip == clusterip)
                        return c;
        }
                if (c->clusterip == clusterip)
                        return c;
        }
index 631d26948314a55d51a6ba09e55fe816a0db8029..e6d3a69b9e9b29614eb3d7c1a1042a558ce582bc 100644 (file)
@@ -62,17 +62,17 @@ static DEFINE_MUTEX(nf_hook_mutex);
 
 int nf_register_hook(struct nf_hook_ops *reg)
 {
 
 int nf_register_hook(struct nf_hook_ops *reg)
 {
-       struct list_head *i;
+       struct nf_hook_ops *elem;
        int err;
 
        err = mutex_lock_interruptible(&nf_hook_mutex);
        if (err < 0)
                return err;
        int err;
 
        err = mutex_lock_interruptible(&nf_hook_mutex);
        if (err < 0)
                return err;
-       list_for_each(i, &nf_hooks[reg->pf][reg->hooknum]) {
-               if (reg->priority < ((struct nf_hook_ops *)i)->priority)
+       list_for_each_entry(elem, &nf_hooks[reg->pf][reg->hooknum], list) {
+               if (reg->priority < elem->priority)
                        break;
        }
                        break;
        }
-       list_add_rcu(&reg->list, i->prev);
+       list_add_rcu(&reg->list, elem->list.prev);
        mutex_unlock(&nf_hook_mutex);
        return 0;
 }
        mutex_unlock(&nf_hook_mutex);
        return 0;
 }