public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: Sven Eckelmann <sven@narfation.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Antonio Quartulli <antonio@meshcoding.com>
Subject: Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
Date: Tue, 24 Mar 2015 12:10:06 +0100	[thread overview]
Message-ID: <20150324111006.GB28604@pengutronix.de> (raw)
In-Reply-To: <13855982.zheniJVJDB@sven-edge>

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

On Sat, Mar 21, 2015 at 11:36:10PM +0100, Sven Eckelmann wrote:
> > --- 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__ */
> > +
> >  /**
> >   * enum batadv_packettype - types for batman-adv encapsulated packets
> >   * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
> 
> Ok, so you are including linux/bitops.h for BIT(...) and uapi/linux/if_ether.h 
> for ETH_ALEN? You are missing:
> 
>  * linux/types.h for uint8_t, __be16 and so on
>  * define for the bitfield byteorder comes from asm/byteorder.h
> 
> Most of these files are part of linux-libc-dev. The rest requires some kind of 
> hack. A way to still work in the batctl build would be to include dummy files. 
> An example patch is attached. This builds at least on my Debian system and my 
> OpenWrt build environment.

Thanks, I like the idea of dummy files. The patch also looks fine.

Best Regards,

Markus

> 
> Kind regards,
> 	Sven

> diff --git a/Makefile b/Makefile
> index 0eb71a1..ffbbf72 100755
> --- a/Makefile
> +++ b/Makefile
> @@ -30,7 +30,7 @@ MANPAGE = man/batctl.8
>  
>  # batctl flags and options
>  CFLAGS += -Wall -W -std=gnu99 -fno-strict-aliasing -MD -MP
> -CPPFLAGS += -D_GNU_SOURCE
> +CPPFLAGS += -D_GNU_SOURCE -Ikernelinc
>  LDLIBS += -lm
>  
>  # disable verbose output
> diff --git a/kernelinc/linux/bitops.h b/kernelinc/linux/bitops.h
> new file mode 100644
> index 0000000..d41db10
> --- /dev/null
> +++ b/kernelinc/linux/bitops.h
> @@ -0,0 +1,27 @@
> +/*
> + * Copyright (C) 2009-2014 B.A.T.M.A.N. contributors:
> + *
> + * Marek Lindner <mareklindner@neomailbox.ch>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of version 2 of the GNU General Public
> + * License as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> + * 02110-1301, USA
> + *
> + */
> +
> +#ifndef _BATCTL_KERNELINC_LINUX_BITOPS_H
> +#define _BATCTL_KERNELINC_LINUX_BITOPS_H
> +
> +#define BIT(nr) (1UL << (nr))
> +
> +#endif
> diff --git a/main.h b/main.h
> index 461f3e3..248467c 100644
> --- a/main.h
> +++ b/main.h
> @@ -36,17 +36,6 @@
>  #define DEBUG_TABLE_PATH_MAX_LEN 20
>  #define SETTINGS_PATH_MAX_LEN 25
>  
> -#if BYTE_ORDER == BIG_ENDIAN
> -#define __BIG_ENDIAN_BITFIELD
> -#elif BYTE_ORDER == LITTLE_ENDIAN
> -#define __LITTLE_ENDIAN_BITFIELD
> -#else
> -#error "unknown endianess"
> -#endif
> -
> -#define __packed __attribute((packed))   /* linux kernel compat */
> -#define BIT(nr)                 (1UL << (nr)) /* linux kernel compat */
> -
>  extern char module_ver_path[];
>  
>  #ifndef VLAN_VID_MASK
> diff --git a/packet.h b/packet.h
> index b81fbbf..27b4003 100644
> --- a/packet.h
> +++ b/packet.h
> @@ -18,6 +18,11 @@
>  #ifndef _NET_BATMAN_ADV_PACKET_H_
>  #define _NET_BATMAN_ADV_PACKET_H_
>  
> +#include <asm/byteorder.h>
> +#include <linux/bitops.h>
> +#include <linux/if_ether.h>
> +#include <linux/types.h>
> +
>  /**
>   * enum batadv_packettype - types for batman-adv encapsulated packets
>   * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
> diff --git a/sys.c b/sys.c
> index 676bef1..6c0cab4 100644
> --- a/sys.c
> +++ b/sys.c
> @@ -26,6 +26,7 @@
>  #include <string.h>
>  #include <errno.h>
>  #include <dirent.h>
> +#include <linux/bitops.h>
>  
>  #include "main.h"
>  #include "sys.h"




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

  reply	other threads:[~2015-03-24 11:10 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
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 [this message]
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=20150324111006.GB28604@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=antonio@meshcoding.com \
    --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