diff options
author | Bernd Schubert <bernd.schubert@fastmail.fm> | 2024-05-13 12:32:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-13 12:32:06 +0200 |
commit | 58f85bfa9b7dca9a216cd0bb4e38e9cdf4b661da (patch) | |
tree | 6b731982629b96315c70bca87280141e3240fcd7 /lib/fuse_lowlevel.c | |
parent | 2bdec0bc22ce39b307e299ee9ec19d1c58b640de (diff) | |
download | libfuse-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 'lib/fuse_lowlevel.c')
-rw-r--r-- | lib/fuse_lowlevel.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 46aef98..c08c99c 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -3024,9 +3024,12 @@ restart: return res; } -struct fuse_session *fuse_session_new(struct fuse_args *args, - const struct fuse_lowlevel_ops *op, - size_t op_size, void *userdata) +FUSE_SYMVER("_fuse_session_new_317", "_fuse_session_new@@FUSE_3.17") +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) { int err; struct fuse_session *se; @@ -3105,6 +3108,14 @@ struct fuse_session *fuse_session_new(struct fuse_args *args, se->userdata = userdata; se->mo = mo; + + /* Fuse server application should pass the version it was compiled + * against and pass it. If a libfuse version accidentally introduces an + * ABI incompatibility, it might be possible to 'fix' that at run time, + * by checking the version numbers. + */ + se->version = *version; + return se; out5: @@ -3120,6 +3131,22 @@ out1: return NULL; } +struct fuse_session *fuse_session_new_30(struct fuse_args *args, + const struct fuse_lowlevel_ops *op, + size_t op_size, + void *userdata); +FUSE_SYMVER("fuse_session_new_30", "fuse_session_new@FUSE_3.0") +struct fuse_session *fuse_session_new_30(struct fuse_args *args, + const struct fuse_lowlevel_ops *op, + size_t op_size, + void *userdata) +{ + /* unknown version */ + struct libfuse_version version = { 0 }; + + return _fuse_session_new_317(args, op, op_size, &version, userdata); +} + int fuse_session_custom_io(struct fuse_session *se, const struct fuse_custom_io *io, int fd) { |