aboutsummaryrefslogtreecommitdiffstats
path: root/lib/util.h
AgeCommit message (Collapse)AuthorLines
2025-04-28Add support for ring creation in fuse_lowlevel.cBernd Schubert-1/+1
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-04-28Add a fuse_set_thread_name() helperBernd Schubert-1/+2
Avoid splattering the code with ifdef Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-04-28Add container_of and ROUND_UP macrosBernd Schubert-0/+6
Needed by follow up commits. container_of is actually just moved/consolidated to util.h. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-03-24fuse: Fix want flag conversionBernd Schubert-0/+27
32-bit conn->want flags been left to be ABI compatible to 3.10, even though the so version was changed. The more recent way is to use fuse_set_feature_flag(), which will use conn->want_ext. Given that we now have two flags (want and want_ext), we need to convert and that brought several issues - If the application sets conn->want, that needs to be set into the lower 32 bit of conn->want_ext. As the application might actually unset values, it really has to be a copy and not just 'or' - fixed now. - convert_to_conn_want_ext() actually needs to check for _modified_ conn->want and conn->want_ext - convert_to_conn_want_ext() must consider being called from high and lowlevel interfact, with different want_ext_default and want_default values. It is only a failure, if the application changed both, conn->want and conn->want_ext. This function was failing in issue #1171, because high level fuse_fs_init() was changing values and then lowlevel do_init() was incorrectly failing on that. This also adds a new test (test_want_conversion) and sets values into example/{hello.c,hello_ll.c} Also some more internal users of conn->want are converted to fuse_{set,unset}_feature_flag(). Closes: https://github.com/libfuse/libfuse/issues/1171 Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-03-14fuse_lowlevel: Simplify se->buf_reallocableBernd Schubert-0/+3
se->buf_reallocable is true when reading /dev/fuse is handled from internal functions - we can set the variable in fuse_session_receive_buf_internal(). With that we also don't need to have it an _Atomic variable anymore. In _fuse_session_receive_buf() we can use "bool internal" to check if the buffer can be re-allocated. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2024-12-18Allow to have page aligned writesBernd Schubert-0/+2
Read/writes IOs should be page aligned as fuse server might need to copy data to another buffer otherwise in order to fulfill network or device storage requirements. Simple reproducer is example/passthrough* and opening a file with O_DIRECT - without this change writing to that file failed with -EINVAL if the underlying file system was using ext4 (for passthrough_hp the 'passthrough' feature has to be disabled). The mis-alignment from fuse kernel is not ideal, but we can handle it by allocation one page more than needed and then using a buffer that is set up to compensate for kernel misalignment. This also only set se->buf_reallocable to true when called by a libfuse internal caller - we do not know what external callers are doing with the buffer - update to commit 0e0f43b79b9b
2024-10-11Add libfuse util strtol wrapperJoanne Koong-0/+1
Add a wrapper around strtol for more rigorous error checking and convert uses of atoi and strtol to use this instead.