Commit fb0ba6bd021248b6bdc58a7b1213a55a6776a38a
Committed by
Linus Torvalds
1 parent
52f17b6c2b
Exists in
master
and in
7 other branches
[PATCH] per-task-delay-accounting: utilities for genetlink usage
Two utilities for simplifying usage of NETLINK_GENERIC interface. Signed-off-by: Balbir Singh <balbir@in.ibm.com> Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com> Cc: Jes Sorensen <jes@sgi.com> Cc: Peter Chubb <peterc@gelato.unsw.edu.au> Cc: Erich Focht <efocht@ess.nec.de> Cc: Levent Serinol <lserinol@gmail.com> Cc: Jay Lan <jlan@engr.sgi.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 20 additions and 0 deletions Side-by-side Diff
include/net/genetlink.h
... | ... | @@ -150,5 +150,25 @@ |
150 | 150 | return nlmsg_unicast(genl_sock, skb, pid); |
151 | 151 | } |
152 | 152 | |
153 | +/** | |
154 | + * gennlmsg_data - head of message payload | |
155 | + * @gnlh: genetlink messsage header | |
156 | + */ | |
157 | +static inline void *genlmsg_data(const struct genlmsghdr *gnlh) | |
158 | +{ | |
159 | + return ((unsigned char *) gnlh + GENL_HDRLEN); | |
160 | +} | |
161 | + | |
162 | +/** | |
163 | + * genlmsg_len - length of message payload | |
164 | + * @gnlh: genetlink message header | |
165 | + */ | |
166 | +static inline int genlmsg_len(const struct genlmsghdr *gnlh) | |
167 | +{ | |
168 | + struct nlmsghdr *nlh = (struct nlmsghdr *)((unsigned char *)gnlh - | |
169 | + NLMSG_HDRLEN); | |
170 | + return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN); | |
171 | +} | |
172 | + | |
153 | 173 | #endif /* __NET_GENERIC_NETLINK_H */ |