Repository : ssh://git@open-mesh.org/batman-adv
On branches: master,next
commit 801d51e947da78bc542b30ee8e6971f941f8f66b Author: stephen hemminger stephen@networkplumber.org Date: Sun Oct 9 08:57:30 2016 +0200
batman-adv: make netlink attributes const
Signed-off-by: Stephen Hemminger stephen@networkplumber.org [sven@narfation.org: Add compat-patch script] Signed-off-by: Sven Eckelmann sven@narfation.org
801d51e947da78bc542b30ee8e6971f941f8f66b compat-include/net/genetlink.h | 6 ++++++ compat-patches/replacements.sh | 5 +++++ net/batman-adv/netlink.c | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/compat-include/net/genetlink.h b/compat-include/net/genetlink.h index b48e37a..72a8991 100644 --- a/compat-include/net/genetlink.h +++ b/compat-include/net/genetlink.h @@ -152,6 +152,12 @@ batadv_genl_register_family_with_ops_grps(struct genl_family *family, return batadv_genl_register_family(family); }
+#define __genl_const + +#else + +#define __genl_const const + #endif /* < KERNEL_VERSION(3, 13, 0) */
#endif /* _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_ */ diff --git a/compat-patches/replacements.sh b/compat-patches/replacements.sh index c7875c0..669b0ff 100755 --- a/compat-patches/replacements.sh +++ b/compat-patches/replacements.sh @@ -1,3 +1,8 @@ #! /bin/sh
set -e + +# for kernel < 3.13 to make netlink compat code work +sed -i \ + -e 's/^static const struct genl_multicast_group batadv_netlink_mcgrps/static __genl_const struct genl_multicast_group batadv_netlink_mcgrps/' \ + build/net/batman-adv/netlink.c diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 18831e7..64cb6ac 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -62,11 +62,11 @@ enum batadv_netlink_multicast_groups { BATADV_NL_MCGRP_TPMETER, };
-static struct genl_multicast_group batadv_netlink_mcgrps[] = { +static const struct genl_multicast_group batadv_netlink_mcgrps[] = { [BATADV_NL_MCGRP_TPMETER] = { .name = BATADV_NL_MCAST_GROUP_TPMETER }, };
-static struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { +static const struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { [BATADV_ATTR_VERSION] = { .type = NLA_STRING }, [BATADV_ATTR_ALGO_NAME] = { .type = NLA_STRING }, [BATADV_ATTR_MESH_IFINDEX] = { .type = NLA_U32 },