[Drbd-dev] [PATCH-drbd9] compat: align nla_put_u64

Nick Wang nwang at suse.com
Thu Jun 9 16:39:49 CEST 2016


In v4.7(1dee3f59), nla_put_u64 is removed, using
nla_put_u64_0pad for drbd instead.
Change header from linux/netlink.h to net/netlink.h
for nla_put_64bit.

Signed-off-by: Nick Wang <nwang at suse.com>

CC: Philipp Reisner <philipp.reisner at linbit.com>
CC: Lars Ellenberg <lars.ellenberg at linbit.com>
CC: drbd-dev at lists.linbit.com
---
 linux/genl_magic_struct.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/linux/genl_magic_struct.h b/linux/genl_magic_struct.h
index eb7140b..9586779 100644
--- a/linux/genl_magic_struct.h
+++ b/linux/genl_magic_struct.h
@@ -13,7 +13,7 @@
 # error "you need to define GENL_MAGIC_INCLUDE_FILE before inclusion"
 #endif
 
-#include <linux/netlink.h>
+#include <net/netlink.h>
 #include <linux/genetlink.h>
 #include <linux/types.h>
 #include "compat.h"
@@ -86,9 +86,21 @@ extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);
 	__field(attr_nr, attr_flag, name, NLA_U32, __s32, \
 			nla_get_u32, nla_put_u32, true)
 #endif
+#ifdef COMPAT_HAVE_ALIGNED_NLA_U64_PAD
 #define __u64_field(attr_nr, attr_flag, name)	\
 	__field(attr_nr, attr_flag, name, NLA_U64, __u64, \
 			nla_get_u64, nla_put_u64, false)
+#else
+
+static inline int nla_put_u64_0pad(struct sk_buff *skb, int attrtype, u64 value)
+{
+       return nla_put_64bit(skb, attrtype, sizeof(u64), &value, 0);
+}
+
+#define __u64_field(attr_nr, attr_flag, name)	\
+	__field(attr_nr, attr_flag, name, NLA_U64, __u64, \
+			nla_get_u64, nla_put_u64_0pad, false)
+#endif
 #define __str_field(attr_nr, attr_flag, name, maxlen) \
 	__array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \
 			nla_strlcpy, nla_put, false)
-- 
1.8.5.6



More information about the drbd-dev mailing list