aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fuse.c
diff options
context:
space:
mode:
authorBernd Schubert <bschubert@ddn.com>2022-04-08 22:30:27 +0200
committerNikolaus Rath <Nikolaus@rath.org>2022-09-04 13:07:15 +0100
commit30a126c5f9009e8ff8e369c563eb941679bec252 (patch)
treeaa27206391ed90acf95a9339b13f1c4202c63105 /lib/fuse.c
parent7657ec158becdc59656c59dff40346fefde78cb2 (diff)
downloadlibfuse-30a126c5f9009e8ff8e369c563eb941679bec252.tar.gz
API update for fuse_loop_config additions
struct fuse_loop_config was passed as a plain struct, without any version identifer. This had two implications 1) Any addition of new parameters required a FUSE_SYMVER for fuse_session_loop_mt() and fuse_loop_mt() as otherwise a read beyond end-of previous struct size might have happened. 2) Filesystems also might have been recompiled and the developer might not have noticed the struct extensions and unexpected for the developer (or people recomliling the code) uninitialized parameters would have been passed. Code is updated to have struct fuse_loop_config as an opaque/private data type for file systems that want version 312 (FUSE_MAKE_VERSION(3, 12)). The deprecated fuse_loop_config_v1 is visible, but should not be used outside of internal conversion functions File systems that want version >= 32 < 312 get the previous struct (through ifdefs) and the #define of fuse_loop_mt and fuse_session_loop_mt ensures that these recompiled file systems call into the previous API, which then converts the struct. This is similar to existing compiled applications when just libfuse updated, but binaries it is solved with the FUSE_SYMVER ABI compact declarations. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
Diffstat (limited to 'lib/fuse.c')
-rw-r--r--lib/fuse.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/lib/fuse.c b/lib/fuse.c
index 1924caa..17850e3 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -4577,8 +4577,8 @@ int fuse_loop(struct fuse *f)
return fuse_session_loop(f->se);
}
-FUSE_SYMVER("fuse_loop_mt_32", "fuse_loop_mt@@FUSE_3.2")
-int fuse_loop_mt_32(struct fuse *f, struct fuse_loop_config *config)
+FUSE_SYMVER("fuse_loop_mt_312", "fuse_loop_mt@@FUSE_3.12")
+int fuse_loop_mt_312(struct fuse *f, struct fuse_loop_config *config)
{
if (f == NULL)
return -1;
@@ -4587,19 +4587,45 @@ int fuse_loop_mt_32(struct fuse *f, struct fuse_loop_config *config)
if (res)
return -1;
- res = fuse_session_loop_mt_32(fuse_get_session(f), config);
+ res = fuse_session_loop_mt_312(fuse_get_session(f), config);
fuse_stop_cleanup_thread(f);
return res;
}
+int fuse_loop_mt_32(struct fuse *f, struct fuse_loop_config_v1 *config_v1);
+FUSE_SYMVER("fuse_loop_mt_32", "fuse_loop_mt@FUSE_3.2")
+int fuse_loop_mt_32(struct fuse *f, struct fuse_loop_config_v1 *config_v1)
+{
+ struct fuse_loop_config *config = fuse_loop_cfg_create();
+ if (config == NULL)
+ return ENOMEM;
+
+ fuse_loop_cfg_convert(config, config_v1);
+
+ int res = fuse_loop_mt_312(f, config);
+
+ fuse_loop_cfg_destroy(config);
+
+ return res;
+}
+
int fuse_loop_mt_31(struct fuse *f, int clone_fd);
FUSE_SYMVER("fuse_loop_mt_31", "fuse_loop_mt@FUSE_3.0")
int fuse_loop_mt_31(struct fuse *f, int clone_fd)
{
- struct fuse_loop_config config;
- config.clone_fd = clone_fd;
- config.max_idle_threads = 10;
- return fuse_loop_mt_32(f, &config);
+ int err;
+ struct fuse_loop_config *config = fuse_loop_cfg_create();
+
+ if (config == NULL)
+ return ENOMEM;
+
+ fuse_loop_cfg_set_clone_fd(config, clone_fd);
+
+ err = fuse_loop_mt_312(f, config);
+
+ fuse_loop_cfg_destroy(config);
+
+ return err;
}
void fuse_exit(struct fuse *f)