Commit Graph

21 Commits

Author SHA1 Message Date
Bernd Schubert 20d8e6dc45 test_write_cache: fix cppcheck warnings
- Fix printf format specifiers for size_t (%zu instead of %zd)
- Add const to mountpoint parameter
- Reduce scope of rofd variable
- Move assertion out of assert to avoid side effects

Fixes cppcheck warnings:
- cppcheck-invalidPrintfArgType_sint (2 instances)
- cppcheck-constParameterPointer
- cppcheck-variableScope
- cppcheck-assignmentInAssert

Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2026-04-07 10:08:49 +02:00
izxl007 fc1c8da0cf license: s/COPYING/GPL2.txt, s/COPYING.LIB/LGPL2.txt
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
2025-06-27 09:47:00 +02:00
Bernd Schubert f68970cd23 fuse: Fix want flag conversion
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-24 09:38:06 +01:00
Bernd Schubert 5d1c49e54c test/test_write_cache.c: Reformat with clang-format
The file is going to be updated - should be more conform

Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-03-24 09:38:06 +01:00
Amir Goldstein aca2557ba4 Fix libfuse build with FUSE_USE_VERSION 30
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2025-01-03 00:30:17 +01:00
Bernd Schubert 24f5b129c4 Add 64-bit conn::{capable,want}_ext fields
The previous fields are left for ABI compatibility, although
it is not beautiful to add that complexity when we have to increase
the so-version as we had ABI breakage anyway.

example/printcap is simplified to use an array, as every line would
have needed to be modified anyway. Missing 'FUSE_CAP_PASSTHROUGH'
was added.

Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30 23:04:11 +01:00
CismonX 09e6583b54 Use off_t instead of loff_t
Since we're already enforcing 64-bit off_t, using loff_t
makes no difference.

Also loff_t is Linux-only, which breaks compatibility for *BSD.
2024-06-25 07:16:49 +02:00
Bernd Schubert a6ac2ec12d Fix undefined loff_t in test_write_cache.c on alpine
This fixes #899. Seems that Alpine (and maybe Fedora) need
_GNU_SOURCE to get loff_t.
2024-03-06 13:12:50 +01:00
Bernd Schubert 31bf17c744 Fix tests/test_write_cache in write back mode (#892)
This test could fail whenever a something (kernel, userspace) decides
to flush in between of two 2048B writes. These two writes are supposed
to be merged into a single 4906 byte write by the kernel writeback cache,
but _sometimes_ the test fails because 2048 byte writes get through.
Fixes #882

Solution here is a modification how the test works - instead
of requiring an exact aggregation of 2x2048B into 4096B,
it now writes 64x2048B and requires in write-back modes
the number of received writes requests is lower than 64 - we
can expect that at least some writes get aggregated, but we do
know how many.

Co-authored-by: Bernd Schubert <bschubert@ddn.com>
2024-02-26 19:09:00 +01:00
Nikolaus Rath 1cb6e17e0c Reduce default write size by half
Hopefully this will reduce test flakiness on CI.
2023-07-01 14:12:44 +01:00
Nikolaus Rath b51f69f620 Add missing include. 2023-07-01 14:10:47 +01:00
Bernd Schubert db35a37def Install a the configure_file (config.h) and use in headers
This addresses: https://github.com/libfuse/libfuse/issues/724

HAVE_LIBC_VERSIONED_SYMBOLS configures the library if to use
versioned symbols and is set at meson configuration time.
External filesystems (the main target, actually)
include fuse headers and the preprocessor
then acts on HAVE_LIBC_VERSIONED_SYMBOLS. Problem was now that
'config.h' was not distributed with libfuse and so
HAVE_LIBC_VERSIONED_SYMBOLS was never defined with external
tools and the preprocessor did the wrong decision.

This commit also increases the the minimal meson version,
as this depends on meson feature only available in 0.50

<quote 'meson' >
WARNING: Project specifies a minimum meson_
version '>= 0.42' but uses features which were added
 in newer versions:
 * 0.50.0: {'install arg in configure_file'}
</quote>

Additionally the config file has been renamed to "fuse_config.h"
to avoid clashes - 'config.h' is not very specific.
2023-01-28 09:35:34 +00:00
Amir Goldstein 435a14e029 Add test for FOPEN_NOFLUSH flag
Simulate write() delay and verify that close(rofd) does not
block waiting on pending writes.

The support for the flag was added in kernel v5.16-rc1.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2022-01-05 08:43:43 +02:00
Dr. David Alan Gilbert 252e978c54 State GPL version in comment (#485)
IN a bunch of comments we say 'under the terms of the GNU GPL', make
it clear this is GPLv2 (as LICENSE says).

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-03-13 16:46:44 +00:00
Rostislav Skudnov 055fcec831 test_write_cache: Use fuse_session_exit() to stop filesystem thread
Using fuse_session_exit() followed by fuse_session_unmount() ensures
that a proper cleanup and shutdown is performed.
2018-07-23 11:02:57 +01:00
Rostislav Skudnov c7ae066cb4 test_write_cache: Fix memory leaks 2018-07-23 11:02:57 +01:00
Nikolaus Rath 53de0adb1a Don't use -o auto_unmount under FreeBSD. 2017-08-24 20:50:44 +02:00
Brian Naylor cc96e8d783 Make tests build on bsd 2017-05-24 09:58:45 -07:00
Nikolaus Rath 1fe4258932 Don't hardcode test file name. 2016-11-06 21:01:38 -08:00
Nikolaus Rath d49f2e77b4 Unify handling of fuse_conn_info options
Instead of using command line options to modify struct fuse_conn_info
before and after calling the init() handler, we now give the file system
explicit control over this.
2016-10-15 16:49:23 -07:00
Nikolaus Rath 71064a41f8 Added write cache tests. 2016-10-10 11:07:38 -07:00