[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <29077ea9-3c6a-442b-9f6d-493da6bf262d@app.fastmail.com>
Date: Tue, 23 Dec 2025 10:23:43 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
"Bernd Schubert" <bernd@...ernd.com>
Cc: "Miklos Szeredi" <miklos@...redi.hu>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fuse: uapi: use UAPI types
On Tue, Dec 23, 2025, at 09:37, Thomas Weißschuh wrote:
> On Mon, Dec 22, 2025 at 10:16:39PM +0100, Bernd Schubert wrote:
>
> What about the following aproach:
>
> #if defined(__KERNEL__)
> #include <linux/types.h>
> #elif defined(__linux__)
> #include <linux/types.h>
> #else
> #include <stdint.h>
> typedef uint32_t __u32;
> ...
> #endif
>
> (borrowed from include/uapi/drm/drm.h, the identical #if/#elif branches are
> necessary for unifdef.
>
> This works correctly when (cross-)compiling the kernel itself. It also uses
> the standard UAPI types when used from Linux userspace and also works on
> non-Linux userspace. And the header can still be copied into libfuse as is.
Yes, I think that may be the best we can do here. I was wondering whether
The above can be simplified into '#if defined(__KERNEL__) || defined(__linux__'
but according to 00c9672606f7 ("drm: Untangle __KERNEL__ guards") it needs
to be two separate blocks.
Another header with the same problem is include/uapi/linux/coda.h,
which already has special cases for (at least) djgpp, cygwin and netbsd.
I have no idea if there is any hope of keeping that one generic and
while allowing it to be checked with nolibc. It looks like that one
has already diverged from the userspace version at
https://github.com/cmusatyalab/coda/blob/master/coda-src/kerndep/coda.h
which uses the c99 uint32_t instead of the BSD u_int32_t.
This hack got it to build with nolibc:
--- a/include/uapi/linux/coda.h
+++ b/include/uapi/linux/coda.h
@@ -114,6 +114,12 @@ typedef short int16_t;
typedef unsigned short u_int16_t;
typedef int int32_t;
typedef unsigned int u_int32_t;
+typedef long long int64_t;
+typedef unsigned long long u_int64_t;
+typedef u_int16_t u_short;
+typedef unsigned long u_long;
+typedef u_long ino_t;
+typedef void * caddr_t;
#endif
Arnd
Powered by blists - more mailing lists