Commit 3a6c2b419b7768703cfb2cabdb894517c5065e33

Authored by Patrick McHardy
1 parent 74f7a6552c

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 *))
... ... @@ -1011,7 +1011,7 @@
1011 1011 }
1012 1012  
1013 1013 static struct nlattr *
1014   -find_dump_kind(struct nlmsghdr *n)
  1014 +find_dump_kind(const struct nlmsghdr *n)
1015 1015 {
1016 1016 struct nlattr *tb1, *tb2[TCA_ACT_MAX+1];
1017 1017 struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];