Re: [PATCH] fuse: fix integer type usage in uapi header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 21, 2022 at 12:25:27PM +0100, Miklos Szeredi wrote:
> On Mon, 21 Mar 2022 at 11:01, Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Mon, Mar 21, 2022 at 10:36:20AM +0100, Miklos Szeredi wrote:
> > > On Mon, 21 Mar 2022 at 09:50, Greg Kroah-Hartman
> > > <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > > >
> > > > On Mon, Mar 21, 2022 at 09:40:56AM +0100, Miklos Szeredi wrote:
> > > > > On Mon, 21 Mar 2022 at 03:07, Carlos Llamas <cmllamas@xxxxxxxxxx> wrote:
> > > > > >
> > > > > > On Fri, Mar 18, 2022 at 08:24:55PM +0100, Miklos Szeredi wrote:
> > > > > > > On Fri, 18 Mar 2022 at 18:14, Carlos Llamas <cmllamas@xxxxxxxxxx> wrote:
> > > > > > > >
> > > > > > > > Kernel uapi headers are supposed to use __[us]{8,16,32,64} defined by
> > > > > > > > <linux/types.h> instead of 'uint32_t' and similar. This patch changes
> > > > > > > > all the definitions in this header to use the correct type. Previous
> > > > > > > > discussion of this topic can be found here:
> > > > > > > >
> > > > > > > >   https://lkml.org/lkml/2019/6/5/18
> > > > > > >
> > > > > > > This is effectively a revert of these two commits:
> > > > > > >
> > > > > > > 4c82456eeb4d ("fuse: fix type definitions in uapi header")
> > > > > > > 7e98d53086d1 ("Synchronize fuse header with one used in library")
> > > > > > >
> > > > > > > And so we've gone full circle and back to having to modify the header
> > > > > > > to be usable in the cross platform library...
> > > > > > >
> > > > > > > And also made lots of churn for what reason exactly?
> > > > > >
> > > > > > There are currently only two uapi headers making use of C99 types and
> > > > > > one is <linux/fuse.h>. This approach results in different typedefs being
> > > > > > selected when compiling for userspace vs the kernel.
> > > > >
> > > > > Why is this a problem if the size of the resulting types is the same?
> > > >
> > > > uint* are not "valid" variable types to cross the user/kernel boundary.
> > > > They are part of the userspace variable type namespace, not the kernel
> > > > variable type namespace.  Linus wrong a long post about this somewhere
> > > > in the past, I'm sure someone can dig it up...
> > >
> > > Looking forward to the details.  I cannot imagine why this would matter...
> >
> > Here's the huge thread on the issue:
> >         https://lore.kernel.org/all/19865.1101395592@xxxxxxxxxx/
> > and specifically here's Linus's answer:
> >         https://lore.kernel.org/all/Pine.LNX.4.58.0411281710490.22796@xxxxxxxxxxxxxxx/
> >
> > The whole thread is actually relevant for this .h file as well.  Some
> > things never change :)
> 
> "- the kernel should not depend on, or pollute user-space naming.
>   YOU MUST NOT USE "uint32_t" when that may not be defined, and
>   user-space rules for when it is defined are arcane and totally
>   arbitrary."
> 
> The "pollutes user space naming" argument is bogus for fuse, since
> application are using the library interface, which doesn't pull in the
> kernel headers but redefines everything that needs to be shared.   BTW
> this seems to be the pattern for libc interfaces as well, though I
> haven't looked closely.
> 
> On the other hand, if we change the types back to __u32 etc, then that
> will mess with the history.  I think the disadvantages outweigh the
> advantages, so unless some stronger argument comes up  it's NACK from
> me.

As this .h file is only 1 of 3 .h files using these variable types, I
think you are wrong and should go along with the rest of the kernel api
style.

greg k-h



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux