From: Balbir Singh <balbir@in.ibm.com>
To: akpm@osdl.org
Cc: Jamal Hadi <hadi@cyberus.ca>,
Shailabh Nagar <nagar@watson.ibm.com>,
Thomas Graf <tgraf@suug.ch>,
netdev@vger.kernel.org, Balbir Singh <balbir@in.ibm.com>,
linux-kernel@vger.kernel.org
Subject: [RFC][PATCH -mm] Add genetlink utilities for payload length calculation
Date: Mon, 11 Sep 2006 13:10:21 +0530 [thread overview]
Message-ID: <20060911074021.26844.70576.sendpatchset@localhost.localdomain> (raw)
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>
---
include/net/genetlink.h | 18 ++++++++++++++++++
1 files changed, 18 insertions(+)
diff -puN include/net/genetlink.h~genetlink-payload-size-helpers include/net/genetlink.h
--- linux-2.6.18-rc6/include/net/genetlink.h~genetlink-payload-size-helpers 2006-09-11 10:34:56.000000000 +0530
+++ linux-2.6.18-rc6-balbir/include/net/genetlink.h 2006-09-11 11:42:37.000000000 +0530
@@ -171,4 +171,22 @@ static inline int genlmsg_len(const stru
return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN);
}
+/**
+ * genlmsg_msg_size - length of genetlink message not including padding
+ * @payload: length of message payload
+ */
+static inline int genlmsg_msg_size(int payload)
+{
+ return GENL_HDRLEN + payload;
+}
+
+/**
+ * genlmsg_total_size - length of genetlink message including padding
+ * @payload: length of message payload
+ */
+static inline int genlmsg_total_size(int payload)
+{
+ return NLMSG_ALIGN(genlmsg_msg_size(payload));
+}
+
#endif /* __NET_GENERIC_NETLINK_H */
_
--
Balbir Singh,
Linux Technology Center,
IBM Software Labs
next reply other threads:[~2006-09-11 7:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-11 7:40 Balbir Singh [this message]
2006-09-11 7:40 ` [RFC][PATCH -mm] Fix taskstats size calculation (use the new genetlink utility functions) Balbir Singh
2006-09-11 7:40 ` [RFC][PATCH -mm] Fix getdelays.c - cpumask length and error reporting Balbir Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060911074021.26844.70576.sendpatchset@localhost.localdomain \
--to=balbir@in.ibm.com \
--cc=akpm@osdl.org \
--cc=hadi@cyberus.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=nagar@watson.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox