[PATCH] don't use __be16 in files used by userspace

David S. Miller davem at davemloft.net
Fri Oct 7 22:24:56 CEST 2005


From: Harald Welte <laforge at netfilter.org>
Date: Fri, 7 Oct 2005 12:31:05 +0200

> This (or a different solution such as 
> "#ifndef __KERNEL__ #define __be16 #endif" needs to go in before 2.6.14
> is released, since otherwise we'd break userspace compilation :(

I'm not applying this.

The reverting of endianness annotations would be a serious
regression.  If we need userland compatible defines we can
either:

1) Do what iproute2 and friends do, which is ship sanitized
   kernel headers in their userland source tree.

2) As you suggest have a suitable __be* et al. define when
   __KERNEL__ is not set.

Actually... What's the problem anyways?  #2 seems to already
be done.

In linux/types.h we have:

#ifdef __CHECKER__
#define __bitwise __attribute__((bitwise))
#else
#define __bitwise
#endif

typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __le32;
typedef __u32 __bitwise __be32;
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
typedef __u64 __bitwise __le64;
typedef __u64 __bitwise __be64;
#endif

And this should just work.

That isn't even protected by __KERNEL__, it's fully visible to
userspace when you include linux/types.h



More information about the netfilter-devel mailing list