SHA256
1
0
forked from pool/drbd
drbd/compat-4.7-1dee3f59-align-nla-u64.patch

35 lines
1.3 KiB
Diff
Raw Normal View History

diff -Naur drbd-9.0.2+git.14d2eea.orig/drbd-headers/linux/genl_magic_struct.h drbd-9.0.2+git.14d2eea/drbd-headers/linux/genl_magic_struct.h
--- drbd-9.0.2+git.14d2eea.orig/drbd-headers/linux/genl_magic_struct.h 2016-06-09 08:08:48.682443819 +0800
+++ drbd-9.0.2+git.14d2eea/drbd-headers/linux/genl_magic_struct.h 2016-06-09 21:58:38.138780397 +0800
@@ -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 @@
__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)