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 <[email protected]> > + * > + * 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 |
signature.asc
Description: Digital signature
