aboutsummaryrefslogtreecommitdiffstats
path: root/include/fuse_lowlevel.h
diff options
context:
space:
mode:
authorBernd Schubert <bernd.schubert@fastmail.fm>2024-05-13 12:32:06 +0200
committerGitHub <noreply@github.com>2024-05-13 12:32:06 +0200
commit58f85bfa9b7dca9a216cd0bb4e38e9cdf4b661da (patch)
tree6b731982629b96315c70bca87280141e3240fcd7 /include/fuse_lowlevel.h
parent2bdec0bc22ce39b307e299ee9ec19d1c58b640de (diff)
downloadlibfuse-58f85bfa9b7dca9a216cd0bb4e38e9cdf4b661da.tar.gz
Add in the libfuse version a program was compiled with (#942)
The API stays the same, the libfuse version comes from inlined functions, which are defined fuse_lowlevel.h and fuse.h. As these inlined functions are defined in the header files they get added into the application, similar as if these were preprocessor macros. Macro vs inlined function is then just a style issue - I personally prefer the latter. fuse_session_new() -> static inlinei, in the application _fuse_session_new -> inside of libfuse fuse_new() -> static inline, in the application _fuse_new() -> inside of libfuse Note: Entirely untested is the fuse 30 api - we need a test for it. And we do not have any ABI tests at all. Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
Diffstat (limited to 'include/fuse_lowlevel.h')
-rw-r--r--include/fuse_lowlevel.h50
1 files changed, 46 insertions, 4 deletions
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 8ff111a..2ada62b 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -2005,6 +2005,36 @@ int fuse_parse_cmdline_312(struct fuse_args *args,
#endif
#endif
+/*
+ * This should mostly not be called directly, but instead the fuse_session_new()
+ * macro should be used, which fills in the libfuse version compilation
+ * is done against automatically.
+ */
+struct fuse_session *_fuse_session_new_317(struct fuse_args *args,
+ const struct fuse_lowlevel_ops *op,
+ size_t op_size,
+ struct libfuse_version *version,
+ void *userdata);
+
+/* Do not call this directly, but only through fuse_session_new() */
+#if (defined(LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS))
+struct fuse_session *
+_fuse_session_new(struct fuse_args *args,
+ const struct fuse_lowlevel_ops *op,
+ size_t op_size,
+ struct libfuse_version *version,
+ void *userdata);
+#else
+struct fuse_session *
+_fuse_session_new_317(struct fuse_args *args,
+ const struct fuse_lowlevel_ops *op,
+ size_t op_size,
+ struct libfuse_version *version,
+ void *userdata);
+#define _fuse_session_new(args, op, op_size, version, userdata) \
+ _fuse_session_new_317(args, op, op_size, version, userdata)
+#endif
+
/**
* Create a low level session.
*
@@ -2029,13 +2059,25 @@ int fuse_parse_cmdline_312(struct fuse_args *args,
* @param args argument vector
* @param op the (low-level) filesystem operations
* @param op_size sizeof(struct fuse_lowlevel_ops)
+ * @param version the libfuse version a file system server was compiled against
* @param userdata user data
- *
* @return the fuse session on success, NULL on failure
**/
-struct fuse_session *fuse_session_new(struct fuse_args *args,
- const struct fuse_lowlevel_ops *op,
- size_t op_size, void *userdata);
+static inline struct fuse_session *
+fuse_session_new(struct fuse_args *args,
+ const struct fuse_lowlevel_ops *op,
+ size_t op_size,
+ void *userdata)
+{
+ struct libfuse_version version = {
+ .major = FUSE_MAJOR_VERSION,
+ .minor = FUSE_MINOR_VERSION,
+ .hotfix = FUSE_HOTFIX_VERSION,
+ .padding = 0
+ };
+
+ return _fuse_session_new(args, op, op_size, &version, userdata);
+}
/**
* Set a file descriptor for the session.