Re: [RFC PATCH v1 2/5] selftests/filesystems: convert fusectl test to fuse3
Amir Goldstein <[email protected]> Tue, 21 Jul 2026 12:35:46 +0200
| Newsgroups | dev.linux.lists.fuse-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest |
|---|---|
| Message-ID | <CAOQ4uxiy3X7ZZ_E_jC8Gqa6S==jb-m4CZh8kwmAznUWxeSQB=w@mail.gmail.com> |
On Wed, Jul 8, 2026 at 3:11=E2=80=AFPM Luis Henriques <[email protected]> wro= te: > > Since it is probably not worth adding new fuse kselftests based on fuse2, > it is a good idea to convert the single existing test to fuse3. The > conversion is trivial, as it only requires some changes to function > signatures (the gettattr and truncate fuse operations), and to the filler= () > helper. > > Signed-off-by: Luis Henriques <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> > --- > .../testing/selftests/filesystems/fuse/Makefile | 8 ++++---- > .../selftests/filesystems/fuse/fuse_mnt.c | 17 ++++++++++------- > 2 files changed, 14 insertions(+), 11 deletions(-) > > diff --git a/tools/testing/selftests/filesystems/fuse/Makefile b/tools/te= sting/selftests/filesystems/fuse/Makefile > index 612aad69a93a..422cd1b1688d 100644 > --- a/tools/testing/selftests/filesystems/fuse/Makefile > +++ b/tools/testing/selftests/filesystems/fuse/Makefile > @@ -7,14 +7,14 @@ TEST_GEN_FILES :=3D fuse_mnt > > include ../../lib.mk > > -VAR_CFLAGS :=3D $(shell pkg-config fuse --cflags 2>/dev/null) > +VAR_CFLAGS :=3D $(shell pkg-config fuse3 --cflags 2>/dev/null) > ifeq ($(VAR_CFLAGS),) > -VAR_CFLAGS :=3D -D_FILE_OFFSET_BITS=3D64 -I/usr/include/fuse > +VAR_CFLAGS :=3D -D_FILE_OFFSET_BITS=3D64 -I/usr/include/fuse3 > endif > > -VAR_LDLIBS :=3D $(shell pkg-config fuse --libs 2>/dev/null) > +VAR_LDLIBS :=3D $(shell pkg-config fuse3 --libs 2>/dev/null) > ifeq ($(VAR_LDLIBS),) > -VAR_LDLIBS :=3D -lfuse -pthread > +VAR_LDLIBS :=3D -lfuse3 -pthread > endif > > $(OUTPUT)/fuse_mnt: CFLAGS +=3D $(VAR_CFLAGS) > diff --git a/tools/testing/selftests/filesystems/fuse/fuse_mnt.c b/tools/= testing/selftests/filesystems/fuse/fuse_mnt.c > index d12b17f30fad..5d335fa5cf05 100644 > --- a/tools/testing/selftests/filesystems/fuse/fuse_mnt.c > +++ b/tools/testing/selftests/filesystems/fuse/fuse_mnt.c > @@ -4,7 +4,7 @@ > * Creates a simple FUSE filesystem with a single read-write file (/test= ) > */ > > -#define FUSE_USE_VERSION 26 > +#define FUSE_USE_VERSION 31 > > #include <fuse.h> > #include <stdio.h> > @@ -20,7 +20,8 @@ static char *content; > static size_t content_size =3D 0; > static const char test_path[] =3D "/test"; > > -static int test_getattr(const char *path, struct stat *st) > +static int test_getattr(const char *path, struct stat *st, > + struct fuse_file_info *fi) > { > memset(st, 0, sizeof(*st)); > > @@ -41,14 +42,15 @@ static int test_getattr(const char *path, struct stat= *st) > } > > static int test_readdir(const char *path, void *buf, fuse_fill_dir_t fil= ler, > - off_t offset, struct fuse_file_info *fi) > + off_t offset, struct fuse_file_info *fi, > + enum fuse_readdir_flags flags) > { > if (strcmp(path, "/")) > return -ENOENT; > > - filler(buf, ".", NULL, 0); > - filler(buf, "..", NULL, 0); > - filler(buf, test_path + 1, NULL, 0); > + filler(buf, ".", NULL, 0, FUSE_FILL_DIR_DEFAULTS); > + filler(buf, "..", NULL, 0, FUSE_FILL_DIR_DEFAULTS); > + filler(buf, test_path + 1, NULL, 0, FUSE_FILL_DIR_DEFAULTS); > > return 0; > } > @@ -107,7 +109,8 @@ static int test_write(const char *path, const char *b= uf, size_t size, > return size; > } > > -static int test_truncate(const char *path, off_t size) > +static int test_truncate(const char *path, off_t size, > + struct fuse_file_info *fi) > { > if (strcmp(path, test_path) !=3D 0) > return -ENOENT; >