From: Bernd Schubert Date: Sat, 4 Jan 2025 19:29:18 +0000 (+0100) Subject: Avoid global declarion of internal functions that are new in 3.17 X-Git-Tag: fuse-3.17.1-rc0~22 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0dd19282594430fe2e2b3aa7f2def466675dcadf;p=qemu-gpiodev%2Flibfuse.git Avoid global declarion of internal functions that are new in 3.17 _fuse_new() is not supposed to be called by external users outside of internal functions or static inlined functions. This also removes several functions from lib/fuse_versionscript which where added and exported by commit 58f85bfa9b7d ("Add in the libfuse version a program...) as these are libfuse internal only. Signed-off-by: Bernd Schubert --- diff --git a/include/fuse.h b/include/fuse.h index dbfa439..c3add84 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -76,7 +76,7 @@ enum fuse_fill_dir_flags { * stream. It does not need to be the actual physical position. A * value of zero is reserved to indicate that seeking in directories * is not supported. - * + * * @param buf the buffer passed to the readdir() operation * @param name the file name of the directory entry * @param stbuf file attributes, can be NULL @@ -192,7 +192,7 @@ struct fuse_config { * have to guarantee uniqueness, however some applications * rely on this value being unique for the whole filesystem. * - * Note that this does *not* affect the inode that libfuse + * Note that this does *not* affect the inode that libfuse * and the kernel use internally (also called the "nodeid"). */ int32_t use_ino; @@ -522,9 +522,9 @@ struct fuse_operations { * * Flush is called on each close() of a file descriptor, as opposed to * release which is called on the close of the last file descriptor for - * a file. Under Linux, errors returned by flush() will be passed to + * a file. Under Linux, errors returned by flush() will be passed to * userspace as errors from close(), so flush() is a good place to write - * back any cached dirty data. However, many applications ignore errors + * back any cached dirty data. However, many applications ignore errors * on close(), and on non-Linux systems, close() may succeed even if flush() * returns an error. For these reasons, filesystems should not assume * that errors returned by flush will ever be noticed or even @@ -978,11 +978,6 @@ fuse_main(int argc, char *argv[], const struct fuse_operations *op, */ void fuse_lib_help(struct fuse_args *args); -struct fuse *_fuse_new(struct fuse_args *args, - const struct fuse_operations *op, - size_t op_size, struct libfuse_version *version, - void *user_data); - /** * Create a new FUSE filesystem. * @@ -1021,6 +1016,12 @@ fuse_new(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) { + /* not declared globally, to restrict usage of this function */ + struct fuse *_fuse_new(struct fuse_args *args, + const struct fuse_operations *op, size_t op_size, + struct libfuse_version *version, + void *user_data); + struct libfuse_version version = { .major = FUSE_MAJOR_VERSION, .minor = FUSE_MINOR_VERSION, @@ -1044,6 +1045,12 @@ fuse_new(struct fuse_args *args, .padding = 0 }; + /* not declared globally, to restrict usage of this function */ + struct fuse *_fuse_new(struct fuse_args *args, + const struct fuse_operations *op, size_t op_size, + struct libfuse_version *version, + void *user_data); + return _fuse_new(args, op, op_size, &version, user_data); } #else /* LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS */ diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 3d398de..0fa2039 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -2045,26 +2045,8 @@ 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 +#if (!defined(LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS)) struct fuse_session * _fuse_session_new_317(struct fuse_args *args, const struct fuse_lowlevel_ops *op, @@ -2116,6 +2098,12 @@ fuse_session_new(struct fuse_args *args, .padding = 0 }; + /* not declared globally, to restrict usage of this function */ + 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); + return _fuse_session_new(args, op, op_size, &version, userdata); } diff --git a/lib/fuse.c b/lib/fuse.c index aa5c611..8fbc035 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -5009,6 +5009,12 @@ struct fuse *_fuse_new_317(struct fuse_args *args, f->conf.readdir_ino = 1; #endif + /* not declared globally, to restrict usage of this function */ + 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); + f->se = _fuse_session_new(args, &llop, sizeof(llop), version, f); if (f->se == NULL) goto out_free_fs; diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index d84c678..c993860 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -3248,10 +3248,15 @@ int fuse_session_receive_buf_internal(struct fuse_session *se, 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) + const struct fuse_lowlevel_ops *op, + size_t op_size, + struct libfuse_version *version, + void *userdata); +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; diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript index 14cbca1..f20e2b4 100644 --- a/lib/fuse_versionscript +++ b/lib/fuse_versionscript @@ -189,11 +189,11 @@ FUSE_3.12 { FUSE_3.17 { global: +#if !defined(LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS) _fuse_session_new_317; - _fuse_new; - _fuse_new_30; _fuse_new_317; fuse_main_real_317; +#endif fuse_passthrough_open; fuse_passthrough_close; fuse_session_custom_io_30; diff --git a/lib/helper.c b/lib/helper.c index e84c857..2794e66 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -344,6 +344,10 @@ int fuse_main_real_317(int argc, char *argv[], const struct fuse_operations *op, goto out1; } + struct fuse *_fuse_new(struct fuse_args *args, + const struct fuse_operations *op, size_t op_size, + struct libfuse_version *version, + void *user_data); fuse = _fuse_new(&args, op, op_size, version, user_data); if (fuse == NULL) { res = 3;