b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Cc: Marek Lindner <mareklindner@neomailbox.ch>,
	Sven Eckelmann <sven@narfation.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
Date: Sat, 27 Dec 2014 18:03:17 +0100	[thread overview]
Message-ID: <20141227170317.GB10331@pengutronix.de> (raw)
In-Reply-To: <549EC29D.1070408@meshcoding.com>

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

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.

> 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).

Yes I saw that. I still don't really understand why this whole out of
tree package is necessary. But I am wondering if it wouldn't be easier
to develope and build directly in the kernel tree.

> 
> 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.

Yep, that works for the kernel, thanks. However, bitops.h remains as we
don't have bitops.h for the userspace.

> Otherwise we might need to find a different solution - or live we what
> we have now :)

Yeah it works normally as the includes leak through other include files.
But I prefer explicit includes. I am thinking about some solution for
the bitops.h

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: 836 bytes --]

  reply	other threads:[~2014-12-27 17:03 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 01/26] batman-adv: debugfs, avoid compiling for !DEBUG_FS Markus Pargmann
2015-01-11 10:32   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 02/26] batman-adv: Separate logging header Markus Pargmann
2014-12-28  2:33   ` Marek Lindner
2014-12-28 11:08     ` Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 03/26] batman-adv: iv_ogm, Reduce code duplication Markus Pargmann
2015-01-11 10:38   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg Markus Pargmann
2015-01-11 12:32   ` Marek Lindner
2015-01-11 12:42     ` Sven Eckelmann
2015-01-12 15:56   ` Simon Wunderlich
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 05/26] batman-adv: init, Add some error handling Markus Pargmann
2015-01-11 12:38   ` Marek Lindner
2015-01-14 15:24     ` Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 06/26] batman-adv: tvlv realloc, move error handling into if block Markus Pargmann
2015-01-11 12:40   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 07/26] batman-adv: split tvlv into a seperate file Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 08/26] batman-adv: Makefile, Sort alphabetically Markus Pargmann
2015-01-11 12:44   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 09/26] batman-adv: iv_ogm_iface_enable, direct return values Markus Pargmann
2015-01-11 12:46   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 10/26] batman-adv: iv_ogm_aggr_packet, bool return value Markus Pargmann
2015-01-11 12:48   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 11/26] batman-adv: iv_ogm_send_to_if, declare char* as const Markus Pargmann
2015-02-18  9:14   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 12/26] batman-adv: iv_ogm_can_aggregate, code readability Markus Pargmann
2015-02-19 16:20   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 13/26] batman-adv: iv_ogm_orig_update, remove unnecessary brackets Markus Pargmann
2015-02-20 11:53   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 14/26] batman-adv: iv_ogm_aggregate_new, simplify error handling Markus Pargmann
2015-02-23 16:50   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 15/26] batman-adv: iv_ogm_queue_add, Simplify expressions Markus Pargmann
2015-02-24 21:20   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 16/26] batman-adv: iv_ogm_orig_update, style, add missin brackets Markus Pargmann
2015-02-27 18:42   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 17/26] batman-adv: iv_ogm, Fix dup_status comment Markus Pargmann
2015-02-27 18:43   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 18/26] batman-adv: iv_ogm, fix coding style Markus Pargmann
2015-02-28 15:59   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 19/26] batman-adv: iv_ogm, fix comment function name Markus Pargmann
2015-03-01  9:00   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 20/26] batman-adv: types, Fix comment on bcast_own Markus Pargmann
2015-03-09  0:28   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 21/26] batman-adv: main, Convert is_my_mac() to bool Markus Pargmann
2015-03-11  9:45   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 22/26] batman-adv: main, batadv_compare_eth return bool Markus Pargmann
2015-03-11  9:48   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 23/26] batman-adv: Remove unnecessary ret variable Markus Pargmann
2015-03-13  6:04   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 24/26] batman-adv: Remove unnecessary ret variable in algo_register Markus Pargmann
2015-03-13  6:06   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes Markus Pargmann
2014-12-27 14:30   ` Antonio Quartulli
2014-12-27 17:03     ` Markus Pargmann [this message]
2014-12-31 17:55       ` Antonio Quartulli
2015-01-14 16:27         ` Markus Pargmann
2014-12-28  2:35   ` Marek Lindner
2014-12-28 11:11     ` Markus Pargmann
2015-03-21 22:36   ` Sven Eckelmann
2015-03-24 11:10     ` Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 26/26] batman-adv: types.h, add missing include Markus Pargmann
2014-12-28  2:35   ` Marek Lindner
2015-03-22  0:52 ` [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Sven Eckelmann
2015-03-22  1:34   ` Sven Eckelmann
2015-03-24 11:41     ` Markus Pargmann
2015-03-24 11:47       ` Sven Eckelmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141227170317.GB10331@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=sven@narfation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).