From: Cong Wang <xiyou.wangcong@gmail.com>
To: netdev@vger.kernel.org
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
"David S. Miller" <davem@davemloft.net>
Subject: [Patch net-next 2/6] net_sched: act: export tcf_hash_search() instead of tcf_hash_lookup()
Date: Fri, 17 Jan 2014 11:37:03 -0800 [thread overview]
Message-ID: <1389987427-14085-3-git-send-email-xiyou.wangcong@gmail.com> (raw)
In-Reply-To: <1389987427-14085-1-git-send-email-xiyou.wangcong@gmail.com>
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>
---
include/net/act_api.h | 2 +-
net/sched/act_api.c | 6 +++---
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 ca1dcf5..3b76a30 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -99,7 +99,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);
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index b948253..72bdc71 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,
}
}
-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)
{
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 30d4f4b..e51f7d9 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,
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;
--
1.8.3.1
next prev parent reply other threads:[~2014-01-17 19:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-17 19:37 [Patch net-next 0/6] net_sched: act: more cleanup and improvement Cong Wang
2014-01-17 19:37 ` [Patch net-next 1/6] net_sched: act: fetch hinfo from a->ops->hinfo Cong Wang
2014-01-20 12:16 ` Jamal Hadi Salim
2014-01-21 22:43 ` David Miller
2014-01-17 19:37 ` Cong Wang [this message]
2014-01-20 12:28 ` [Patch net-next 2/6] net_sched: act: export tcf_hash_search() instead of tcf_hash_lookup() Jamal Hadi Salim
2014-01-21 22:44 ` David Miller
2014-01-17 19:37 ` [Patch net-next 3/6] net_sched: act: hide struct tcf_common from API Cong Wang
2014-01-20 12:44 ` Jamal Hadi Salim
2014-01-20 13:01 ` Jamal Hadi Salim
2014-01-22 12:44 ` Jamal Hadi Salim
2014-01-23 7:10 ` Cong Wang
2014-01-23 21:37 ` Cong Wang
2014-01-17 19:37 ` [Patch net-next 4/6] net_sched: act: refactor cleanup ops Cong Wang
2014-01-17 19:37 ` [Patch net-next 5/6] net_sched: act: move tcf_hashinfo_init() into tcf_register_action() Cong Wang
2014-01-17 19:37 ` [Patch net-next 6/6] net_sched: act: refuse to remove bound action outside Cong Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1389987427-14085-3-git-send-email-xiyou.wangcong@gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).