diff options
author | Bernd Schubert <bschubert@ddn.com> | 2025-05-18 00:24:07 +0200 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-05-20 18:14:44 +0200 |
commit | baadab0492a495fda98216b351976d2e5d6d0866 (patch) | |
tree | 61017d2976439c6b7453b402aad5ecd3816b72ef /lib/fuse_i.h | |
parent | eadd6a5454373c7c404463c81be652275da5e07b (diff) | |
download | libfuse-baadab0492a495fda98216b351976d2e5d6d0866.tar.gz |
conn->want conversion: Fix fuse_apply_conn_info_opts()
fuse_apply_conn_info_opts() was applying to 'want_ext',
which would cause conflicts with 'want' if the application
applied its own flags to 'conn->want'.
Solution is:
- to move fuse_{set,unset,get}_feature_flag and
convert_to_conn_want_ext() to fuse_lowlevel.c and
to define them as part of the public API, although
convert_to_conn_want_ext() should not be used - it is
currently needed to be a public function due as it needs
to be defined for the tests.
Related to https://github.com/libfuse/libfuse/issues/1171 and
https://github.com/libfuse/libfuse/pull/1172.
Closes: https://github.com/libfuse/libfuse/issues/1171
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
Diffstat (limited to 'lib/fuse_i.h')
-rw-r--r-- | lib/fuse_i.h | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/lib/fuse_i.h b/lib/fuse_i.h index 14d99ad..80ec803 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -106,6 +106,13 @@ struct fuse_session { /* io_uring */ struct fuse_session_uring uring; + + /* + * conn->want and conn_want_ext options set by libfuse , needed + * to correctly convert want to want_ext + */ + uint32_t conn_want; + uint64_t conn_want_ext; }; struct fuse_chan { @@ -250,36 +257,5 @@ int fuse_loop_cfg_verify(struct fuse_loop_config *config); /* room needed in buffer to accommodate header */ #define FUSE_BUFFER_HEADER_SIZE 0x1000 -/** - * Get the wanted capability flags, converting from old format if necessary - */ -static inline int convert_to_conn_want_ext(struct fuse_conn_info *conn, - uint64_t want_ext_default, - uint32_t want_default) -{ - /* - * Convert want to want_ext if necessary. - * For the high level interface this function might be called - * twice, once from the high level interface and once from the - * low level interface. Both, with different want_ext_default and - * want_default values. In order to suppress a failure for the - * second call, we check if the lower 32 bits of want_ext are - * already set to the value of want. - */ - if (conn->want != want_default && - fuse_lower_32_bits(conn->want_ext) != conn->want) { - if (conn->want_ext != want_ext_default) - return -EINVAL; - - /* high bits from want_ext, low bits from want */ - conn->want_ext = fuse_higher_32_bits(conn->want_ext) | - conn->want; - } - - /* ensure there won't be a second conversion */ - conn->want = fuse_lower_32_bits(conn->want_ext); - - return 0; -} #endif /* LIB_FUSE_I_H_*/ |