Re: [PATCH] ethtool.h should use userspace-accessible types

Tim Hockin
2004-03-12T09:19:33Z

On Thu, Mar 11, 2004 at 08:57:56PM -0800, Greg KH wrote:
> u8 means an unsigned 8 bit variable within the kernel.
> __u8 means an unsigned 8 bit variable both within the kernel and
> in userspace. Use the __ forms when describing data structures
> or variables that cross the userspace/kernelspace boundry in
> order to get everything correct.

The only problem is that this is a RETARDED precedent. __foo means the
"internal" version of foo. Within the kernel __foo often means the version
of foo without "the lock".

POSIX defines any type beginning with _ as part of the implementation.
IMHO, no userspace app should *ever* need a type that starts with _ or __.
It's just dumb. If the width matters, define it as a width specific type.
If it doesn't define it as an int/short/whatever. The fact that it isn't
obvious what is or is not kernel-only is an entirely separate issue.

> Becides, something like u8 is a zillion times saner than uint8_t, don't
> you think? :)

As much as uint8_t is a pain in the ass to type, at least it is clear and
obvious and standard, don't you think? :)