b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches
@ 2016-10-09  6:56 Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 01/11] batman-adv: Introduce compat-patches support Sven Eckelmann
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:56 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]

Hi,

some patches (like patch 3+4) require special code modifications that cannot 
be handled (reasonable) with the compat headers. One of these patches (3) is 
already in linux-next and thus should also be in batman-adv.git.

I am proposing in this patchset two different solutions. The first one is the 
easiest and most likely the best for the upcoming release. It uses a simple 
shell script to patch the problematic lines in a copy of the source code. The 
second solution uses parts of the first solution but replaces the simple shell 
script with unified and semantic patch files. Patch 5-11 should therefore be 
used as an example how coccinelle/spatch can be used to clean up some of the 
"interesting" hacks in the compat headers.

Changes in v2:

 - remove second replacement.sh line which basically does nothing
   (thanks Linus)
 - added patch 4 to also mark batadv_netlink_ops as const
 - introduce patch 5-11 to show usage of coccinelle
   (I personally recommend patch 9 to get familiar with the idea)

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH next v2 01/11] batman-adv: Introduce compat-patches support
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-18 11:34   ` [B.A.T.M.A.N.] [next, v2, " Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 02/11] batman-adv: Use simple script to patch minor compat problems Sven Eckelmann
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

compat-includes/compat.h can usually be used to solve compatibility
problems with older kernels. This works well for functions, defines/enums
and sometimes even structures that were introduced.

But this can fail when structs changed. Some of these can be solved in
crude ways but sometimes it is unavoidable to have a version specific code.
Unfortunately, this kind of code is not acceptable in the kernel and thus
the compat infrastructure of the external module has to do add it
automatically before the source is compiled.

This process works by creating a build directory which is prefilled with
the source from net/batman-adv/. The patches from compat-patches/ will be
applied on top of this copy and then the code is compiled.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - no change
---
 .gitignore              | 10 ++++------
 Makefile                | 31 +++++++++++++++++++++++++++----
 compat-patches/README   | 23 +++++++++++++++++++++++
 compat-sources/Makefile |  6 +++---
 4 files changed, 57 insertions(+), 13 deletions(-)
 create mode 100644 compat-patches/README

diff --git a/.gitignore b/.gitignore
index 4c03561..15a99aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,8 @@
+/build/
 /compat-autoconf.h
 /compat-autoconf.h.tmp
 /compat-sources/**/.*
 /compat-sources/**/*.o
-/net/batman-adv/.*
-/net/batman-adv/batman-adv.ko
-/net/batman-adv/batman-adv.mod.c
-/net/batman-adv/modules.order
-/net/batman-adv/Module.symvers
-/net/batman-adv/*.o
+/modules.order
+/Module.symvers
+/.tmp_versions
diff --git a/Makefile b/Makefile
index d42bb56..b105290 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,7 @@ export CONFIG_BATMAN_ADV_MCAST=y
 export CONFIG_BATMAN_ADV_BATMAN_V=n
 
 PWD:=$(shell pwd)
+BUILD_DIR=$(PWD)/build
 KERNELPATH ?= /lib/modules/$(shell uname -r)/build
 # sanity check: does KERNELPATH exist?
 ifeq ($(shell cd $(KERNELPATH) && pwd),)
@@ -41,6 +42,14 @@ endif
 
 export KERNELPATH
 RM ?= rm -f
+MKDIR := mkdir -p
+PATCH_FLAGS = --batch --fuzz=0 --forward --strip=1 --unified --version-control=never -g0 --remove-empty-files --no-backup-if-mismatch --reject-file=-
+PATCH := patch $(PATCH_FLAGS) -i
+CP := cp -fpR
+
+SOURCE = $(wildcard net/batman-adv/*.[ch]) net/batman-adv/Makefile
+SOURCE_BUILD = $(wildcard $(BUILD_DIR)/net/batman-adv/*.[ch]) $(BUILD_DIR)/net/batman-adv/Makefile
+SOURCE_STAMP = $(BUILD_DIR)/net/batman-adv/.compat-prepared
 
 REVISION= $(shell	if [ -d "$(PWD)/.git" ]; then \
 				echo $$(git --git-dir="$(PWD)/.git" describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
@@ -57,7 +66,7 @@ endif
 
 include $(PWD)/compat-sources/Makefile
 
-obj-y += net/batman-adv/
+obj-y += build/net/batman-adv/
 
 export batman-adv-y
 
@@ -76,18 +85,32 @@ BUILD_FLAGS := \
 	CONFIG_BATMAN_ADV_BATMAN_V=$(CONFIG_BATMAN_ADV_BATMAN_V) \
 	INSTALL_MOD_DIR=updates/
 
-all: config
+all: config $(SOURCE_STAMP)
 	$(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS)	modules
 
 clean:
 	$(RM) compat-autoconf.h*
-	$(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) clean
+	$(RM) -r $(BUILD_DIR)
 
-install: config
+install: config $(SOURCE_STAMP)
 	$(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) modules_install
 	depmod -a
 
 config:
 	$(PWD)/gen-compat-autoconf.sh $(PWD)/compat-autoconf.h
 
+$(SOURCE_STAMP): $(SOURCE) compat-patches/*
+	$(MKDIR) $(BUILD_DIR)/net/batman-adv/
+	@$(RM) $(SOURCE_BUILD)
+	@$(CP) $(SOURCE) $(BUILD_DIR)/net/batman-adv/
+	@set -e; \
+	patches="$$(ls -1 compat-patches/|grep '.patch$$'|sort)"; \
+	for i in $${patches}; do \
+		echo '  COMPAT_PATCH '$${i};\
+		cd $(BUILD_DIR); \
+		$(PATCH) ../compat-patches/$${i}; \
+		cd - > /dev/null; \
+	done
+	touch $(SOURCE_STAMP)
+
 .PHONY: all clean install config
diff --git a/compat-patches/README b/compat-patches/README
new file mode 100644
index 0000000..3bbddb3
--- /dev/null
+++ b/compat-patches/README
@@ -0,0 +1,23 @@
+WARNING
+=======
+
+Please avoid using the compat-patches/ to implement support for old kernels.
+This should be the last resort.
+
+ * it is nearly always possible to use compat-includes/ to do the same with a
+   lot less problems
+
+ * maintaining these patches is *censored*
+
+GENERATING A PATCH
+==================
+
+If it not possible to avoid a patch then please make the patch as small as
+possible. Even refactor the code which has to be patched to reduce the
+size/number of the changes.
+
+Please use git-format-patches to generate them and order same inside via the
+XXXX- prefix of the patch name.
+
+    git format-patch --abbrev=7 -U3 --diff-algorithm=histogram --no-signature \
+	--format=format:'From: %an <%ae>%nDate: %aD%nSubject: [PATCH] %B' -1
diff --git a/compat-sources/Makefile b/compat-sources/Makefile
index a45c202..c8bae49 100644
--- a/compat-sources/Makefile
+++ b/compat-sources/Makefile
@@ -1,3 +1,3 @@
-batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../compat-sources/net/core/skbuff.o
-batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../compat-sources/net/ipv4/igmp.o
-batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../compat-sources/net/ipv6/mcast_snoop.o
+batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../../compat-sources/net/core/skbuff.o
+batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../../compat-sources/net/ipv4/igmp.o
+batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../../compat-sources/net/ipv6/mcast_snoop.o
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH next v2 02/11] batman-adv: Use simple script to patch minor compat problems
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 01/11] batman-adv: Introduce compat-patches support Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-18 11:35   ` [B.A.T.M.A.N.] [next, v2, " Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 03/11] batman-adv: make netlink attributes const Sven Eckelmann
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

Unified diff base patches have the problem that they fix only a single line
and depend on the surrounding. This approach can fail relative often when
the surrounding code will be changed often. Thus semantic patches (like
spatch from coccinelle) or simple find+replace scripts are better for this
approach.

Introduce a simple script file which will store these kind of find+replace
instructions.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - no change
---
 Makefile                       | 3 ++-
 compat-patches/replacements.sh | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100755 compat-patches/replacements.sh

diff --git a/Makefile b/Makefile
index b105290..7ef2569 100644
--- a/Makefile
+++ b/Makefile
@@ -99,7 +99,7 @@ install: config $(SOURCE_STAMP)
 config:
 	$(PWD)/gen-compat-autoconf.sh $(PWD)/compat-autoconf.h
 
-$(SOURCE_STAMP): $(SOURCE) compat-patches/*
+$(SOURCE_STAMP): $(SOURCE) compat-patches/* compat-patches/replacements.sh
 	$(MKDIR) $(BUILD_DIR)/net/batman-adv/
 	@$(RM) $(SOURCE_BUILD)
 	@$(CP) $(SOURCE) $(BUILD_DIR)/net/batman-adv/
@@ -111,6 +111,7 @@ $(SOURCE_STAMP): $(SOURCE) compat-patches/*
 		$(PATCH) ../compat-patches/$${i}; \
 		cd - > /dev/null; \
 	done
+	compat-patches/replacements.sh
 	touch $(SOURCE_STAMP)
 
 .PHONY: all clean install config
diff --git a/compat-patches/replacements.sh b/compat-patches/replacements.sh
new file mode 100755
index 0000000..c7875c0
--- /dev/null
+++ b/compat-patches/replacements.sh
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+set -e
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH next v2 03/11] batman-adv: make netlink attributes const
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 01/11] batman-adv: Introduce compat-patches support Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 02/11] batman-adv: Use simple script to patch minor compat problems Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-18 11:36   ` [B.A.T.M.A.N.] [next, v2, " Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 04/11] batman-adv: Mark batadv_netlink_ops as const Sven Eckelmann
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

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(-)

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 },
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH v2 04/11] batman-adv: Mark batadv_netlink_ops as const
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
                   ` (2 preceding siblings ...)
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 03/11] batman-adv: make netlink attributes const Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 05/11] batman-adv: Add support for coccinelle in compat-patches Sven Eckelmann
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

The genl_ops don't need to be written by anyone and thus can be moved in a
ro memory range.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - new patch
---
 compat-patches/replacements.sh | 1 +
 net/batman-adv/netlink.c       | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat-patches/replacements.sh b/compat-patches/replacements.sh
index 4439a0d..fc4de84 100755
--- a/compat-patches/replacements.sh
+++ b/compat-patches/replacements.sh
@@ -5,4 +5,5 @@ 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/' \
+	-e 's/^static const struct genl_ops batadv_netlink_ops/static struct genl_ops batadv_netlink_ops/' \
 	build/net/batman-adv/netlink.c
diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
index 64cb6ac..aee20a3 100644
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -534,7 +534,7 @@ batadv_netlink_dump_hardifs(struct sk_buff *msg, struct netlink_callback *cb)
 	return msg->len;
 }
 
-static struct genl_ops batadv_netlink_ops[] = {
+static const struct genl_ops batadv_netlink_ops[] = {
 	{
 		.cmd = BATADV_CMD_GET_MESH_INFO,
 		.flags = GENL_ADMIN_PERM,
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH v2 05/11] batman-adv: Add support for coccinelle in compat-patches
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
                   ` (3 preceding siblings ...)
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 04/11] batman-adv: Mark batadv_netlink_ops as const Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 06/11] batman-adv: compat: Port netlink port hack to coccinelle Sven Eckelmann
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

The kernel and backports already uses spatch from coccinelle for
development and backporting purposes. Thus we can cleanup many current
hacks using semantic patches. These are also a lot less frail than
traditional unified diffs.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - new patch
---
 Makefile | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 7ef2569..99e67da 100644
--- a/Makefile
+++ b/Makefile
@@ -40,11 +40,19 @@ ifeq ($(shell cd $(KERNELPATH) && pwd),)
 $(warning $(KERNELPATH) is missing, please set KERNELPATH)
 endif
 
+ifeq ($(origin SPATCH), undefined)
+  SPATCH = spatch
+  ifeq ($(shell which $(SPATCH) 2>/dev/null),)
+    $(error $(SPATCH) (coccinelle) not found)
+  endif
+endif
+
 export KERNELPATH
 RM ?= rm -f
 MKDIR := mkdir -p
 PATCH_FLAGS = --batch --fuzz=0 --forward --strip=1 --unified --version-control=never -g0 --remove-empty-files --no-backup-if-mismatch --reject-file=-
 PATCH := patch $(PATCH_FLAGS) -i
+SPATCH_FLAGS := --in-place --relax-include-path --use-coccigrep
 CP := cp -fpR
 
 SOURCE = $(wildcard net/batman-adv/*.[ch]) net/batman-adv/Makefile
@@ -104,12 +112,17 @@ $(SOURCE_STAMP): $(SOURCE) compat-patches/* compat-patches/replacements.sh
 	@$(RM) $(SOURCE_BUILD)
 	@$(CP) $(SOURCE) $(BUILD_DIR)/net/batman-adv/
 	@set -e; \
-	patches="$$(ls -1 compat-patches/|grep '.patch$$'|sort)"; \
+	patches="$$(ls -1 compat-patches/|grep -e '.patch$$' -e '.cocci$$'|sort)"; \
 	for i in $${patches}; do \
-		echo '  COMPAT_PATCH '$${i};\
-		cd $(BUILD_DIR); \
-		$(PATCH) ../compat-patches/$${i}; \
-		cd - > /dev/null; \
+		echo '  COMPAT_PATCH '$${i}; \
+		if echo $${i}|grep '.patch$$'; then \
+			cd $(BUILD_DIR); \
+			$(PATCH) ../compat-patches/$${i}; \
+			cd - > /dev/null; \
+		fi; \
+		if echo $${i}|grep '.cocci$$'; then echo $$(pwd); \
+			$(SPATCH) $(SPATCH_FLAGS) --dir $(BUILD_DIR) --sp-file compat-patches/$${i} > /dev/null; \
+		fi; \
 	done
 	compat-patches/replacements.sh
 	touch $(SOURCE_STAMP)
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH v2 06/11] batman-adv: compat: Port netlink port hack to coccinelle
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
                   ` (4 preceding siblings ...)
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 05/11] batman-adv: Add support for coccinelle in compat-patches Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 07/11] batman-adv: compat: Move netlink const compat " Sven Eckelmann
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - new patch
---
 compat-include/linux/netlink.h           | 20 +++++++-------------
 compat-include/net/genetlink.h           | 11 +++++++++++
 compat-patches/0001-netlink-portid.cocci | 17 +++++++++++++++++
 compat.h                                 |  6 ------
 4 files changed, 35 insertions(+), 19 deletions(-)
 create mode 100644 compat-patches/0001-netlink-portid.cocci

diff --git a/compat-include/linux/netlink.h b/compat-include/linux/netlink.h
index 4f2185d..ca2bdf0 100644
--- a/compat-include/linux/netlink.h
+++ b/compat-include/linux/netlink.h
@@ -26,19 +26,13 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
 
-#include <net/scm.h>
-
-struct batadv_netlink_skb_parms {
-	struct ucred		creds;		/* Skb credentials	*/
-	union {
-		__u32		portid;
-		__u32		pid;
-	};
-	__u32			dst_group;
-};
-
-#undef NETLINK_CB
-#define NETLINK_CB(skb) (*(struct batadv_netlink_skb_parms *)&((skb)->cb))
+#define netlink_notify_portid(__notify) (__notify->pid)
+#define NETLINK_CB_PORTID(__skb) NETLINK_CB(__skb).pid
+
+#else
+
+#define netlink_notify_portid(__notify) (__notify->portid)
+#define NETLINK_CB_PORTID(__skb) NETLINK_CB(__skb).portid
 
 #endif /* < KERNEL_VERSION(3, 7, 0) */
 
diff --git a/compat-include/net/genetlink.h b/compat-include/net/genetlink.h
index b48e37a..19390c7 100644
--- a/compat-include/net/genetlink.h
+++ b/compat-include/net/genetlink.h
@@ -24,6 +24,17 @@
 #include <linux/version.h>
 #include_next <net/genetlink.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
+
+#define genl_info_snd_portid(__genl_info) (__genl_info->snd_pid)
+
+#else
+
+#define genl_info_snd_portid(__genl_info) (__genl_info->snd_portid)
+
+#endif /* < KERNEL_VERSION(3, 7, 0) */
+
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
 
 #include <linux/export.h>
diff --git a/compat-patches/0001-netlink-portid.cocci b/compat-patches/0001-netlink-portid.cocci
new file mode 100644
index 0000000..5fc504e
--- /dev/null
+++ b/compat-patches/0001-netlink-portid.cocci
@@ -0,0 +1,17 @@
+@@
+struct netlink_notify *notify;
+@@
+-notify->portid
++netlink_notify_portid(notify)
+
+@@
+struct genl_info *info;
+@@
+-info->snd_portid
++genl_info_snd_portid(info)
+
+@@
+expression skb;
+@@
+-NETLINK_CB(skb).portid
++NETLINK_CB_PORTID(skb)
diff --git a/compat.h b/compat.h
index d987577..78de7ea 100644
--- a/compat.h
+++ b/compat.h
@@ -67,12 +67,6 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
 
 #endif /* < KERNEL_VERSION(3, 3, 0) */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-
-#define snd_portid snd_pid
-
-#endif /* < KERNEL_VERSION(3, 7, 0) */
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
 
 #define batadv_interface_set_mac_addr(x, y) \
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH v2 07/11] batman-adv: compat: Move netlink const compat to coccinelle
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
                   ` (5 preceding siblings ...)
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 06/11] batman-adv: compat: Port netlink port hack to coccinelle Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 08/11] batman-adv: compat: Remove replacement script Sven Eckelmann
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - new patch
---
 compat-include/net/genetlink.h       |  6 ++++++
 compat-patches/0002-genl-const.INFO  | 15 +++++++++++++++
 compat-patches/0002-genl-const.cocci | 10 ++++++++++
 compat-patches/replacements.sh       |  9 ---------
 4 files changed, 31 insertions(+), 9 deletions(-)
 create mode 100644 compat-patches/0002-genl-const.INFO
 create mode 100644 compat-patches/0002-genl-const.cocci
 delete mode 100755 compat-patches/replacements.sh

diff --git a/compat-include/net/genetlink.h b/compat-include/net/genetlink.h
index 19390c7..6a287e6 100644
--- a/compat-include/net/genetlink.h
+++ b/compat-include/net/genetlink.h
@@ -163,6 +163,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/0002-genl-const.INFO b/compat-patches/0002-genl-const.INFO
new file mode 100644
index 0000000..192c5c6
--- /dev/null
+++ b/compat-patches/0002-genl-const.INFO
@@ -0,0 +1,15 @@
+Newer kernels make generic netlink ops and multicast groups
+const, but older can't have that. We therefore introduce
+__genl_const, which can be defined depending on the kernel.
+
+What kernel versions require this?
+
+XXX: try to SmPLify
+
+The struct genl_ops gave the *option* to make it const via:
+mcgrof@ergon ~/linux (git::master)$ git describe --contains f84f771d9
+v3.13-rc1~33^2~32^2~2
+
+The struct genl_multicast_group was *forced* to be const via:
+mcgrof@ergon ~/linux (git::master)$ git describe --contains 2a94fe48f
+v3.13-rc1~33^2^2
diff --git a/compat-patches/0002-genl-const.cocci b/compat-patches/0002-genl-const.cocci
new file mode 100644
index 0000000..36c71d6
--- /dev/null
+++ b/compat-patches/0002-genl-const.cocci
@@ -0,0 +1,10 @@
+@@
+attribute __genl_const;
+@@
+(
+-const struct genl_multicast_group
++__genl_const struct genl_multicast_group
+|
+-const struct genl_ops
++__genl_const struct genl_ops
+)
diff --git a/compat-patches/replacements.sh b/compat-patches/replacements.sh
deleted file mode 100755
index fc4de84..0000000
--- a/compat-patches/replacements.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /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/' \
-	-e 's/^static const struct genl_ops batadv_netlink_ops/static struct genl_ops batadv_netlink_ops/' \
-	build/net/batman-adv/netlink.c
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH v2 08/11] batman-adv: compat: Remove replacement script
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
                   ` (6 preceding siblings ...)
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 07/11] batman-adv: compat: Move netlink const compat " Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 09/11] batman-adv: compat: Replace IFF_NO_QUEUE with coccinelle Sven Eckelmann
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - new patch
---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 99e67da..7eea0ab 100644
--- a/Makefile
+++ b/Makefile
@@ -107,7 +107,7 @@ install: config $(SOURCE_STAMP)
 config:
 	$(PWD)/gen-compat-autoconf.sh $(PWD)/compat-autoconf.h
 
-$(SOURCE_STAMP): $(SOURCE) compat-patches/* compat-patches/replacements.sh
+$(SOURCE_STAMP): $(SOURCE) compat-patches/*
 	$(MKDIR) $(BUILD_DIR)/net/batman-adv/
 	@$(RM) $(SOURCE_BUILD)
 	@$(CP) $(SOURCE) $(BUILD_DIR)/net/batman-adv/
@@ -124,7 +124,6 @@ $(SOURCE_STAMP): $(SOURCE) compat-patches/* compat-patches/replacements.sh
 			$(SPATCH) $(SPATCH_FLAGS) --dir $(BUILD_DIR) --sp-file compat-patches/$${i} > /dev/null; \
 		fi; \
 	done
-	compat-patches/replacements.sh
 	touch $(SOURCE_STAMP)
 
 .PHONY: all clean install config
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH v2 09/11] batman-adv: compat: Replace IFF_NO_QUEUE with coccinelle
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
                   ` (7 preceding siblings ...)
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 08/11] batman-adv: compat: Remove replacement script Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 10/11] batman-adv: compat: Move get_link_net patch to coccinelle Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 11/11] batman-adv: compat: Move vid api wrapper " Sven Eckelmann
  10 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - new patch
---
 compat-patches/0003-iff-no-queue.cocci | 9 +++++++++
 compat.h                               | 6 ------
 2 files changed, 9 insertions(+), 6 deletions(-)
 create mode 100644 compat-patches/0003-iff-no-queue.cocci

diff --git a/compat-patches/0003-iff-no-queue.cocci b/compat-patches/0003-iff-no-queue.cocci
new file mode 100644
index 0000000..9c95b85
--- /dev/null
+++ b/compat-patches/0003-iff-no-queue.cocci
@@ -0,0 +1,9 @@
+@@
+expression E;
+@@
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
+ E->priv_flags |= IFF_NO_QUEUE;
++#else
++E->tx_queue_len = 0;
++#endif
diff --git a/compat.h b/compat.h
index 78de7ea..245621f 100644
--- a/compat.h
+++ b/compat.h
@@ -152,10 +152,4 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
 
 #endif /* < KERNEL_VERSION(4, 0, 0) */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
-
-#define IFF_NO_QUEUE	0; dev->tx_queue_len = 0
-
-#endif /* < KERNEL_VERSION(4, 3, 0) */
-
 #endif /* _NET_BATMAN_ADV_COMPAT_H_ */
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH v2 10/11] batman-adv: compat: Move get_link_net patch to coccinelle
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
                   ` (8 preceding siblings ...)
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 09/11] batman-adv: compat: Replace IFF_NO_QUEUE with coccinelle Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 11/11] batman-adv: compat: Move vid api wrapper " Sven Eckelmann
  10 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - new patch
---
 compat-patches/0004-get_link_net.cocci | 13 +++++++++++++
 compat.h                               |  7 -------
 2 files changed, 13 insertions(+), 7 deletions(-)
 create mode 100644 compat-patches/0004-get_link_net.cocci

diff --git a/compat-patches/0004-get_link_net.cocci b/compat-patches/0004-get_link_net.cocci
new file mode 100644
index 0000000..1ae3192
--- /dev/null
+++ b/compat-patches/0004-get_link_net.cocci
@@ -0,0 +1,13 @@
+@@
+identifier netdev, fallback_net;
+@@
+
+ static const struct net *batadv_getlink_net(const struct net_device *netdev,
+ 				             const struct net *fallback_net)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
++	return fallback_net;
++#else
+ ...
++#endif
+ }
diff --git a/compat.h b/compat.h
index 245621f..2865eeb 100644
--- a/compat.h
+++ b/compat.h
@@ -145,11 +145,4 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
 
 #endif /* < KERNEL_VERSION(3, 15, 0) */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
-
-/* WARNING for batadv_getlink_net */
-#define get_link_net get_xstats_size || 1 || netdev->rtnl_link_ops->get_xstats_size
-
-#endif /* < KERNEL_VERSION(4, 0, 0) */
-
 #endif /* _NET_BATMAN_ADV_COMPAT_H_ */
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [B.A.T.M.A.N.] [PATCH v2 11/11] batman-adv: compat: Move vid api wrapper to coccinelle
  2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
                   ` (9 preceding siblings ...)
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 10/11] batman-adv: compat: Move get_link_net patch to coccinelle Sven Eckelmann
@ 2016-10-09  6:57 ` Sven Eckelmann
  10 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-09  6:57 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
 - new patch
---
 compat-include/linux/netdevice.h        |  6 +++
 compat-patches/0005-vid-callbacks.cocci | 74 +++++++++++++++++++++++++++++++++
 compat.h                                | 54 ------------------------
 3 files changed, 80 insertions(+), 54 deletions(-)
 create mode 100644 compat-patches/0005-vid-callbacks.cocci

diff --git a/compat-include/linux/netdevice.h b/compat-include/linux/netdevice.h
index fb5b519..0de9d78 100644
--- a/compat-include/linux/netdevice.h
+++ b/compat-include/linux/netdevice.h
@@ -28,6 +28,12 @@
 
 #include <linux/netdev_features.h>
 
+#define __vid_api_returntype void
+
+#else
+
+#define __vid_api_returntype int
+
 #endif /* < KERNEL_VERSION(3, 3, 0) */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
diff --git a/compat-patches/0005-vid-callbacks.cocci b/compat-patches/0005-vid-callbacks.cocci
new file mode 100644
index 0000000..2cebc0e
--- /dev/null
+++ b/compat-patches/0005-vid-callbacks.cocci
@@ -0,0 +1,74 @@
+@ add_assignment @
+identifier batadv_interface_add_vid, batadv_netdev_ops;
+@@
+
+ struct net_device_ops batadv_netdev_ops = {
+ 	.ndo_vlan_rx_add_vid = batadv_interface_add_vid,
+ };
+
+@ kill_assignment @
+identifier batadv_interface_kill_vid, batadv_netdev_ops;
+@@
+
+ struct net_device_ops batadv_netdev_ops = {
+ 	.ndo_vlan_rx_kill_vid = batadv_interface_kill_vid,
+ };
+
+@ add_vid @
+identifier add_assignment.batadv_interface_add_vid;
+type be16;
+identifier dev, proto, vid;
+@@
+
+-batadv_interface_add_vid
++batadv_interface_add_vid_orig
+			       (struct net_device *dev, be16 proto,
+				unsigned short vid)
+ { ... }
+
++static __vid_api_returntype batadv_interface_add_vid(struct net_device *dev,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++			   			      be16 proto,
++#endif
++			   			      unsigned short vid)
++{
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
++    be16 proto = htons(ETH_P_8021Q);
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
++	batadv_interface_add_vid_orig(dev, proto, vid);
++#else
++	return batadv_interface_add_vid_orig(dev, proto, vid);
++#endif
++}
+
+
+@ kill_vid @
+identifier kill_assignment.batadv_interface_kill_vid;
+type be16;
+identifier dev, proto, vid;
+@@
+
+-batadv_interface_kill_vid
++batadv_interface_kill_vid_orig
+			       (struct net_device *dev, be16 proto,
+				unsigned short vid)
+ { ... }
+
++static __vid_api_returntype batadv_interface_kill_vid(struct net_device *dev,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++			   			       be16 proto,
++#endif
++			   			       unsigned short vid)
++{
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
++    be16 proto = htons(ETH_P_8021Q);
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
++	batadv_interface_kill_vid_orig(dev, proto, vid);
++#else
++	return batadv_interface_kill_vid_orig(dev, proto, vid);
++#endif
++}
diff --git a/compat.h b/compat.h
index 2865eeb..d59fb5f 100644
--- a/compat.h
+++ b/compat.h
@@ -42,31 +42,6 @@
 
 #endif /* < KERNEL_VERSION(3, 9, 0) */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
-
-#define batadv_interface_add_vid(x, y, z) \
-__batadv_interface_add_vid(struct net_device *dev, __be16 proto,\
-                          unsigned short vid);\
-static void batadv_interface_add_vid(struct net_device *dev, unsigned short vid)\
-{\
-       __batadv_interface_add_vid(dev, htons(ETH_P_8021Q), vid);\
-}\
-static int __batadv_interface_add_vid(struct net_device *dev, __be16 proto,\
-                                     unsigned short vid)
-
-#define batadv_interface_kill_vid(x, y, z) \
-__batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
-                           unsigned short vid);\
-static void batadv_interface_kill_vid(struct net_device *dev,\
-                                     unsigned short vid)\
-{\
-       __batadv_interface_kill_vid(dev, htons(ETH_P_8021Q), vid);\
-}\
-static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
-                                      unsigned short vid)
-
-#endif /* < KERNEL_VERSION(3, 3, 0) */
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
 
 #define batadv_interface_set_mac_addr(x, y) \
@@ -95,35 +70,6 @@ static int __batadv_interface_tx(struct sk_buff *skb, \
 
 #endif /* < KERNEL_VERSION(3, 9, 0) */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
-
-#define batadv_interface_add_vid(x, y, z) \
-__batadv_interface_add_vid(struct net_device *dev, __be16 proto,\
-			   unsigned short vid);\
-static int batadv_interface_add_vid(struct net_device *dev, unsigned short vid)\
-{\
-	return __batadv_interface_add_vid(dev, htons(ETH_P_8021Q), vid);\
-}\
-static int __batadv_interface_add_vid(struct net_device *dev, __be16 proto,\
-				      unsigned short vid)
-
-#define batadv_interface_kill_vid(x, y, z) \
-__batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
-			    unsigned short vid);\
-static int batadv_interface_kill_vid(struct net_device *dev,\
-				     unsigned short vid)\
-{\
-	return __batadv_interface_kill_vid(dev, htons(ETH_P_8021Q), vid);\
-}\
-static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
-				       unsigned short vid)
-
-#endif /* >= KERNEL_VERSION(3, 3, 0) */
-
-#endif /* < KERNEL_VERSION(3, 10, 0) */
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
 
 /* the expected behaviour of this function is to return 0 on success, therefore
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] [next, v2, 01/11] batman-adv: Introduce compat-patches support
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 01/11] batman-adv: Introduce compat-patches support Sven Eckelmann
@ 2016-10-18 11:34   ` Sven Eckelmann
  0 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-18 11:34 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]

On Sonntag, 9. Oktober 2016 08:57:28 CEST Sven Eckelmann wrote:
> compat-includes/compat.h can usually be used to solve compatibility
> problems with older kernels. This works well for functions, defines/enums
> and sometimes even structures that were introduced.
> 
> But this can fail when structs changed. Some of these can be solved in
> crude ways but sometimes it is unavoidable to have a version specific code.
> Unfortunately, this kind of code is not acceptable in the kernel and thus
> the compat infrastructure of the external module has to do add it
> automatically before the source is compiled.
> 
> This process works by creating a build directory which is prefilled with
> the source from net/batman-adv/. The patches from compat-patches/ will be
> applied on top of this copy and then the code is compiled.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> v2:
>  - no change
> ---
>  .gitignore              | 10 ++++------
>  Makefile                | 31 +++++++++++++++++++++++++++----
>  compat-patches/README   | 23 +++++++++++++++++++++++
>  compat-sources/Makefile |  6 +++---
>  4 files changed, 57 insertions(+), 13 deletions(-)
>  create mode 100644 compat-patches/README

Applied in 66ac14a09445b6066de6a8ae4382d8f981466ae3 [1].

Kind regards,
	Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/66ac14a09445b6066de6a8ae4382d8f981466ae3

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] [next, v2, 02/11] batman-adv: Use simple script to patch minor compat problems
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 02/11] batman-adv: Use simple script to patch minor compat problems Sven Eckelmann
@ 2016-10-18 11:35   ` Sven Eckelmann
  0 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-18 11:35 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 926 bytes --]

On Sonntag, 9. Oktober 2016 08:57:29 CEST Sven Eckelmann wrote:
> Unified diff base patches have the problem that they fix only a single line
> and depend on the surrounding. This approach can fail relative often when
> the surrounding code will be changed often. Thus semantic patches (like
> spatch from coccinelle) or simple find+replace scripts are better for this
> approach.
> 
> Introduce a simple script file which will store these kind of find+replace
> instructions.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> v2:
>  - no change
> ---
>  Makefile                       | 3 ++-
>  compat-patches/replacements.sh | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)
>  create mode 100755 compat-patches/replacements.sh

Applied in 17018a99bc68f49ea1da199c9c1b290e3b2c42ed [1].

Kind regards,
	Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/17018a99bc68f49ea1da199c9c1b290e3b2c42ed

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [B.A.T.M.A.N.] [next, v2, 03/11] batman-adv: make netlink attributes const
  2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 03/11] batman-adv: make netlink attributes const Sven Eckelmann
@ 2016-10-18 11:36   ` Sven Eckelmann
  0 siblings, 0 replies; 15+ messages in thread
From: Sven Eckelmann @ 2016-10-18 11:36 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 796 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-10-18 11:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-09  6:56 [B.A.T.M.A.N.] [PATCH v2 0/11] batman-adv: Support for complex compat patches Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 01/11] batman-adv: Introduce compat-patches support Sven Eckelmann
2016-10-18 11:34   ` [B.A.T.M.A.N.] [next, v2, " Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 02/11] batman-adv: Use simple script to patch minor compat problems Sven Eckelmann
2016-10-18 11:35   ` [B.A.T.M.A.N.] [next, v2, " Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH next v2 03/11] batman-adv: make netlink attributes const Sven Eckelmann
2016-10-18 11:36   ` [B.A.T.M.A.N.] [next, v2, " Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 04/11] batman-adv: Mark batadv_netlink_ops as const Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 05/11] batman-adv: Add support for coccinelle in compat-patches Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 06/11] batman-adv: compat: Port netlink port hack to coccinelle Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 07/11] batman-adv: compat: Move netlink const compat " Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 08/11] batman-adv: compat: Remove replacement script Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 09/11] batman-adv: compat: Replace IFF_NO_QUEUE with coccinelle Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 10/11] batman-adv: compat: Move get_link_net patch to coccinelle Sven Eckelmann
2016-10-09  6:57 ` [B.A.T.M.A.N.] [PATCH v2 11/11] batman-adv: compat: Move vid api wrapper " Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).