Re: kernel header separation

From: David Garfield
Date: Mon Sep 08 2003 - 15:24:40 EST


Erik Andersen writes:
> On Fri Sep 05, 2003 at 03:41:54PM +0100, Matthew Wilcox wrote:
> > On Tue, Sep 02, 2003 at 07:49:09PM -0600, Erik Andersen wrote:
> > > Header files intended for use by users should probably drop
> > > linux/types.h just include <stdint.h>,,, Then convert the
> > > types over to ISO C99 types.
> >
> > stdint.h is a userspace header. I suppose we could clone it for the
> > kernel, but I don't see any need to.
> >
> > > s/__u8/uint8_t/g
> > > s/__u16/uint16_t/g
> > > s/__u32/uint32_t/g
> > > s/__u64/uint64_t/g
> >
> > i think all these _t types are ugly ;-(
>
> They may be ugly, but they are standardized and have very
> precise meanings defined by ISO C99, which is a very good
> thing for code interoperability...
>
> -Erik

On the other hand, the ISO C99 definition is probably something like:
an integral type capable of storing the values 0 through 255
inclusive. (ok, I don't have a copy of the new standard but I have
seriously examined the old one.) I would not count on uint8_t
necessarily being unsigned on unusual hardware. Linux on the other
hand probably means __u8 as an exactly eight bit unsigned integer
value. While these may LOOK like identical statements, Linux is
[probably] making a significantly stronger statement.

I would say - keep the Linux types, and then document exactly what
Linux means by them somewhere. In particular, if Linux were ported to
a 9/18/36 bit platform, what would the semantics of __u8 be? (Ok,
maybe the documentation should say such a port is not considered to be
viable at this time.)

--David Garfield

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/