Skip to contentSkip to conversation

batman-adv: Use kernel-like folder structure

RFC Superseded Sven Eckelmann 3 participants 4 messages Apr 17, 2015 – Apr 20, 2015

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

RFC 1/1 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.

---
This is just a rough idea and there are some things which I would consider "not really nice". But it is at least a proof of concept which I can show.

 .../ABI/testing/sysfs-class-net-batman-adv         |  0
 .../ABI/testing/sysfs-class-net-mesh               |  0
 README => Documentation/networking/batman-adv.txt  |  0
 Makefile                                           | 21 +++++--
 net/batman-adv/Kconfig                             | 70 ++++++++++++++++++++++
 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.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, 86 insertions(+), 5 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%)
 create mode 100644 net/batman-adv/Kconfig
 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.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 +16 -5
index e57fcb3..94bb92c 100644
@@ -48,19 +48,30 @@ NOSTDINC_FLAGS := \
 
 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 := \
+	NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
+	M=$(PWD)/net/batman-adv/ \
+	PWD="$(PWD)" \
+	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/Kconfig new file +70 -0

70 lines not on this page · raw message

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.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
#1 lore raw
Quoted 4 lines · Sven Eckelmann

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.

I like the idea. Was moving patches between in- and out-of-kernel-tree batman-adv a few times, too and that'd spare an sed call in the future :).

#2 lore raw
Quoted 9 lines · On Sunday, April 19, 2015 19:49:00 Linus Lüssing wrote:
Quoted 4 lines · Sven Eckelmann

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.

I like the idea. Was moving patches between in- and out-of-kernel-tree batman-adv a few times, too and that'd spare an sed call in the future :).

If I am not mistaken the build process of the various packages need to be adapted unless we provide a Makefile in the root folder ?

Apart from that detail I also like the idea of mimicking the kernel folder structure.

Cheers,
Marek

author maintainer
#3 lore raw
Quoted 8 lines · On Monday 20 April 2015 11:44:09 Marek Lindner wrote:
Quoted 7 lines · On Sunday, April 19, 2015 19:49:00 Linus Lüssing wrote:
Quoted 5 lines · Sven Eckelmann

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.

Quoted 6 lines
Quoted 3 lines

I like the idea. Was moving patches between in- and out-of-kernel-tree batman-adv a few times, too and that'd spare an sed call in the future :).

If I am not mistaken the build process of the various packages need to be adapted unless we provide a Makefile in the root folder ?

This is what the RFC is about (btw. I have a cleaner version of the Makefile here in my HDD). It tries to keep the batman-adv stuff in net/batman-adv and provides the compat and extra Makefile stuff in the root folder. You should be able to do a diff of batman-adv:net/batman-adv + linux:net/batman-adv and see no difference.

This means the person moving patches from batman-adv to net-next (or the other way around) still has some occasional changes in the compat code outside of net/batman-adv/ which he must removed (or added). But I hope it is still helpful.

Kind regards,
Sven