net_sched: act: export tcf_hash_search() instead of tcf_hash_lookup()
authorWANG Cong <xiyou.wangcong@gmail.com>
Fri, 17 Jan 2014 19:37:03 +0000 (11:37 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jan 2014 22:43:16 +0000 (14:43 -0800)
So that we will not expose struct tcf_common to modules.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/act_api.h
net/sched/act_api.c
net/sched/act_police.c

index 152316b3f59a8ddada9748416cf70cca5ba58b31..788d8378e587f00bbf2a61bd39665370b17f7a41 100644 (file)
@@ -97,7 +97,7 @@ struct tc_action_ops {
        int     (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *);
 };
 
-struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo);
+int tcf_hash_search(struct tc_action *a, u32 index);
 void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo);
 int tcf_hash_release(struct tcf_common *p, int bind,
                     struct tcf_hashinfo *hinfo);
index b94825322d4df5466db333b851502f7b76b6fa8d..72bdc71663458e8cc131ab392b6af7673f35207d 100644 (file)
@@ -156,7 +156,7 @@ static int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb,
        }
 }
 
-struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo)
+static struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo)
 {
        struct tcf_common *p = NULL;
        struct hlist_head *head;
@@ -170,7 +170,6 @@ struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo)
 
        return p;
 }
-EXPORT_SYMBOL(tcf_hash_lookup);
 
 u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo)
 {
@@ -186,7 +185,7 @@ u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo)
 }
 EXPORT_SYMBOL(tcf_hash_new_index);
 
-static int tcf_hash_search(struct tc_action *a, u32 index)
+int tcf_hash_search(struct tc_action *a, u32 index)
 {
        struct tcf_hashinfo *hinfo = a->ops->hinfo;
        struct tcf_common *p = tcf_hash_lookup(index, hinfo);
@@ -197,6 +196,7 @@ static int tcf_hash_search(struct tc_action *a, u32 index)
        }
        return 0;
 }
+EXPORT_SYMBOL(tcf_hash_search);
 
 struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, int bind)
 {
index c7093896cf1406b5505f4e9575d1849739d185a5..1778209a332fa1ac251c02beaa97a49cfec747f3 100644 (file)
@@ -140,12 +140,8 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla,
        parm = nla_data(tb[TCA_POLICE_TBF]);
 
        if (parm->index) {
-               struct tcf_common *pc;
-
-               pc = tcf_hash_lookup(parm->index, hinfo);
-               if (pc != NULL) {
-                       a->priv = pc;
-                       police = to_police(pc);
+               if (tcf_hash_search(a, parm->index)) {
+                       police = to_police(a->priv);
                        if (bind) {
                                police->tcf_bindcnt += 1;
                                police->tcf_refcnt += 1;