diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-25 22:08:35 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:34 -0400 |
commit | b529ccf2799c14346d1518e9bdf1f88f03643e99 (patch) | |
tree | f899a5a5d66d2ca21724c1871ee3afeda6c4a670 /kernel | |
parent | 965ffea43d4ebe8cd7b9fee78d651268dd7d23c5 (diff) |
[NETLINK]: Introduce nlmsg_hdr() helper
For the common "(struct nlmsghdr *)skb->data" sequence, so that we reduce the
number of direct accesses to skb->data and for consistency with all the other
cast skb member helpers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit.c | 6 | ||||
-rw-r--r-- | kernel/taskstats.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index ea8521417d13..80a7457dadbf 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -151,7 +151,7 @@ struct audit_buffer { | |||
151 | 151 | ||
152 | static void audit_set_pid(struct audit_buffer *ab, pid_t pid) | 152 | static void audit_set_pid(struct audit_buffer *ab, pid_t pid) |
153 | { | 153 | { |
154 | struct nlmsghdr *nlh = (struct nlmsghdr *)ab->skb->data; | 154 | struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); |
155 | nlh->nlmsg_pid = pid; | 155 | nlh->nlmsg_pid = pid; |
156 | } | 156 | } |
157 | 157 | ||
@@ -750,7 +750,7 @@ static void audit_receive_skb(struct sk_buff *skb) | |||
750 | u32 rlen; | 750 | u32 rlen; |
751 | 751 | ||
752 | while (skb->len >= NLMSG_SPACE(0)) { | 752 | while (skb->len >= NLMSG_SPACE(0)) { |
753 | nlh = (struct nlmsghdr *)skb->data; | 753 | nlh = nlmsg_hdr(skb); |
754 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | 754 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) |
755 | return; | 755 | return; |
756 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); | 756 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); |
@@ -1268,7 +1268,7 @@ void audit_log_end(struct audit_buffer *ab) | |||
1268 | audit_log_lost("rate limit exceeded"); | 1268 | audit_log_lost("rate limit exceeded"); |
1269 | } else { | 1269 | } else { |
1270 | if (audit_pid) { | 1270 | if (audit_pid) { |
1271 | struct nlmsghdr *nlh = (struct nlmsghdr *)ab->skb->data; | 1271 | struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); |
1272 | nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); | 1272 | nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); |
1273 | skb_queue_tail(&audit_skb_queue, ab->skb); | 1273 | skb_queue_tail(&audit_skb_queue, ab->skb); |
1274 | ab->skb = NULL; | 1274 | ab->skb = NULL; |
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 4c3476fa058d..ad7d2392cb0e 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -102,7 +102,7 @@ static int prepare_reply(struct genl_info *info, u8 cmd, struct sk_buff **skbp, | |||
102 | */ | 102 | */ |
103 | static int send_reply(struct sk_buff *skb, pid_t pid) | 103 | static int send_reply(struct sk_buff *skb, pid_t pid) |
104 | { | 104 | { |
105 | struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); | 105 | struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb)); |
106 | void *reply = genlmsg_data(genlhdr); | 106 | void *reply = genlmsg_data(genlhdr); |
107 | int rc; | 107 | int rc; |
108 | 108 | ||
@@ -121,7 +121,7 @@ static int send_reply(struct sk_buff *skb, pid_t pid) | |||
121 | static void send_cpu_listeners(struct sk_buff *skb, | 121 | static void send_cpu_listeners(struct sk_buff *skb, |
122 | struct listener_list *listeners) | 122 | struct listener_list *listeners) |
123 | { | 123 | { |
124 | struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); | 124 | struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb)); |
125 | struct listener *s, *tmp; | 125 | struct listener *s, *tmp; |
126 | struct sk_buff *skb_next, *skb_cur = skb; | 126 | struct sk_buff *skb_next, *skb_cur = skb; |
127 | void *reply = genlmsg_data(genlhdr); | 127 | void *reply = genlmsg_data(genlhdr); |