From 949944ff3bde50d62f98b0cab15cef2959d40a2d Mon Sep 17 00:00:00 2001 From: legezywzh <94814730+legezywzh@users.noreply.github.com> Date: Sun, 2 Jun 2024 05:18:35 +0800 Subject: Fix compatibility issue around fuse_custom_io->clone_fd (#953) Fixes: 73cd124d0408 ("Add clone_fd to custom IO (#927)") Signed-off-by: Xiaoguang Wang --- include/fuse_lowlevel.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'include/fuse_lowlevel.h') diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index cb38115..e849617 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -24,6 +24,7 @@ #include "fuse_common.h" +#include #include #include #include @@ -2092,6 +2093,13 @@ fuse_session_new(struct fuse_args *args, return _fuse_session_new(args, op, op_size, &version, userdata); } +/* + * This should mostly not be called directly, but instead the + * fuse_session_custom_io() should be used. + */ +int fuse_session_custom_io_317(struct fuse_session *se, + const struct fuse_custom_io *io, size_t op_size, int fd); + /** * Set a file descriptor for the session. * @@ -2119,8 +2127,20 @@ fuse_session_new(struct fuse_args *args, * @return -errno if failed to allocate memory to store `io` * **/ -int fuse_session_custom_io(struct fuse_session *se, - const struct fuse_custom_io *io, int fd); +#if FUSE_MAKE_VERSION(3, 17) <= FUSE_USE_VERSION +static inline int fuse_session_custom_io(struct fuse_session *se, + const struct fuse_custom_io *io, size_t op_size, int fd) +{ + return fuse_session_custom_io_317(se, io, op_size, fd); +} +#else +static inline int fuse_session_custom_io(struct fuse_session *se, + const struct fuse_custom_io *io, int fd) +{ + return fuse_session_custom_io_317(se, io, + offsetof(struct fuse_custom_io, clone_fd), fd); +} +#endif /** * Mount a FUSE file system. -- cgit v1.2.3