Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes

Markus Pargmann
2015-01-14T16:27:49Z

[-- Attachment #1: Type: text/plain, Size: 2430 bytes --]

On Wed, Dec 31, 2014 at 06:55:25PM +0100, Antonio Quartulli wrote:
> Markus,
>
> On 27/12/14 18:03, Markus Pargmann wrote:
> > Hi Antonio,
> >
> > On Sat, Dec 27, 2014 at 03:30:53PM +0100, Antonio Quartulli wrote:
> >> 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).
> >
> > Oh, I checked by grepping through the kernel before changing the patch
> > like this.
> > git grep "^#if.*def.*__KERNEL__" | grep -v include | wc -l
> > 145
> >
> > So there are 145 uses of an ifdef __KERNEL__ outside of include
> > directories (I excluded include directories as they may be exported to
> > userspace). So I thought it would be ok.
>
> these are probably pieces of code that have not yet been cleaned up.
> Still, this does not allow us to introduce more code like this: David
> (the networking tree maintainer) would refuse such additions.

Okay, thanks. I removed the bitops.h include for the moment as I don't
have an idea how to keep the header usable for the userspace
application.

Best regards,

Markus

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]