Re: [PATCH RESEND V12 2/8] fuse: 32-bit user space ioctl compat for fuse device

From: Alessio Balsini
Date: Wed Jan 27 2021 - 08:42:20 EST


On Wed, Jan 27, 2021 at 08:15:19PM +0800, qxy wrote:
> Hi Allesio,
>
> Thank you for your supply for 32-bit user space.
> Actually we have already met this issue on our product and we resolved it
> like this:
>
> Project *platform/external/libfuse*
> diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
> index e9d4f1a..fe0cb6d 100644
> --- a/include/fuse_kernel.h
> +++ b/include/fuse_kernel.h
> @@ -562,7 +562,11 @@
> uint32_t fd;
> /* For future implementation */
> uint32_t len;
> - void * vec;
> + union {
> + void * vec;
> + /* compatible for 32-bit libfuse and 64-bit kernel */
> + uint64_t padding;
> + };
> };
>
> However, if we need to use *vec in the future, we still need to do more in
> 32-bit libfuse to work with 64-bit kernel :(
>

Good point.
What I had in mind as a possible use was the possibility of enabling
passthrough for only a few regions of the file, similar to fuse2.
But it doesn't really make sense to define the data structure fields for
uncertain future extensions, so what we could do is:

struct fuse_passthrough_out {
+ uint32_t size; // Size of this data structure
uint32_t fd;
- /* For future implementation */
- uint32_t len;
- void *vec;
};

Similar to what "struct sched_attr" does.
This is probably the most flexible solution, that would allow to extend
this data structure in the future with no headaches both in kernel and
user space.
What do you think?

Thanks!
Alessio