Hi Markus,
first of all you should know that I really appreciate your hard work. Thank you very much for this!
On 26/12/14 12:41, Markus Pargmann wrote:
Signed-off-by: Markus Pargmann mpa@pengutronix.de
packet.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/packet.h b/packet.h index facd1feddd4e..5fd0d814b6de 100644 --- a/packet.h +++ b/packet.h @@ -18,6 +18,11 @@ #ifndef _NET_BATMAN_ADV_PACKET_H_ #define _NET_BATMAN_ADV_PACKET_H_
+#ifdef __KERNEL__ +#include <linux/bitops.h> +#include <uapi/linux/if_ether.h> +#endif /* __KERNEL__ */
Unfortunately we can't do this :-(
Patches sent to the kernel cannot contain conditional code on being in the kernel or not (same is true for checks against a particular kernel version - such code can't be in the kernel).
Patches sent to the kernel must assume that they are only for the kernel (and for that particular version we are sending the patches against).
Of course this makes everything a bit trickier for us since we share files between kernel and userspace .....
This is one of the reasons why we have compat.c/h in the batman-adv package: you will see that in those files we had to implement all sort of hackish/dirty tricks in order to keep the code in the other files clean (compat.h/c are not sent to the kernel but are part of the batman-adv out-of-the-tree package).
However, as far as I know, you should be able to simply do:
#include <linux/if_ether.h> (without the uapi subfolder)
and this should happily work for both the kernel and the userspace. Have you tried that? I might be wrong - it's quite some time I haven't used uapi headers.
Otherwise we might need to find a different solution - or live we what we have now :)
Cheers,
/**
- enum batadv_packettype - types for batman-adv encapsulated packets
- @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV