batctl: musl build fixes
[feed/routing.git] / batctl / patches / 0002-batctl-Add-required-includes-to-all-files.patch
1 From fb51f72f3fe911103abe565ebe88b7545a18d963 Mon Sep 17 00:00:00 2001
2 From: Sven Eckelmann <sven@narfation.org>
3 Date: Fri, 17 Apr 2015 19:40:28 +0200
4 Subject: [PATCH] batctl: Add required includes to all files
5
6 The header files could not be build indepdent from each other. This is happened
7 because headers didn't include the files for things they've used. This was
8 problematic because the success of a build depended on the knowledge about the
9 right order of local includes.
10
11 Also source files were not including everything they've used explicitly.
12 Instead they required that transitive includes are always stable. This is
13 problematic because some transitive includes are not obvious, depend on config
14 settings and may not be stable in the future.
15
16 The order for include blocks are:
17
18 * primary headers (main.h and the *.h file of a *.c file)
19 * global linux headers
20 * required local headers
21 * extra forward declarations for pointers in function/struct declarations
22
23 The only exceptions are linux/bitops.h and linux/if_ether.h in packet.h. This
24 header file is shared with userspace applications like batctl and must
25 therefore build together with userspace applications. The header linux/bitops.h
26 is not part of the uapi headers and linux/if_ether.h conflicts with the musl
27 implementation of netinet/if_ether.h. The maintainers rejected the use of
28 __KERNEL__ preprocessor checks and thus these two headers are only in main.h.
29 All files using packet.h first have to include main.h to work correctly.
30
31 Reported-by: Markus Pargmann <mpa@pengutronix.de>
32 Signed-off-by: Sven Eckelmann <sven@narfation.org>
33 Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
34 ---
35 packet.h | 3 +++
36 1 file changed, 3 insertions(+)
37
38 diff --git a/packet.h b/packet.h
39 index b81fbbf..7a9cb7a 100644
40 --- a/packet.h
41 +++ b/packet.h
42 @@ -18,6 +18,9 @@
43 #ifndef _NET_BATMAN_ADV_PACKET_H_
44 #define _NET_BATMAN_ADV_PACKET_H_
45
46 +#include <asm/byteorder.h>
47 +#include <linux/types.h>
48 +
49 /**
50 * enum batadv_packettype - types for batman-adv encapsulated packets
51 * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
52 --
53 2.1.4
54