[next,v2,03/11] batman-adv: make netlink attributes const

Message ID 20161009065738.8279-3-sven@narfation.org (mailing list archive)
State Accepted, archived
Delegated to: Marek Lindner
Headers

Commit Message

Sven Eckelmann Oct. 9, 2016, 6:57 a.m. UTC
  From: stephen hemminger <stephen@networkplumber.org>

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
[sven@narfation.org: Add compat-patch script]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - remove second replacement line which basically does nothing
   (thanks Linus)
---
 compat-patches/replacements.sh | 5 +++++
 net/batman-adv/netlink.c       | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
  

Comments

Sven Eckelmann Oct. 18, 2016, 11:36 a.m. UTC | #1
On Sonntag, 9. Oktober 2016 08:57:30 CEST Sven Eckelmann wrote:
> From: stephen hemminger <stephen@networkplumber.org>
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> [sven@narfation.org: Add compat-patch script]
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> v2:
>  - remove second replacement line which basically does nothing
>    (thanks Linus)
> ---
>  compat-patches/replacements.sh | 5 +++++
>  net/batman-adv/netlink.c       | 4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)

Applied in 801d51e947da78bc542b30ee8e6971f941f8f66b [1]. It was slightly
modified to use __genl_const from https://patchwork.open-mesh.org/patch/16730/

Kind regards,
	Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/801d51e947da78bc542b30ee8e6971f941f8f66b
  

Patch

diff --git a/compat-patches/replacements.sh b/compat-patches/replacements.sh
index c7875c0..4439a0d 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 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 },