aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-08-25 10:07:40 -0400
committerPatrick McHardy <kaber@trash.net>2009-08-25 10:07:40 -0400
commit3a6c2b419b7768703cfb2cabdb894517c5065e33 (patch)
treed8d8dc9ad34ffdd2f0f56876e9d3b6f0e6d5eceb
parent74f7a6552c8d76ffc5e11eb8d9d6c07238b9ae77 (diff)
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>
-rw-r--r--include/linux/netlink.h15
-rw-r--r--include/net/netlink.h4
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/sched/act_api.c2
5 files changed, 13 insertions, 12 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 5ba398e90304..0fbecbbe8e9e 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -217,12 +217,13 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
217 217
218struct netlink_callback 218struct netlink_callback
219{ 219{
220 struct sk_buff *skb; 220 struct sk_buff *skb;
221 struct nlmsghdr *nlh; 221 const struct nlmsghdr *nlh;
222 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 222 int (*dump)(struct sk_buff * skb,
223 int (*done)(struct netlink_callback *cb); 223 struct netlink_callback *cb);
224 int family; 224 int (*done)(struct netlink_callback *cb);
225 long args[6]; 225 int family;
226 long args[6];
226}; 227};
227 228
228struct netlink_notify 229struct netlink_notify
@@ -258,7 +259,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
258 NLMSG_NEW(skb, pid, seq, type, len, 0) 259 NLMSG_NEW(skb, pid, seq, type, len, 0)
259 260
260extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 261extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
261 struct nlmsghdr *nlh, 262 const struct nlmsghdr *nlh,
262 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 263 int (*dump)(struct sk_buff *skb, struct netlink_callback*),
263 int (*done)(struct netlink_callback*)); 264 int (*done)(struct netlink_callback*));
264 265
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 007bdb07dabb..a63b2192ac1c 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -365,7 +365,7 @@ static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
365 * 365 *
366 * See nla_parse() 366 * See nla_parse()
367 */ 367 */
368static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, 368static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
369 struct nlattr *tb[], int maxtype, 369 struct nlattr *tb[], int maxtype,
370 const struct nla_policy *policy) 370 const struct nla_policy *policy)
371{ 371{
@@ -414,7 +414,7 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
414 * 414 *
415 * Returns 1 if a report back to the application is requested. 415 * Returns 1 if a report back to the application is requested.
416 */ 416 */
417static inline int nlmsg_report(struct nlmsghdr *nlh) 417static inline int nlmsg_report(const struct nlmsghdr *nlh)
418{ 418{
419 return !!(nlh->nlmsg_flags & NLM_F_ECHO); 419 return !!(nlh->nlmsg_flags & NLM_F_ECHO);
420} 420}
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 3c1895e54b7f..85ba560332ed 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -14,7 +14,7 @@ extern void rtnl_register(int protocol, int msgtype,
14extern int rtnl_unregister(int protocol, int msgtype); 14extern int rtnl_unregister(int protocol, int msgtype);
15extern void rtnl_unregister_all(int protocol); 15extern void rtnl_unregister_all(int protocol);
16 16
17static inline int rtnl_msg_family(struct nlmsghdr *nlh) 17static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
18{ 18{
19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg)) 19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family; 20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index da3163d15ef0..d0ff382c40ca 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1705,7 +1705,7 @@ errout:
1705} 1705}
1706 1706
1707int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 1707int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
1708 struct nlmsghdr *nlh, 1708 const struct nlmsghdr *nlh,
1709 int (*dump)(struct sk_buff *skb, 1709 int (*dump)(struct sk_buff *skb,
1710 struct netlink_callback *), 1710 struct netlink_callback *),
1711 int (*done)(struct netlink_callback *)) 1711 int (*done)(struct netlink_callback *))
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 9d03cc33b6cc..2dfb3e7a040d 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1011,7 +1011,7 @@ replay:
1011} 1011}
1012 1012
1013static struct nlattr * 1013static struct nlattr *
1014find_dump_kind(struct nlmsghdr *n) 1014find_dump_kind(const struct nlmsghdr *n)
1015{ 1015{
1016 struct nlattr *tb1, *tb2[TCA_ACT_MAX+1]; 1016 struct nlattr *tb1, *tb2[TCA_ACT_MAX+1];
1017 struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; 1017 struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];