Commit 3a6c2b419b7768703cfb2cabdb894517c5065e33
1 parent
74f7a6552c
Exists in
master
and in
7 other branches
netlink: constify nlmsghdr arguments
Consitfy nlmsghdr arguments to a couple of functions as preparation for the next patch, which will constify the netlink message data in all nfnetlink users. Signed-off-by: Patrick McHardy <kaber@trash.net>
Showing 5 changed files with 13 additions and 12 deletions Side-by-side Diff
include/linux/netlink.h
... | ... | @@ -217,12 +217,13 @@ |
217 | 217 | |
218 | 218 | struct netlink_callback |
219 | 219 | { |
220 | - struct sk_buff *skb; | |
221 | - struct nlmsghdr *nlh; | |
222 | - int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); | |
223 | - int (*done)(struct netlink_callback *cb); | |
224 | - int family; | |
225 | - long args[6]; | |
220 | + struct sk_buff *skb; | |
221 | + const struct nlmsghdr *nlh; | |
222 | + int (*dump)(struct sk_buff * skb, | |
223 | + struct netlink_callback *cb); | |
224 | + int (*done)(struct netlink_callback *cb); | |
225 | + int family; | |
226 | + long args[6]; | |
226 | 227 | }; |
227 | 228 | |
228 | 229 | struct netlink_notify |
... | ... | @@ -258,7 +259,7 @@ |
258 | 259 | NLMSG_NEW(skb, pid, seq, type, len, 0) |
259 | 260 | |
260 | 261 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |
261 | - struct nlmsghdr *nlh, | |
262 | + const struct nlmsghdr *nlh, | |
262 | 263 | int (*dump)(struct sk_buff *skb, struct netlink_callback*), |
263 | 264 | int (*done)(struct netlink_callback*)); |
264 | 265 |
include/net/netlink.h
... | ... | @@ -365,7 +365,7 @@ |
365 | 365 | * |
366 | 366 | * See nla_parse() |
367 | 367 | */ |
368 | -static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, | |
368 | +static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, | |
369 | 369 | struct nlattr *tb[], int maxtype, |
370 | 370 | const struct nla_policy *policy) |
371 | 371 | { |
... | ... | @@ -414,7 +414,7 @@ |
414 | 414 | * |
415 | 415 | * Returns 1 if a report back to the application is requested. |
416 | 416 | */ |
417 | -static inline int nlmsg_report(struct nlmsghdr *nlh) | |
417 | +static inline int nlmsg_report(const struct nlmsghdr *nlh) | |
418 | 418 | { |
419 | 419 | return !!(nlh->nlmsg_flags & NLM_F_ECHO); |
420 | 420 | } |
include/net/rtnetlink.h
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | extern int rtnl_unregister(int protocol, int msgtype); |
15 | 15 | extern void rtnl_unregister_all(int protocol); |
16 | 16 | |
17 | -static inline int rtnl_msg_family(struct nlmsghdr *nlh) | |
17 | +static inline int rtnl_msg_family(const struct nlmsghdr *nlh) | |
18 | 18 | { |
19 | 19 | if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg)) |
20 | 20 | return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family; |
net/netlink/af_netlink.c
... | ... | @@ -1705,7 +1705,7 @@ |
1705 | 1705 | } |
1706 | 1706 | |
1707 | 1707 | int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |
1708 | - struct nlmsghdr *nlh, | |
1708 | + const struct nlmsghdr *nlh, | |
1709 | 1709 | int (*dump)(struct sk_buff *skb, |
1710 | 1710 | struct netlink_callback *), |
1711 | 1711 | int (*done)(struct netlink_callback *)) |
net/sched/act_api.c