aboutsummaryrefslogtreecommitdiffstats
path: root/include/fuse_common.h
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 /include/fuse_common.h
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 'include/fuse_common.h')
-rw-r--r--include/fuse_common.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 3f7260c..b40814f 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -23,7 +23,7 @@
#define FUSE_MAJOR_VERSION 3
/** Minor version of FUSE library interface */
-#define FUSE_MINOR_VERSION 11
+#define FUSE_MINOR_VERSION 12
#define FUSE_MAKE_VERSION(maj, min) ((maj) * 100 + (min))
#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
@@ -104,11 +104,20 @@ struct fuse_file_info {
uint32_t poll_events;
};
+
+
/**
* Configuration parameters passed to fuse_session_loop_mt() and
* fuse_loop_mt().
+ * Deprecated and replaced by a newer private struct in FUSE API
+ * version 312 (FUSE_MAKE_VERSION(3, 12)
*/
+#if FUSE_USE_VERSION < FUSE_MAKE_VERSION(3, 12)
+struct fuse_loop_config_v1; /* forward declarition */
struct fuse_loop_config {
+#else
+struct fuse_loop_config_v1 {
+#endif
/**
* whether to use separate device fds for each thread
* (may increase performance)
@@ -128,6 +137,7 @@ struct fuse_loop_config {
unsigned int max_idle_threads;
};
+
/**************************************************************************
* Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want' *
**************************************************************************/
@@ -834,6 +844,39 @@ int fuse_set_signal_handlers(struct fuse_session *se);
*/
void fuse_remove_signal_handlers(struct fuse_session *se);
+/**
+ * Create and set default config for fuse_session_loop_mt and fuse_loop_mt.
+ *
+ * @return anonymous config struct
+ */
+struct fuse_loop_config *fuse_loop_cfg_create(void);
+
+/**
+ * Free the config data structure
+ */
+void fuse_loop_cfg_destroy(struct fuse_loop_config *config);
+
+/**
+ * fuse_loop_config2 setter to set the number of max idle threads.
+ */
+void fuse_loop_cfg_set_idle_threads(struct fuse_loop_config *config,
+ unsigned int value);
+
+/**
+ * fuse_loop_config2 setter to enable the clone_fd feature
+ */
+void fuse_loop_cfg_set_clone_fd(struct fuse_loop_config *config,
+ unsigned int value);
+
+/**
+ * Convert old config to more recernt fuse_loop_config2
+ *
+ * @param config current config2 type
+ * @param v1_conf older config1 type (below FUSE API 312)
+ */
+void fuse_loop_cfg_convert(struct fuse_loop_config *config,
+ struct fuse_loop_config_v1 *v1_conf);
+
/* ----------------------------------------------------------- *
* Compatibility stuff *
* ----------------------------------------------------------- */