aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorBalbir Singh <balbir@in.ibm.com>2006-10-01 02:28:51 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 03:39:29 -0400
commit17db952cd16cecc76937b138c685ae3d198ab17c (patch)
tree5c8c83c75be3eb95065ec5241bfd82142622a91d /include/net
parent31608214fe21dc31d8046679054ab033b1fe5cf1 (diff)
[PATCH] Add genetlink utilities for payload length calculation
Add two utility helper functions genlmsg_msg_size() and genlmsg_total_size(). These functions are derived from their netlink counterparts. Signed-off-by: Balbir Singh <balbir@in.ibm.com> Cc: Jamal Hadi <hadi@cyberus.ca> Cc: Shailabh Nagar <nagar@watson.ibm.com> Cc: Thomas Graf <tgraf@suug.ch> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jay Lan <jlan@engr.sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/genetlink.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 4a38d85e4e25..b619314218a6 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -169,4 +169,22 @@ static inline int genlmsg_len(const struct genlmsghdr *gnlh)
169 return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN); 169 return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN);
170} 170}
171 171
172/**
173 * genlmsg_msg_size - length of genetlink message not including padding
174 * @payload: length of message payload
175 */
176static inline int genlmsg_msg_size(int payload)
177{
178 return GENL_HDRLEN + payload;
179}
180
181/**
182 * genlmsg_total_size - length of genetlink message including padding
183 * @payload: length of message payload
184 */
185static inline int genlmsg_total_size(int payload)
186{
187 return NLMSG_ALIGN(genlmsg_msg_size(payload));
188}
189
172#endif /* __NET_GENERIC_NETLINK_H */ 190#endif /* __NET_GENERIC_NETLINK_H */