diff options
author | Bernd Schubert <bernd@bsbernd.com> | 2025-01-04 23:18:14 +0100 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-02-10 16:56:45 +0100 |
commit | 1d134a0ccf8fe95ceb1ea3cdd723cb30c5cfcdf1 (patch) | |
tree | 33a262883950fab4717f531084c63a9edd235ded /include/fuse.h | |
parent | 0cab87aeff36503a74222e181d5206b2c77c9bb9 (diff) | |
download | libfuse-1d134a0ccf8fe95ceb1ea3cdd723cb30c5cfcdf1.tar.gz |
Make fuse_main_real() not symboled
Addresses https://github.com/libfuse/libfuse/issues/1092
We actually don't need to make fuse_main_real() symboled, as it
is not part of the official API.
The inlined function now always calls into fuse_main_real_317
and the compat ABI function (which should also be available
for dlopen/dlsym) is now always compiled, independent if the
compiler/linker support versioned symbols.
Additionally, fuse_main_real() is also declared as inlined
function and a warning message is created when that function
is called.
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
Diffstat (limited to 'include/fuse.h')
-rw-r--r-- | include/fuse.h | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/include/fuse.h b/include/fuse.h index c3add84..969ed97 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -877,21 +877,32 @@ struct fuse_context { mode_t umask; }; -#if (defined(LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS)) /** * The real main function * * Do not call this directly, use fuse_main() */ -int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, - size_t op_size, struct libfuse_version *version, - void *user_data); -#else -int fuse_main_real_317(int argc, char *argv[], const struct fuse_operations *op, - size_t op_size, struct libfuse_version *version, void *user_data); -#define fuse_main_real(argc, argv, op, op_size, version, user_data) \ - fuse_main_real_317(argc, argv, op, op_size, version, user_data); -#endif +static inline int fuse_main_real(int argc, char *argv[], + const struct fuse_operations *op, + size_t op_size, void *user_data) +{ + struct libfuse_version version = { .major = FUSE_MAJOR_VERSION, + .minor = FUSE_MINOR_VERSION, + .hotfix = FUSE_HOTFIX_VERSION, + .padding = 0 }; + + fuse_log(FUSE_LOG_ERR, + "%s is a libfuse internal function, please use fuse_main()\n", + __func__); + + /* not declared globally, to restrict usage of this function */ + int fuse_main_real_317(int argc, char *argv[], + const struct fuse_operations *op, size_t op_size, + struct libfuse_version *version, + void *user_data); + + return fuse_main_real_317(argc, argv, op, op_size, &version, user_data); +} /** * Main function of FUSE. @@ -957,8 +968,14 @@ fuse_main(int argc, char *argv[], const struct fuse_operations *op, .hotfix = FUSE_HOTFIX_VERSION, .padding = 0 }; - return fuse_main_real(argc, argv, op, sizeof(*(op)), &version, - user_data); + + /* not declared globally, to restrict usage of this function */ + int fuse_main_real_317(int argc, char *argv[], + const struct fuse_operations *op, size_t op_size, + struct libfuse_version *version, + void *user_data); + return fuse_main_real_317(argc, argv, op, sizeof(*(op)), &version, + user_data); } /* ----------------------------------------------------------- * |