diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-01-17 14:37:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-21 17:43:16 -0500 |
commit | 6e6a50c254220acb19bd338ce433b1770e4a7a3c (patch) | |
tree | 840f89c1091bf67f2756553e74df65dafa1233c9 | |
parent | c779f7af99f73abb7270dcaa4c29178ab5ef7472 (diff) |
net_sched: act: export tcf_hash_search() instead of tcf_hash_lookup()
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>
-rw-r--r-- | include/net/act_api.h | 2 | ||||
-rw-r--r-- | net/sched/act_api.c | 6 | ||||
-rw-r--r-- | net/sched/act_police.c | 8 |
3 files changed, 6 insertions, 10 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h index 152316b3f59a..788d8378e587 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -97,7 +97,7 @@ struct tc_action_ops { | |||
97 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); | 97 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); |
98 | }; | 98 | }; |
99 | 99 | ||
100 | struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo); | 100 | int tcf_hash_search(struct tc_action *a, u32 index); |
101 | void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo); | 101 | void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo); |
102 | int tcf_hash_release(struct tcf_common *p, int bind, | 102 | int tcf_hash_release(struct tcf_common *p, int bind, |
103 | struct tcf_hashinfo *hinfo); | 103 | struct tcf_hashinfo *hinfo); |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index b94825322d4d..72bdc7166345 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -156,7 +156,7 @@ static int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb, | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo) | 159 | static struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo) |
160 | { | 160 | { |
161 | struct tcf_common *p = NULL; | 161 | struct tcf_common *p = NULL; |
162 | struct hlist_head *head; | 162 | struct hlist_head *head; |
@@ -170,7 +170,6 @@ struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo) | |||
170 | 170 | ||
171 | return p; | 171 | return p; |
172 | } | 172 | } |
173 | EXPORT_SYMBOL(tcf_hash_lookup); | ||
174 | 173 | ||
175 | u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo) | 174 | u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo) |
176 | { | 175 | { |
@@ -186,7 +185,7 @@ u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo) | |||
186 | } | 185 | } |
187 | EXPORT_SYMBOL(tcf_hash_new_index); | 186 | EXPORT_SYMBOL(tcf_hash_new_index); |
188 | 187 | ||
189 | static int tcf_hash_search(struct tc_action *a, u32 index) | 188 | int tcf_hash_search(struct tc_action *a, u32 index) |
190 | { | 189 | { |
191 | struct tcf_hashinfo *hinfo = a->ops->hinfo; | 190 | struct tcf_hashinfo *hinfo = a->ops->hinfo; |
192 | struct tcf_common *p = tcf_hash_lookup(index, hinfo); | 191 | struct tcf_common *p = tcf_hash_lookup(index, hinfo); |
@@ -197,6 +196,7 @@ static int tcf_hash_search(struct tc_action *a, u32 index) | |||
197 | } | 196 | } |
198 | return 0; | 197 | return 0; |
199 | } | 198 | } |
199 | EXPORT_SYMBOL(tcf_hash_search); | ||
200 | 200 | ||
201 | struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, int bind) | 201 | struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, int bind) |
202 | { | 202 | { |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index c7093896cf14..1778209a332f 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -140,12 +140,8 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla, | |||
140 | parm = nla_data(tb[TCA_POLICE_TBF]); | 140 | parm = nla_data(tb[TCA_POLICE_TBF]); |
141 | 141 | ||
142 | if (parm->index) { | 142 | if (parm->index) { |
143 | struct tcf_common *pc; | 143 | if (tcf_hash_search(a, parm->index)) { |
144 | 144 | police = to_police(a->priv); | |
145 | pc = tcf_hash_lookup(parm->index, hinfo); | ||
146 | if (pc != NULL) { | ||
147 | a->priv = pc; | ||
148 | police = to_police(pc); | ||
149 | if (bind) { | 145 | if (bind) { |
150 | police->tcf_bindcnt += 1; | 146 | police->tcf_bindcnt += 1; |
151 | police->tcf_refcnt += 1; | 147 | police->tcf_refcnt += 1; |