Hi,
it seems that the coccinelle package in Debian Jessie is not able to parse semantic patches [1]. This basically breaks the batman-adv build on many stable systems and thus makes the out-of-tree module unusable on these systems.
I have currently no better idea than reverting these patches.
Kind regards, Sven
PS: Linus, do you want to try to get rid of replacement.sh?
The coccinelle in Debian Jessie seems to be broken. It fails to parse the patches and thus makes it impossible to use the out-of-tree module in these systems. Therefore drop it for now.
This reverts commit 7f40f382af1125698ad149d1b743c2de70a5ad5c.
Signed-off-by: Sven Eckelmann sven@narfation.org --- compat-include/linux/netdevice.h | 6 --- compat-patches/0005-vid-callbacks.cocci | 74 --------------------------------- compat.h | 54 ++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 80 deletions(-) delete mode 100644 compat-patches/0005-vid-callbacks.cocci
diff --git a/compat-include/linux/netdevice.h b/compat-include/linux/netdevice.h index 0536549..e71e614 100644 --- a/compat-include/linux/netdevice.h +++ b/compat-include/linux/netdevice.h @@ -28,12 +28,6 @@
#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 deleted file mode 100644 index 2cebc0e..0000000 --- a/compat-patches/0005-vid-callbacks.cocci +++ /dev/null @@ -1,74 +0,0 @@ -@ 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 d59fb5f..2865eeb 100644 --- a/compat.h +++ b/compat.h @@ -42,6 +42,31 @@
#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) \ @@ -70,6 +95,35 @@ 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
The coccinelle in Debian Jessie seems to be broken. It fails to parse the patches and thus makes it impossible to use the out-of-tree module in these systems. Therefore drop it for now.
This reverts commit 3b79cd3d9b3eb920d17233b5270ee7162d55587e.
Signed-off-by: Sven Eckelmann sven@narfation.org --- compat-patches/0004-get_link_net.cocci | 13 ------------- compat.h | 7 +++++++ 2 files changed, 7 insertions(+), 13 deletions(-) delete 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 deleted file mode 100644 index 7520bb6..0000000 --- a/compat-patches/0004-get_link_net.cocci +++ /dev/null @@ -1,13 +0,0 @@ -@@ -identifier netdev, fallback_net; -@@ - - static struct net *batadv_getlink_net(const struct net_device *netdev, - 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 2865eeb..245621f 100644 --- a/compat.h +++ b/compat.h @@ -145,4 +145,11 @@ 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_ */
The coccinelle in Debian Jessie seems to be broken. It fails to parse the patches and thus makes it impossible to use the out-of-tree module in these systems. Therefore drop it for now.
This reverts commit 541c087012bd6b57d37f041aedc4d0b4440a96d1.
Signed-off-by: Sven Eckelmann sven@narfation.org --- compat-patches/0003-iff-no-queue.cocci | 9 --------- compat.h | 6 ++++++ 2 files changed, 6 insertions(+), 9 deletions(-) delete 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 deleted file mode 100644 index 9c95b85..0000000 --- a/compat-patches/0003-iff-no-queue.cocci +++ /dev/null @@ -1,9 +0,0 @@ -@@ -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 245621f..78de7ea 100644 --- a/compat.h +++ b/compat.h @@ -152,4 +152,10 @@ 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_ */
The coccinelle in Debian Jessie seems to be broken. It fails to parse the patches and thus makes it impossible to use the out-of-tree module in these systems. Therefore drop it for now.
This reverts commit 2f9f52d1dfc417201028cc65f91aaddc5eaf493a.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 3 ++- compat-patches/0002-genl-const.INFO | 15 --------------- compat-patches/0002-genl-const.cocci | 10 ---------- compat-patches/replacements.sh | 9 +++++++++ 4 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 compat-patches/0002-genl-const.INFO delete mode 100644 compat-patches/0002-genl-const.cocci create mode 100755 compat-patches/replacements.sh
diff --git a/Makefile b/Makefile index e9c499f..67f1988 100644 --- a/Makefile +++ b/Makefile @@ -108,7 +108,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/ @$(LN) ../Makefile $(BUILD_DIR)/Makefile @$(RM) $(SOURCE_BUILD) @@ -126,6 +126,7 @@ $(SOURCE_STAMP): $(SOURCE) compat-patches/* $(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 diff --git a/compat-patches/0002-genl-const.INFO b/compat-patches/0002-genl-const.INFO deleted file mode 100644 index 192c5c6..0000000 --- a/compat-patches/0002-genl-const.INFO +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 36c71d6..0000000 --- a/compat-patches/0002-genl-const.cocci +++ /dev/null @@ -1,10 +0,0 @@ -@@ -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 new file mode 100755 index 0000000..7dcb953 --- /dev/null +++ b/compat-patches/replacements.sh @@ -0,0 +1,9 @@ +#! /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/' \ + -e 's/^static const struct genl_ops batadv_netlink_ops/static __genl_const struct genl_ops batadv_netlink_ops/' \ + build/net/batman-adv/netlink.c
On Mon, Oct 31, 2016 at 08:36:27AM +0100, Sven Eckelmann wrote:
The coccinelle in Debian Jessie seems to be broken. It fails to parse the patches and thus makes it impossible to use the out-of-tree module in these systems. Therefore drop it for now.
This reverts commit 2f9f52d1dfc417201028cc65f91aaddc5eaf493a.
Signed-off-by: Sven Eckelmann sven@narfation.org
Makefile | 3 ++- compat-patches/0002-genl-const.INFO | 15 --------------- compat-patches/0002-genl-const.cocci | 10 ---------- compat-patches/replacements.sh | 9 +++++++++ 4 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 compat-patches/0002-genl-const.INFO delete mode 100644 compat-patches/0002-genl-const.cocci create mode 100755 compat-patches/replacements.sh
684d4cad930d97902 ("batman-adv: Remove replacement compat script") needs to be reverted first before this patch applies cleanly, doesn't it?
On Tue, Nov 01, 2016 at 01:46:19AM +0100, Linus Lüssing wrote:
684d4cad930d97902 ("batman-adv: Remove replacement compat script") needs to be reverted first before this patch applies cleanly, doesn't it?
Ah, sorry, no, just noticed you rebased it on master + "batman-adv: Install module in $INSTALL_MOD_DIR/updates/net/batman-adv".
Cherry-picking that commit onto master first helped.
The coccinelle in Debian Jessie seems to be broken. It fails to parse the patches and thus makes it impossible to use the out-of-tree module in these systems. Therefore drop it for now.
This reverts commit 57ed6cbca85a0a681a0fa8b4690259429f3ea9a5.
Signed-off-by: Sven Eckelmann sven@narfation.org --- 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, 19 insertions(+), 35 deletions(-) delete mode 100644 compat-patches/0001-netlink-portid.cocci
diff --git a/compat-include/linux/netlink.h b/compat-include/linux/netlink.h index ca2bdf0..4f2185d 100644 --- a/compat-include/linux/netlink.h +++ b/compat-include/linux/netlink.h @@ -26,13 +26,19 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-#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 +#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))
#endif /* < KERNEL_VERSION(3, 7, 0) */
diff --git a/compat-include/net/genetlink.h b/compat-include/net/genetlink.h index b057e6c..2e8e17a 100644 --- a/compat-include/net/genetlink.h +++ b/compat-include/net/genetlink.h @@ -24,17 +24,6 @@ #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 deleted file mode 100644 index 5fc504e..0000000 --- a/compat-patches/0001-netlink-portid.cocci +++ /dev/null @@ -1,17 +0,0 @@ -@@ -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 78de7ea..d987577 100644 --- a/compat.h +++ b/compat.h @@ -67,6 +67,12 @@ 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) \
The coccinelle in Debian Jessie seems to be broken. It fails to parse the patches and thus makes it impossible to use the out-of-tree module in these systems. Therefore drop it for now.
This reverts commit cd6361c9f4ea19e1318c6549f863a21921154896.
Signed-off-by: Sven Eckelmann sven@narfation.org --- Makefile | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/Makefile b/Makefile index 67f1988..b852a17 100644 --- a/Makefile +++ b/Makefile @@ -40,19 +40,11 @@ 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 --very-quiet CP := cp -fpR LN := ln -sf
@@ -114,17 +106,12 @@ $(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 -e '.patch$$' -e '.cocci$$'|sort)"; \ + patches="$$(ls -1 compat-patches/|grep '.patch$$'|sort)"; \ for i in $${patches}; do \ - 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; \ + echo ' COMPAT_PATCH '$${i};\ + cd $(BUILD_DIR); \ + $(PATCH) ../compat-patches/$${i}; \ + cd - > /dev/null; \ done compat-patches/replacements.sh touch $(SOURCE_STAMP)
Hi Sven,
On Mon, Oct 31, 2016 at 08:35:40AM +0100, Sven Eckelmann wrote:
Hi,
it seems that the coccinelle package in Debian Jessie is not able to parse semantic patches [1]. This basically breaks the batman-adv build on many stable systems and thus makes the out-of-tree module unusable on these systems.
Urgh, what a shame :-(
I have currently no better idea than reverting these patches.
Kind regards, Sven
PS: Linus, do you want to try to get rid of replacement.sh?
Have only looked at the one const case so far, but can have a look at the others too, sure.
On Monday, October 31, 2016 8:35:40 AM CET Sven Eckelmann wrote:
Hi,
it seems that the coccinelle package in Debian Jessie is not able to parse semantic patches [1]. This basically breaks the batman-adv build on many stable systems and thus makes the out-of-tree module unusable on these systems.
I have currently no better idea than reverting these patches.
Commited in be1dd23..c941add
Thanks, Simon
b.a.t.m.a.n@lists.open-mesh.org