Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

WANG Cong and committed by
David S. Miller
6e6a50c2 c779f7af

+6 -10
+1 -1
include/net/act_api.h
··· 97 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 101 void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo); 102 102 int tcf_hash_release(struct tcf_common *p, int bind, 103 103 struct tcf_hashinfo *hinfo);
+3 -3
net/sched/act_api.c
··· 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 161 struct tcf_common *p = NULL; 162 162 struct hlist_head *head; ··· 170 170 171 171 return p; 172 172 } 173 - EXPORT_SYMBOL(tcf_hash_lookup); 174 173 175 174 u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo) 176 175 { ··· 185 186 } 186 187 EXPORT_SYMBOL(tcf_hash_new_index); 187 188 188 - static int tcf_hash_search(struct tc_action *a, u32 index) 189 + int tcf_hash_search(struct tc_action *a, u32 index) 189 190 { 190 191 struct tcf_hashinfo *hinfo = a->ops->hinfo; 191 192 struct tcf_common *p = tcf_hash_lookup(index, hinfo); ··· 196 197 } 197 198 return 0; 198 199 } 200 + EXPORT_SYMBOL(tcf_hash_search); 199 201 200 202 struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, int bind) 201 203 {
+2 -6
net/sched/act_police.c
··· 140 140 parm = nla_data(tb[TCA_POLICE_TBF]); 141 141 142 142 if (parm->index) { 143 - struct tcf_common *pc; 144 - 145 - pc = tcf_hash_lookup(parm->index, hinfo); 146 - if (pc != NULL) { 147 - a->priv = pc; 148 - police = to_police(pc); 143 + if (tcf_hash_search(a, parm->index)) { 144 + police = to_police(a->priv); 149 145 if (bind) { 150 146 police->tcf_bindcnt += 1; 151 147 police->tcf_refcnt += 1;