Skip to contentSkip to conversation

batman-adv: Use kernel-like folder structure

PATCH Applied Sven Eckelmann 2 participants 6 messages Apr 21, 2015 – Apr 26, 2015

Subsystems (4)
lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

PATCH v3 1/3 batman-adv: Use kernel-like folder structure

The person submitting the patches to the Networking maintainer has to take each patch and move files around and add some files to make it work in the actual kernel tree. Having all files included and already in the correct kernel tree layout should make this a lot easier.

The only files not part of the kernel tree are compat-include and every regular file in the top level directory.

---
v3: Rebased it on current master without the the hashtable patches v2:
* Cleaned up the Makefile
* Rebased on top of 9f01c16a4409e43e86629418fae9184fabb59da5
* Use symlink to show the Documentation/networking/batman-adv.txt as README in the root folder

 .../ABI/testing/sysfs-class-net-batman-adv         |  0
 .../ABI/testing/sysfs-class-net-mesh               |  0
 README => Documentation/networking/batman-adv.txt  |  0
 Makefile                                           | 22 +++++++++++++++-------
 Makefile.kbuild => net/batman-adv/Makefile         |  0
 bat_algo.h => net/batman-adv/bat_algo.h            |  0
 bat_iv_ogm.c => net/batman-adv/bat_iv_ogm.c        |  0
 bitarray.c => net/batman-adv/bitarray.c            |  0
 bitarray.h => net/batman-adv/bitarray.h            |  0
 .../batman-adv/bridge_loop_avoidance.c             |  0
 .../batman-adv/bridge_loop_avoidance.h             |  0
 debugfs.c => net/batman-adv/debugfs.c              |  0
 debugfs.h => net/batman-adv/debugfs.h              |  0
 .../batman-adv/distributed-arp-table.c             |  0
 .../batman-adv/distributed-arp-table.h             |  0
 fragmentation.c => net/batman-adv/fragmentation.c  |  0
 fragmentation.h => net/batman-adv/fragmentation.h  |  0
 .../batman-adv/gateway_client.c                    |  0
 .../batman-adv/gateway_client.h                    |  0
 .../batman-adv/gateway_common.c                    |  0
 .../batman-adv/gateway_common.h                    |  0
 .../batman-adv/hard-interface.c                    |  0
 .../batman-adv/hard-interface.h                    |  0
 hash.c => net/batman-adv/hash.c                    |  0
 hash.h => net/batman-adv/hash.h                    |  0
 icmp_socket.c => net/batman-adv/icmp_socket.c      |  0
 icmp_socket.h => net/batman-adv/icmp_socket.h      |  0
 main.c => net/batman-adv/main.c                    |  0
 main.h => net/batman-adv/main.h                    |  0
 multicast.c => net/batman-adv/multicast.c          |  0
 multicast.h => net/batman-adv/multicast.h          |  0
 .../batman-adv/network-coding.c                    |  0
 .../batman-adv/network-coding.h                    |  0
 originator.c => net/batman-adv/originator.c        |  0
 originator.h => net/batman-adv/originator.h        |  0
 packet.h => net/batman-adv/packet.h                |  0
 routing.c => net/batman-adv/routing.c              |  0
 routing.h => net/batman-adv/routing.h              |  0
 send.c => net/batman-adv/send.c                    |  0
 send.h => net/batman-adv/send.h                    |  0
 .../batman-adv/soft-interface.c                    |  0
 .../batman-adv/soft-interface.h                    |  0
 sysfs.c => net/batman-adv/sysfs.c                  |  0
 sysfs.h => net/batman-adv/sysfs.h                  |  0
 .../batman-adv/translation-table.c                 |  0
 .../batman-adv/translation-table.h                 |  0
 types.h => net/batman-adv/types.h                  |  0
 47 files changed, 15 insertions(+), 7 deletions(-)
 rename sysfs-class-net-batman-adv => Documentation/ABI/testing/sysfs-class-net-batman-adv (100%)
 rename sysfs-class-net-mesh => Documentation/ABI/testing/sysfs-class-net-mesh (100%)
 rename README => Documentation/networking/batman-adv.txt (100%)
 rename Makefile.kbuild => net/batman-adv/Makefile (100%)
 rename bat_algo.h => net/batman-adv/bat_algo.h (100%)
 rename bat_iv_ogm.c => net/batman-adv/bat_iv_ogm.c (100%)
 rename bitarray.c => net/batman-adv/bitarray.c (100%)
 rename bitarray.h => net/batman-adv/bitarray.h (100%)
 rename bridge_loop_avoidance.c => net/batman-adv/bridge_loop_avoidance.c (100%)
 rename bridge_loop_avoidance.h => net/batman-adv/bridge_loop_avoidance.h (100%)
 rename debugfs.c => net/batman-adv/debugfs.c (100%)
 rename debugfs.h => net/batman-adv/debugfs.h (100%)
 rename distributed-arp-table.c => net/batman-adv/distributed-arp-table.c (100%)
 rename distributed-arp-table.h => net/batman-adv/distributed-arp-table.h (100%)
 rename fragmentation.c => net/batman-adv/fragmentation.c (100%)
 rename fragmentation.h => net/batman-adv/fragmentation.h (100%)
 rename gateway_client.c => net/batman-adv/gateway_client.c (100%)
 rename gateway_client.h => net/batman-adv/gateway_client.h (100%)
 rename gateway_common.c => net/batman-adv/gateway_common.c (100%)
 rename gateway_common.h => net/batman-adv/gateway_common.h (100%)
 rename hard-interface.c => net/batman-adv/hard-interface.c (100%)
 rename hard-interface.h => net/batman-adv/hard-interface.h (100%)
 rename hash.c => net/batman-adv/hash.c (100%)
 rename hash.h => net/batman-adv/hash.h (100%)
 rename icmp_socket.c => net/batman-adv/icmp_socket.c (100%)
 rename icmp_socket.h => net/batman-adv/icmp_socket.h (100%)
 rename main.c => net/batman-adv/main.c (100%)
 rename main.h => net/batman-adv/main.h (100%)
 rename multicast.c => net/batman-adv/multicast.c (100%)
 rename multicast.h => net/batman-adv/multicast.h (100%)
 rename network-coding.c => net/batman-adv/network-coding.c (100%)
 rename network-coding.h => net/batman-adv/network-coding.h (100%)
 rename originator.c => net/batman-adv/originator.c (100%)
 rename originator.h => net/batman-adv/originator.h (100%)
 rename packet.h => net/batman-adv/packet.h (100%)
 rename routing.c => net/batman-adv/routing.c (100%)
 rename routing.h => net/batman-adv/routing.h (100%)
 rename send.c => net/batman-adv/send.c (100%)
 rename send.h => net/batman-adv/send.h (100%)
 rename soft-interface.c => net/batman-adv/soft-interface.c (100%)
 rename soft-interface.h => net/batman-adv/soft-interface.h (100%)
 rename sysfs.c => net/batman-adv/sysfs.c (100%)
 rename sysfs.h => net/batman-adv/sysfs.h (100%)
 rename translation-table.c => net/batman-adv/translation-table.c (100%)
 rename translation-table.h => net/batman-adv/translation-table.h (100%)
 rename types.h => net/batman-adv/types.h (100%)
Documentation/ABI/testing/sysfs-class-net-batman-adv renamed from sysfs-class-net-batman-adv +0 -0
similarity index 100%
rename from sysfs-class-net-batman-adv
rename to Documentation/ABI/testing/sysfs-class-net-batman-adv
Documentation/ABI/testing/sysfs-class-net-mesh renamed from sysfs-class-net-mesh +0 -0
similarity index 100%
rename from sysfs-class-net-mesh
rename to Documentation/ABI/testing/sysfs-class-net-mesh
Documentation/networking/batman-adv.txt renamed from README +0 -0
similarity index 100%
rename from README
rename to Documentation/networking/batman-adv.txt
Makefile +15 -7
index e57fcb3..8a04d12 100644
@@ -41,26 +41,34 @@ RM ?= rm -f
 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]"); \
 			fi)
-NOSTDINC_FLAGS := \
+export NOSTDINC_FLAGS := \
 	-I$(PWD)/compat-include/ \
 	-include $(PWD)/compat.h \
 	$(CFLAGS)
 
-CONFIG_BATMAN_ADV=m
 ifneq ($(REVISION),)
-ccflags-y += -DBATADV_SOURCE_VERSION=\"$(REVISION)\"
+NOSTDINC_FLAGS += -DBATADV_SOURCE_VERSION=\"$(REVISION)\"
 endif
-include $(PWD)/Makefile.kbuild
+
+BUILD_FLAGS := \
+	M=$(PWD)/net/batman-adv \
+	CONFIG_BATMAN_ADV=m \
+	CONFIG_BATMAN_ADV_DEBUG=$(CONFIG_BATMAN_ADV_DEBUG) \
+	CONFIG_BATMAN_ADV_BLA=$(CONFIG_BATMAN_ADV_BLA) \
+	CONFIG_BATMAN_ADV_DAT=$(CONFIG_BATMAN_ADV_DAT) \
+	CONFIG_BATMAN_ADV_NC=$(CONFIG_BATMAN_ADV_NC) \
+	CONFIG_BATMAN_ADV_MCAST=$(CONFIG_BATMAN_ADV_MCAST) \
+	INSTALL_MOD_DIR=updates/net/batman-adv/
 
 all: config
-	$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) modules
+	$(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS)	modules
 
 clean:
 	$(RM) compat-autoconf.h*
-	$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) clean
+	$(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) clean
 
 install: config
-	$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) INSTALL_MOD_DIR=updates/net/batman-adv/ modules_install
+	$(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) modules_install
 	depmod -a
 
 config:
net/batman-adv/Makefile renamed from Makefile.kbuild +0 -0
similarity index 100%
rename from Makefile.kbuild
rename to net/batman-adv/Makefile
net/batman-adv/bat_algo.h renamed from bat_algo.h +0 -0
similarity index 100%
rename from bat_algo.h
rename to net/batman-adv/bat_algo.h
net/batman-adv/bat_iv_ogm.c renamed from bat_iv_ogm.c +0 -0
similarity index 100%
rename from bat_iv_ogm.c
rename to net/batman-adv/bat_iv_ogm.c
net/batman-adv/bitarray.c renamed from bitarray.c +0 -0
similarity index 100%
rename from bitarray.c
rename to net/batman-adv/bitarray.c
net/batman-adv/bitarray.h renamed from bitarray.h +0 -0
similarity index 100%
rename from bitarray.h
rename to net/batman-adv/bitarray.h
net/batman-adv/bridge_loop_avoidance.c renamed from bridge_loop_avoidance.c +0 -0
similarity index 100%
rename from bridge_loop_avoidance.c
rename to net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/bridge_loop_avoidance.h renamed from bridge_loop_avoidance.h +0 -0
similarity index 100%
rename from bridge_loop_avoidance.h
rename to net/batman-adv/bridge_loop_avoidance.h
net/batman-adv/debugfs.c renamed from debugfs.c +0 -0
similarity index 100%
rename from debugfs.c
rename to net/batman-adv/debugfs.c
net/batman-adv/debugfs.h renamed from debugfs.h +0 -0
similarity index 100%
rename from debugfs.h
rename to net/batman-adv/debugfs.h
net/batman-adv/distributed-arp-table.c renamed from distributed-arp-table.c +0 -0
similarity index 100%
rename from distributed-arp-table.c
rename to net/batman-adv/distributed-arp-table.c
net/batman-adv/distributed-arp-table.h renamed from distributed-arp-table.h +0 -0
similarity index 100%
rename from distributed-arp-table.h
rename to net/batman-adv/distributed-arp-table.h
net/batman-adv/fragmentation.c renamed from fragmentation.c +0 -0
similarity index 100%
rename from fragmentation.c
rename to net/batman-adv/fragmentation.c
net/batman-adv/fragmentation.h renamed from fragmentation.h +0 -0
similarity index 100%
rename from fragmentation.h
rename to net/batman-adv/fragmentation.h
net/batman-adv/gateway_client.c renamed from gateway_client.c +0 -0
similarity index 100%
rename from gateway_client.c
rename to net/batman-adv/gateway_client.c
net/batman-adv/gateway_client.h renamed from gateway_client.h +0 -0
similarity index 100%
rename from gateway_client.h
rename to net/batman-adv/gateway_client.h
net/batman-adv/gateway_common.c renamed from gateway_common.c +0 -0
similarity index 100%
rename from gateway_common.c
rename to net/batman-adv/gateway_common.c
net/batman-adv/gateway_common.h renamed from gateway_common.h +0 -0
similarity index 100%
rename from gateway_common.h
rename to net/batman-adv/gateway_common.h
net/batman-adv/hard-interface.c renamed from hard-interface.c +0 -0
similarity index 100%
rename from hard-interface.c
rename to net/batman-adv/hard-interface.c
net/batman-adv/hard-interface.h renamed from hard-interface.h +0 -0
similarity index 100%
rename from hard-interface.h
rename to net/batman-adv/hard-interface.h
net/batman-adv/hash.c renamed from hash.c +0 -0
similarity index 100%
rename from hash.c
rename to net/batman-adv/hash.c
net/batman-adv/hash.h renamed from hash.h +0 -0
similarity index 100%
rename from hash.h
rename to net/batman-adv/hash.h
net/batman-adv/icmp_socket.c renamed from icmp_socket.c +0 -0
similarity index 100%
rename from icmp_socket.c
rename to net/batman-adv/icmp_socket.c
net/batman-adv/icmp_socket.h renamed from icmp_socket.h +0 -0
similarity index 100%
rename from icmp_socket.h
rename to net/batman-adv/icmp_socket.h
net/batman-adv/main.c renamed from main.c +0 -0
similarity index 100%
rename from main.c
rename to net/batman-adv/main.c
net/batman-adv/main.h renamed from main.h +0 -0
similarity index 100%
rename from main.h
rename to net/batman-adv/main.h
net/batman-adv/multicast.c renamed from multicast.c +0 -0
similarity index 100%
rename from multicast.c
rename to net/batman-adv/multicast.c
net/batman-adv/multicast.h renamed from multicast.h +0 -0
similarity index 100%
rename from multicast.h
rename to net/batman-adv/multicast.h
net/batman-adv/network-coding.c renamed from network-coding.c +0 -0
similarity index 100%
rename from network-coding.c
rename to net/batman-adv/network-coding.c
net/batman-adv/network-coding.h renamed from network-coding.h +0 -0
similarity index 100%
rename from network-coding.h
rename to net/batman-adv/network-coding.h
net/batman-adv/originator.c renamed from originator.c +0 -0
similarity index 100%
rename from originator.c
rename to net/batman-adv/originator.c
net/batman-adv/originator.h renamed from originator.h +0 -0
similarity index 100%
rename from originator.h
rename to net/batman-adv/originator.h
net/batman-adv/packet.h renamed from packet.h +0 -0
similarity index 100%
rename from packet.h
rename to net/batman-adv/packet.h
net/batman-adv/routing.c renamed from routing.c +0 -0
similarity index 100%
rename from routing.c
rename to net/batman-adv/routing.c
net/batman-adv/routing.h renamed from routing.h +0 -0
similarity index 100%
rename from routing.h
rename to net/batman-adv/routing.h
net/batman-adv/send.c renamed from send.c +0 -0
similarity index 100%
rename from send.c
rename to net/batman-adv/send.c
net/batman-adv/send.h renamed from send.h +0 -0
similarity index 100%
rename from send.h
rename to net/batman-adv/send.h
net/batman-adv/soft-interface.c renamed from soft-interface.c +0 -0
similarity index 100%
rename from soft-interface.c
rename to net/batman-adv/soft-interface.c
net/batman-adv/soft-interface.h renamed from soft-interface.h +0 -0
similarity index 100%
rename from soft-interface.h
rename to net/batman-adv/soft-interface.h
net/batman-adv/sysfs.c renamed from sysfs.c +0 -0
similarity index 100%
rename from sysfs.c
rename to net/batman-adv/sysfs.c
net/batman-adv/sysfs.h renamed from sysfs.h +0 -0
similarity index 100%
rename from sysfs.h
rename to net/batman-adv/sysfs.h
net/batman-adv/translation-table.c renamed from translation-table.c +0 -0
similarity index 100%
rename from translation-table.c
rename to net/batman-adv/translation-table.c
net/batman-adv/translation-table.h renamed from translation-table.h +0 -0
similarity index 100%
rename from translation-table.h
rename to net/batman-adv/translation-table.h
net/batman-adv/types.h renamed from types.h +0 -0
similarity index 100%
rename from types.h
rename to net/batman-adv/types.h
Signature · 1 line
2.1.4
author maintainer
#1 lore raw

PATCH v3 2/3 batman-adv: Add Kconfig to the sources

The Kconfig file is not used by the out-of-tree module but it has to be modified when new patches are added which would modify it in the kernel tree. Otherwise the information has to be stored somewhere else until someone submits it to the Networking maintainer.

---
v3: No change
v2: Moved from main patch to extra patch

 net/batman-adv/Kconfig | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 net/batman-adv/Kconfig
net/batman-adv/Kconfig new file +70 -0
new file mode 100644
index 0000000..c6fc8f7
@@ -0,0 +1,70 @@
+#
+# B.A.T.M.A.N meshing protocol
+#
+
+config BATMAN_ADV
+	tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
+	depends on NET
+	select CRC16
+	select LIBCRC32C
+        default n
+	help
+          B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is
+          a routing protocol for multi-hop ad-hoc mesh networks. The
+          networks may be wired or wireless. See
+          http://www.open-mesh.org/ for more information and user space
+          tools.
+
+config BATMAN_ADV_BLA
+	bool "Bridge Loop Avoidance"
+	depends on BATMAN_ADV && INET
+	default y
+	help
+	  This option enables BLA (Bridge Loop Avoidance), a mechanism
+	  to avoid Ethernet frames looping when mesh nodes are connected
+	  to both the same LAN and the same mesh. If you will never use
+	  more than one mesh node in the same LAN, you can safely remove
+	  this feature and save some space.
+
+config BATMAN_ADV_DAT
+	bool "Distributed ARP Table"
+	depends on BATMAN_ADV && INET
+	default n
+	help
+	  This option enables DAT (Distributed ARP Table), a DHT based
+	  mechanism that increases ARP reliability on sparse wireless
+	  mesh networks. If you think that your network does not need
+	  this option you can safely remove it and save some space.
+
+config BATMAN_ADV_NC
+	bool "Network Coding"
+	depends on BATMAN_ADV
+	default n
+	help
+	  This option enables network coding, a mechanism that aims to
+	  increase the overall network throughput by fusing multiple
+	  packets in one transmission.
+	  Note that interfaces controlled by batman-adv must be manually
+	  configured to have promiscuous mode enabled in order to make
+	  network coding work.
+	  If you think that your network does not need this feature you
+	  can safely disable it and save some space.
+
+config BATMAN_ADV_MCAST
+	bool "Multicast optimisation"
+	depends on BATMAN_ADV
+	default n
+	help
+	  This option enables the multicast optimisation which aims to
+	  reduce the air overhead while improving the reliability of
+	  multicast messages.
+
+config BATMAN_ADV_DEBUG
+	bool "B.A.T.M.A.N. debugging"
+	depends on BATMAN_ADV
+	depends on DEBUG_FS
+	help
+	  This is an option for use by developers; most people should
+	  say N here. This enables compilation of support for
+	  outputting debugging information to the kernel log. The
+	  output is controlled via the module parameter debug.
Signature · 1 line
2.1.4
#2 lore raw

Re: [B.A.T.M.A.N.] [PATCHv3 2/3] batman-adv: Add Kconfig to the sources

Quoted 6 lines · On Tuesday, April 21, 2015 12:45:07 Sven Eckelmann wrote:

The Kconfig file is not used by the out-of-tree module but it has to be modified when new patches are added which would modify it in the kernel tree. Otherwise the information has to be stored somewhere else until someone submits it to the Networking maintainer.

Quoted 8 lines

---
v3: No change
v2: Moved from main patch to extra patch

 net/batman-adv/Kconfig | 70
++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70
insertions(+)
 create mode 100644 net/batman-adv/Kconfig

Applied in revision c69c935.

Thanks,
Marek

author maintainer
#3 lore raw

PATCH v3 3/3 batman-adv: Add link to kernel README

In reply to Sven Eckelmann

The batman-adv out-of-tree module provided a README in the root folder. But the kernel stores the same readme as Documentation/networking/batman-adv.txt. Just link to the kernel README to avoid having the same readme twice.

---
v3: No change
v2: Moved from main patch to extra patch

 README | 1 +
 1 file changed, 1 insertion(+)
 create mode 120000 README
README new file +1 -0
new file mode 120000
index 0000000..209342f
@@ -0,0 +1 @@
+Documentation/networking/batman-adv.txt
\ No newline at end of file
Signature · 1 line
2.1.4
#4 lore raw

Re: [B.A.T.M.A.N.] [PATCHv3 3/3] batman-adv: Add link to kernel README

Quoted 9 lines · On Tuesday, April 21, 2015 12:45:08 Sven Eckelmann wrote:

The batman-adv out-of-tree module provided a README in the root folder. But the kernel stores the same readme as Documentation/networking/batman-adv.txt. Just link to the kernel README to avoid having the same readme twice.

---
v3: No change
v2: Moved from main patch to extra patch

Applied in revision 098c0f1.

Thanks,
Marek

#5 lore raw
In reply to Sven Eckelmann
Quoted 8 lines · On Tuesday, April 21, 2015 12:45:06 Sven Eckelmann wrote:

The person submitting the patches to the Networking maintainer has to take each patch and move files around and add some files to make it work in the actual kernel tree. Having all files included and already in the correct kernel tree layout should make this a lot easier.

The only files not part of the kernel tree are compat-include and every regular file in the top level directory.

Quoted 8 lines

---
v3: Rebased it on current master without the the hashtable patches v2:
* Cleaned up the Makefile
* Rebased on top of 9f01c16a4409e43e86629418fae9184fabb59da5
* Use symlink to show the Documentation/networking/batman-adv.txt as README
in the root folder

Applied in revision eb69667.

Thanks,
Marek