lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 Sep 2006 13:10:21 +0530
From:	Balbir Singh <balbir@...ibm.com>
To:	akpm@...l.org
Cc:	Jamal Hadi <hadi@...erus.ca>,
	Shailabh Nagar <nagar@...son.ibm.com>,
	Thomas Graf <tgraf@...g.ch>, netdev@...r.kernel.org,
	Balbir Singh <balbir@...ibm.com>, linux-kernel@...r.kernel.org
Subject: [RFC][PATCH -mm] 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@...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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ