aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/genl_magic_struct.h
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2016-05-09 11:40:20 +0200
committerDavid S. Miller <davem@davemloft.net>2016-05-10 15:43:09 -0400
commit1dee3f59a8d5e711797dc82628aaf94a64e99922 (patch)
treeaa706d4288becef3cab1a39002f52916e0eb7030 /include/linux/genl_magic_struct.h
parentMerge branch 'phy_ksettings' (diff)
downloadlinux-dev-1dee3f59a8d5e711797dc82628aaf94a64e99922.tar.xz
linux-dev-1dee3f59a8d5e711797dc82628aaf94a64e99922.zip
block/drbd: align properly u64 in nl messages
The attribute 0 is never used in drbd, so let's use it as pad attribute in netlink messages. This minimizes the patch. Note that this patch is only compile-tested. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/genl_magic_struct.h')
-rw-r--r--include/linux/genl_magic_struct.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
index eecd19b37001..6270a56e5edc 100644
--- a/include/linux/genl_magic_struct.h
+++ b/include/linux/genl_magic_struct.h
@@ -62,6 +62,11 @@ extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);
/* MAGIC helpers {{{2 */
+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);
+}
+
/* possible field types */
#define __flg_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U8, char, \
@@ -80,7 +85,7 @@ extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);
nla_get_u32, nla_put_u32, true)
#define __u64_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U64, __u64, \
- nla_get_u64, nla_put_u64, false)
+ nla_get_u64, nla_put_u64_0pad, false)
#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)