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

Greg KH
2004-03-12T04:58:05Z

On Thu, Mar 11, 2004 at 06:35:51PM -0800, Tim Hockin wrote:
> On Thu, Mar 11, 2004 at 05:54:48PM -0800, Eric Brower wrote:
> > Attached is a patch to 2.4's ethtool.h to use appropriate,
> > userspace-accessible data types (__u8 and friends, rather than u8 and
> > friends).
>
> if we *know* the width of them, why don't we just use C99 standard types in
> *both* places? I've never quite grokked why we need u8 and __u8 and all the
> variants, when we now have uint8_t. I mean, at least it's standardized.
>
> Anyone have a logical answer?

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

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

I remember saying that I would document this better a long time ago, as
it comes up every other month or so. Sorry for not doing it yet...

thanks,

greg k-h