diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2017-08-05 00:31:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-07 17:12:17 -0400 |
commit | 8113c095672f6504b23eba6edf4a57b5f7f744af (patch) | |
tree | 24712765682423e7901c41b033b3ce5b050d13bb /net/sched/cls_basic.c | |
parent | 54df2cf819a23dba4bb2c4134ed62659a7d324f5 (diff) |
net_sched: use void pointer for filter handle
Now we use 'unsigned long fh' as a pointer in every place,
it is safe to convert it to a void pointer now. This gets
rid of many casts to pointer.
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_basic.c')
-rw-r--r-- | net/sched/cls_basic.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 7c7a82138f76..73cc7f167a38 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -56,20 +56,18 @@ static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
56 | return -1; | 56 | return -1; |
57 | } | 57 | } |
58 | 58 | ||
59 | static unsigned long basic_get(struct tcf_proto *tp, u32 handle) | 59 | static void *basic_get(struct tcf_proto *tp, u32 handle) |
60 | { | 60 | { |
61 | unsigned long l = 0UL; | ||
62 | struct basic_head *head = rtnl_dereference(tp->root); | 61 | struct basic_head *head = rtnl_dereference(tp->root); |
63 | struct basic_filter *f; | 62 | struct basic_filter *f; |
64 | 63 | ||
65 | list_for_each_entry(f, &head->flist, link) { | 64 | list_for_each_entry(f, &head->flist, link) { |
66 | if (f->handle == handle) { | 65 | if (f->handle == handle) { |
67 | l = (unsigned long) f; | 66 | return f; |
68 | break; | ||
69 | } | 67 | } |
70 | } | 68 | } |
71 | 69 | ||
72 | return l; | 70 | return NULL; |
73 | } | 71 | } |
74 | 72 | ||
75 | static int basic_init(struct tcf_proto *tp) | 73 | static int basic_init(struct tcf_proto *tp) |
@@ -106,10 +104,10 @@ static void basic_destroy(struct tcf_proto *tp) | |||
106 | kfree_rcu(head, rcu); | 104 | kfree_rcu(head, rcu); |
107 | } | 105 | } |
108 | 106 | ||
109 | static int basic_delete(struct tcf_proto *tp, unsigned long arg, bool *last) | 107 | static int basic_delete(struct tcf_proto *tp, void *arg, bool *last) |
110 | { | 108 | { |
111 | struct basic_head *head = rtnl_dereference(tp->root); | 109 | struct basic_head *head = rtnl_dereference(tp->root); |
112 | struct basic_filter *f = (struct basic_filter *) arg; | 110 | struct basic_filter *f = arg; |
113 | 111 | ||
114 | list_del_rcu(&f->link); | 112 | list_del_rcu(&f->link); |
115 | tcf_unbind_filter(tp, &f->res); | 113 | tcf_unbind_filter(tp, &f->res); |
@@ -149,7 +147,7 @@ static int basic_set_parms(struct net *net, struct tcf_proto *tp, | |||
149 | 147 | ||
150 | static int basic_change(struct net *net, struct sk_buff *in_skb, | 148 | static int basic_change(struct net *net, struct sk_buff *in_skb, |
151 | struct tcf_proto *tp, unsigned long base, u32 handle, | 149 | struct tcf_proto *tp, unsigned long base, u32 handle, |
152 | struct nlattr **tca, unsigned long *arg, bool ovr) | 150 | struct nlattr **tca, void **arg, bool ovr) |
153 | { | 151 | { |
154 | int err; | 152 | int err; |
155 | struct basic_head *head = rtnl_dereference(tp->root); | 153 | struct basic_head *head = rtnl_dereference(tp->root); |
@@ -202,7 +200,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb, | |||
202 | if (err < 0) | 200 | if (err < 0) |
203 | goto errout; | 201 | goto errout; |
204 | 202 | ||
205 | *arg = (unsigned long)fnew; | 203 | *arg = fnew; |
206 | 204 | ||
207 | if (fold) { | 205 | if (fold) { |
208 | list_replace_rcu(&fold->link, &fnew->link); | 206 | list_replace_rcu(&fold->link, &fnew->link); |
@@ -228,7 +226,7 @@ static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg) | |||
228 | if (arg->count < arg->skip) | 226 | if (arg->count < arg->skip) |
229 | goto skip; | 227 | goto skip; |
230 | 228 | ||
231 | if (arg->fn(tp, (unsigned long) f, arg) < 0) { | 229 | if (arg->fn(tp, f, arg) < 0) { |
232 | arg->stop = 1; | 230 | arg->stop = 1; |
233 | break; | 231 | break; |
234 | } | 232 | } |
@@ -237,10 +235,10 @@ skip: | |||
237 | } | 235 | } |
238 | } | 236 | } |
239 | 237 | ||
240 | static int basic_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, | 238 | static int basic_dump(struct net *net, struct tcf_proto *tp, void *fh, |
241 | struct sk_buff *skb, struct tcmsg *t) | 239 | struct sk_buff *skb, struct tcmsg *t) |
242 | { | 240 | { |
243 | struct basic_filter *f = (struct basic_filter *) fh; | 241 | struct basic_filter *f = fh; |
244 | struct nlattr *nest; | 242 | struct nlattr *nest; |
245 | 243 | ||
246 | if (f == NULL) | 244 | if (f == NULL) |