Re: [patch] Input cleanups for 2.5.29 [2/2]

Vojtech Pavlik
2002-07-30T21:36:08Z

On Wed, Jul 31, 2002 at 07:26:05AM +1000, Brad Hards wrote:
> On Wed, 31 Jul 2002 07:09, Greg KH wrote:
> > On Tue, Jul 30, 2002 at 03:23:42PM +0200, Vojtech Pavlik wrote:
> > > -#include <asm/types.h>
> > > +#include <stdint.h>
> >
> > Why? I thought we were not including any glibc (or any other libc)
> > header files when building the kernel?
> Should be <linux/types.h>

It's #ifndef __KERNEL__ and if we #include <linux/types.h> and the user
#includes <stdint.h> elsewhere, we're going to get collisions.

I guess __u16 is really the safe way here.

> > > - __u16 bustype;
> > > - __u16 vendor;
> > > - __u16 product;
> > > - __u16 version;
> > > + uint16_t bustype;
> > > + uint16_t vendor;
> > > + uint16_t product;
> > > + uint16_t version;
> >
> > {sigh} __u16 is _so_ much nicer, and tells the programmer, "Yes I know
> > this variable needs to be the same size in userspace and in
> > kernelspace."
> I'll harp some more.
> 1. __u16 isn't really any nicer - its just what you (as a kernel programmer) are used to.
> 2. uint16_t is a *standard* type. Userspace programmer know it, even if they don't know Linux.
>
> We shouldn't arbitrarily invent new types that could be trivially done with
> standard types. Maybe we could retain existing usage for ABIs that are
> unchanged from 2.0 days, but we certainly shouldn't be making the ABI
> any worse.

--
Vojtech Pavlik
SuSE Labs