Re: [PATCH v2] fuse: uapi: use UAPI types

From: David Laight
Date: Sat Jan 03 2026 - 09:10:35 EST


On Fri, 2 Jan 2026 23:27:16 +0100
Bernd Schubert <bernd@xxxxxxxxxxx> wrote:

> On 12/30/25 13:10, Thomas Weißschuh wrote:
> > Using libc types and headers from the UAPI headers is problematic as it
> > introduces a dependency on a full C toolchain.
> >
> > Use the fixed-width integer types provided by the UAPI headers instead.
> > To keep compatibility with non-Linux platforms, add a stdint.h fallback.
> >
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> > ---
> > Changes in v2:
> > - Fix structure member alignments
> > - Keep compatibility with non-Linux platforms
> > - Link to v1: https://lore.kernel.org/r/20251222-uapi-fuse-v1-1-85a61b87baa0@xxxxxxxxxxxxx
> > ---
> > include/uapi/linux/fuse.h | 626 +++++++++++++++++++++++-----------------------
> > 1 file changed, 319 insertions(+), 307 deletions(-)
>
> I tested this and it breaks libfuse compilation
>
> https://github.com/libfuse/libfuse/pull/1410
>
> Any chance you could test libfuse compilation for v3? Easiest way is to
> copy it to <libfuse>/include/fuse_kernel.h and then create PR. That
> includes a BSD test.
>
>
> libfuse3.so.3.19.0.p/fuse_uring.c.o -c
> ../../../home/runner/work/libfuse/libfuse/lib/fuse_uring.c
> ../../../home/runner/work/libfuse/libfuse/lib/fuse_uring.c:197:5: error:
> format specifies type 'unsigned long' but the argument has type '__u64'
> (aka 'unsigned long long') [-Werror,-Wformat]
> 196 | fuse_log(FUSE_LOG_DEBUG, " unique: %" PRIu64
> ", result=%d\n",
> | ~~~~~~~~~
> 197 | out->unique, ent_in_out->payload_sz);
> | ^~~~~~~~~~~
> 1 error generated.
>
>
> I can certainly work it around in libfuse by adding a cast, IMHO,
> PRIu64 is the right format.

Or use 'unsigned long long' for the 64bit values and %llu for the format.
I'm pretty sure that works for all reasonable modern architectures.

You might still want to use the fuse_[us][8|16|32|64] names but they
can be defined directly as char/short/int/long long.

David


>
>
> Thanks,
> Bernd
>