[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190605051040.GA22760@kroah.com>
Date: Wed, 5 Jun 2019 07:10:40 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc: Arnd Bergmann <arnd@...db.de>, Joe Perches <joe@...ches.com>,
Linux Media Mailing List <linux-media@...r.kernel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Randy Dunlap <rdunlap@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: do not use C++ style comments in uapi headers
On Wed, Jun 05, 2019 at 01:10:41PM +0900, Masahiro Yamada wrote:
> On Wed, Jun 5, 2019 at 3:21 AM Arnd Bergmann <arnd@...db.de> wrote:
> > > > >
> > > > > There are two ways to define fixed-width type.
> > > > >
> > > > > [1] #include <linux/types.h>, __u8, __u16, __u32, __u64
> > > > >
> > > > > vs
> > > > >
> > > > > [2] #include <stdint.h>, uint8_t, uint16_t, uint32_t, uint64_t
> > > > >
> > > > >
> > > > > Both are used in UAPI headers.
> > > > > IIRC, <stdint.h> was standardized by C99.
> > > > >
> > > > > So, we have already relied on C99 in user-space too.
> >
> > A related problem is that using the stdint.h types requires
> > including stdint.h first, but the C library requires that including
> > one standard header does not include another one recursively.
> >
> > So if sys/socket.h includes linux/socket.h, that must not include
> > stdint.h or any other header file that does so.
>
>
> This means we cannot reliably use uint{8,16,32,64}_t in UAPI headers.
We should not be doing that as they are in the userspace "namespace" of
variables, not in the kernel namespace. We've been over this many times
in the past :(
> [1] If we include <stdint.h> from linux/foo.h
>
> If sys/foo.h includes <linux/foo.h> and <stdint.h>,
> it violates the C library requirement.
>
>
> [2] If we do not include <stdint.h> from linux/foo.h
>
> If sys/foo.h includes <linux/foo.h>, but not <stdint.h>,
> we get 'unknown type name' errors.
We need to just use the proper __u{8,16,32,64} variable types instead,
that is exactly what they are there for.
thanks,
greg k-h
Powered by blists - more mailing lists