diff options
author | legezywzh <94814730+legezywzh@users.noreply.github.com> | 2024-06-02 05:18:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-01 23:18:35 +0200 |
commit | 949944ff3bde50d62f98b0cab15cef2959d40a2d (patch) | |
tree | c0d2290d2e5b2da2817ed6a199cb140681baec86 /include | |
parent | 251d2fb0e15316a479cb16476d880d432da62fb6 (diff) | |
download | libfuse-949944ff3bde50d62f98b0cab15cef2959d40a2d.tar.gz |
Fix compatibility issue around fuse_custom_io->clone_fd (#953)
Fixes: 73cd124d0408 ("Add clone_fd to custom IO (#927)")
Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/fuse_lowlevel.h | 24 |
1 files changed, 22 insertions, 2 deletions
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 <stddef.h> #include <utime.h> #include <fcntl.h> #include <sys/types.h> @@ -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. |