From e679a88d8816065f9c01a4c766a051074d4226f0 Mon Sep 17 00:00:00 2001 From: Graham Inggs Date: Tue, 13 Jul 2021 17:25:04 +0200 Subject: [PATCH] Switch from fuse2 to fuse3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fuse 3.0.0 was released in December 2016. The last maintenance release from the 2.9 branch was in January 2019, and users are encouraged to transition to the actively developed 3.x branch. https://github.com/libfuse/libfuse/releases/tag/fuse-2.9.9 Therefore, adapt cmsfs-fuse, hmcdrvfs, hsavmcore, zdsfs and zdump to the new API, and adapt associated Makefiles to link the new library. Closes: https://github.com/ibm-s390-linux/s390-tools/issues/116 GitHub-ID: https://github.com/ibm-s390-linux/s390-tools/pull/117 Link: https://bugs.launchpad.net/ubuntu/+source/s390-tools/+bug/1935666 [hoeppner@linux.ibm.com: Add links to commit message] Signed-off-by: Graham Inggs Signed-off-by: Jan Höppner --- cmsfs-fuse/Makefile | 13 +++++++------ cmsfs-fuse/cmsfs-fuse.c | 8 ++++---- hmcdrvfs/Makefile | 12 ++++++------ hmcdrvfs/hmcdrvfs.c | 6 +++--- hsavmcore/Makefile | 13 +++++++------ hsavmcore/overlay.c | 8 ++++---- zdsfs/Makefile | 13 +++++++------ zdsfs/zdsfs.c | 16 ++++++++-------- zdump/Makefile | 13 +++++++------ zdump/zfuse.c | 10 +++++----- 10 files changed, 58 insertions(+), 54 deletions(-) diff --git a/cmsfs-fuse/Makefile b/cmsfs-fuse/Makefile index 70426f7a..4ebe6b11 100644 --- a/cmsfs-fuse/Makefile +++ b/cmsfs-fuse/Makefile @@ -16,17 +16,18 @@ check_dep: $(call check_dep, \ "cmsfs-fuse", \ "fuse.h", \ - "fuse-devel or libfuse-dev", \ - "HAVE_FUSE=0") + "fuse3-devel or libfuse3-dev", \ + "HAVE_FUSE=0", \ + "-DFUSE_USE_VERSION=30") all: check_dep cmsfs-fuse ifneq ($(shell sh -c 'command -v pkg-config'),) -FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse) -FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse) +FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse3) +FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse3) else -FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -FUSE_LDLIBS = -lfuse +FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse3 +FUSE_LDLIBS = -lfuse3 endif ALL_CFLAGS += -DHAVE_SETXATTR $(FUSE_CFLAGS) LDLIBS += $(FUSE_LDLIBS) -lm diff --git a/cmsfs-fuse/cmsfs-fuse.c b/cmsfs-fuse/cmsfs-fuse.c index 67de9db4..1a8a6713 100644 --- a/cmsfs-fuse/cmsfs-fuse.c +++ b/cmsfs-fuse/cmsfs-fuse.c @@ -9,7 +9,7 @@ * it under the terms of the MIT license. See LICENSE for details. */ -#define FUSE_USE_VERSION 26 +#define FUSE_USE_VERSION 30 #include #include #include @@ -1516,7 +1516,7 @@ static void walk_dir_block(struct fst_entry *fst, struct walk_file *walk, decode_edf_name(file, fst->name, fst->type); if (!file_unlinked(file)) { cache_fst_addr(walk->addr, file); - walk->filler(walk->buf, file, NULL, 0); + walk->filler(walk->buf, file, NULL, 0, 0); } } } @@ -1800,8 +1800,8 @@ static int cmsfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, if (strcmp(path, "/") != 0) return -ENOENT; - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); + filler(buf, ".", NULL, 0, 0); + filler(buf, "..", NULL, 0, 0); memset(&walk, 0, sizeof(walk)); /* readdir is possible without open so fi->fh is not set */ diff --git a/hmcdrvfs/Makefile b/hmcdrvfs/Makefile index 3a1026b1..a95ab9ed 100644 --- a/hmcdrvfs/Makefile +++ b/hmcdrvfs/Makefile @@ -16,17 +16,17 @@ check_dep: $(call check_dep, \ "hmcdrvfs", \ "fuse.h", \ - "fuse-devel or libfuse-dev", \ + "fuse3-devel or libfuse3-dev", \ "HAVE_FUSE=0") ifneq ($(shell sh -c 'command -v pkg-config'),) -FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse) -FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse) +FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse3) +FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse3) else -FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -FUSE_LDLIBS = -lfuse +FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse3 +FUSE_LDLIBS = -lfuse3 endif -ALL_CFLAGS += -DFUSE_USE_VERSION=26 -D_LARGEFILE_SOURCE $(FUSE_CFLAGS) +ALL_CFLAGS += -DFUSE_USE_VERSION=30 -D_LARGEFILE_SOURCE $(FUSE_CFLAGS) LDLIBS += $(FUSE_LDLIBS) -lpthread -lrt -ldl -lm OBJECTS = hmcdrvfs.o diff --git a/hmcdrvfs/hmcdrvfs.c b/hmcdrvfs/hmcdrvfs.c index d988b648..ab6eaed3 100644 --- a/hmcdrvfs/hmcdrvfs.c +++ b/hmcdrvfs/hmcdrvfs.c @@ -990,7 +990,7 @@ static int hmcdrv_cache_dir(const char *dir, fuse_fill_dir_t filler, void *buf) hmcdrv_cache_refresh(path, &st, symlink); if ((filler != NULL) && - (filler(buf, fname, &st, 0) != 0)) + (filler(buf, fname, &st, 0, 0) != 0)) filler = NULL; /* stop filling */ #ifdef DEBUG strftime(symlink, sizeof(symlink), @@ -1179,8 +1179,8 @@ static int hmcdrv_fuse_readdir(const char *path, void *buf, { int ret; - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); + filler(buf, ".", NULL, 0, 0); + filler(buf, "..", NULL, 0, 0); pthread_mutex_lock(&hmcdrv_ctx.mutex); ret = hmcdrv_cache_dir(path, filler, buf); diff --git a/hsavmcore/Makefile b/hsavmcore/Makefile index 82e6abcd..666f0c0e 100644 --- a/hsavmcore/Makefile +++ b/hsavmcore/Makefile @@ -23,11 +23,11 @@ else # HAVE_FUSE # FUSE # ifneq ($(shell sh -c 'command -v pkg-config'),) - FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse) - FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse) + FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse3) + FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse3) else - FUSE_CFLAGS = -I/usr/include/fuse - FUSE_LDLIBS = -lfuse + FUSE_CFLAGS = -I/usr/include/fuse3 + FUSE_LDLIBS = -lfuse3 endif # @@ -67,8 +67,9 @@ check-dep-fuse: $(call check_dep, \ "hsavmcore", \ "fuse.h", \ - "fuse-devel or libfuse-dev", \ - "HAVE_FUSE=0") + "fuse3-devel or libfuse3-dev", \ + "HAVE_FUSE=0", \ + "-DFUSE_USE_VERSION=30") touch check-dep-fuse install: all diff --git a/hsavmcore/overlay.c b/hsavmcore/overlay.c index 8efd7529..1d963992 100644 --- a/hsavmcore/overlay.c +++ b/hsavmcore/overlay.c @@ -15,7 +15,7 @@ #include #include -#define FUSE_USE_VERSION 26 +#define FUSE_USE_VERSION 30 #include #include "lib/util_log.h" @@ -63,9 +63,9 @@ static int vmcore_fuse_readdir(const char *path, void *buf, return -ENOENT; /* We have only one file */ - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); - filler(buf, VMCORE_FILE, NULL, 0); + filler(buf, ".", NULL, 0, 0); + filler(buf, "..", NULL, 0, 0); + filler(buf, VMCORE_FILE, NULL, 0, 0); return 0; } diff --git a/zdsfs/Makefile b/zdsfs/Makefile index f4aefc4f..979329b0 100644 --- a/zdsfs/Makefile +++ b/zdsfs/Makefile @@ -30,8 +30,9 @@ check_dep: $(call check_dep, \ "zdsfs", \ "fuse.h", \ - "fuse-devel or libfuse-dev", \ - "HAVE_FUSE=0") + "fuse3-devel or libfuse3-dev", \ + "HAVE_FUSE=0", \ + "-DFUSE_USE_VERSION=30") $(call check_dep, \ "zdsfs", \ "curl/curl.h", \ @@ -39,13 +40,13 @@ check_dep: "HAVE_CURL=0") ifneq ($(shell sh -c 'command -v pkg-config'),) -FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse) -FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse) +FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse3) +FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse3) CURL_CFLAGS = $(shell pkg-config --silence-errors --cflags libcurl) CURL_LDLIBS = $(shell pkg-config --silence-errors --libs libcurl) else -FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -FUSE_LDLIBS = -lfuse +FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse3 +FUSE_LDLIBS = -lfuse3 CURL_CFLAGS = -I/usr/include/s390x-linux-gnu/curl CURL_LDLIBS = -lcurl endif diff --git a/zdsfs/zdsfs.c b/zdsfs/zdsfs.c index ceadd341..ee2909fd 100644 --- a/zdsfs/zdsfs.c +++ b/zdsfs/zdsfs.c @@ -8,7 +8,7 @@ */ /* The fuse version define tells fuse that we want to use the new API */ -#define FUSE_USE_VERSION 26 +#define FUSE_USE_VERSION 30 #include #include @@ -544,9 +544,9 @@ static int zdsfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, * type one: the root directory contains all data sets */ if (strcmp(path, "/") == 0) { - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); - filler(buf, METADATAFILE, NULL, 0); + filler(buf, ".", NULL, 0, 0); + filler(buf, "..", NULL, 0, 0); + filler(buf, METADATAFILE, NULL, 0, 0); /* note that we do not need to distinguish between * normal files and directories here, that is done * in the rdf_getattr function @@ -558,7 +558,7 @@ static int zdsfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, lzds_dataset_get_is_supported(ds, &issupported); if (issupported) { lzds_dataset_get_name(ds, &dsname); - filler(buf, dsname, NULL, 0); + filler(buf, dsname, NULL, 0, 0); } } lzds_dsiterator_free(dsit); @@ -572,14 +572,14 @@ static int zdsfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, return -ENOENT; lzds_dataset_get_is_PDS(ds, &ispds); if (ispds) { - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); + filler(buf, ".", NULL, 0, 0); + filler(buf, "..", NULL, 0, 0); rc = lzds_dataset_alloc_memberiterator(ds, &it); if (rc) return -ENOMEM; while (!lzds_memberiterator_get_next_member(it, &member)) { lzds_pdsmember_get_name(member, &mbrname); - filler(buf, mbrname, NULL, 0); + filler(buf, mbrname, NULL, 0, 0); } lzds_memberiterator_free(it); } else diff --git a/zdump/Makefile b/zdump/Makefile index 81700746..fd951402 100644 --- a/zdump/Makefile +++ b/zdump/Makefile @@ -15,8 +15,9 @@ check_dep_fuse: $(call check_dep, \ "zgetdump mount support", \ "fuse.h", \ - "fuse-devel or libfuse-dev", \ - "HAVE_FUSE=0") + "fuse3-devel or libfuse3-dev", \ + "HAVE_FUSE=0", \ + "-DFUSE_USE_VERSION=30") endif # @@ -58,11 +59,11 @@ ifeq ("$(HAVE_FUSE)","0") FUSE_CFLAGS = -DHAVE_FUSE=0 -D_FILE_OFFSET_BITS=64 FUSE_LDLIBS = else ifneq ($(shell sh -c 'command -v pkg-config'),) -FUSE_CFLAGS = -DHAVE_FUSE=1 $(shell pkg-config --silence-errors --cflags fuse) -FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse) +FUSE_CFLAGS = -DHAVE_FUSE=1 $(shell pkg-config --silence-errors --cflags fuse3) +FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse3) else -FUSE_CFLAGS = -DHAVE_FUSE=1 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -FUSE_LDLIBS = -lfuse +FUSE_CFLAGS = -DHAVE_FUSE=1 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse3 +FUSE_LDLIBS = -lfuse3 endif LDLIBS += -lz $(FUSE_LDLIBS) ALL_CFLAGS += $(FUSE_CFLAGS) diff --git a/zdump/zfuse.c b/zdump/zfuse.c index 35df4528..61dd009d 100644 --- a/zdump/zfuse.c +++ b/zdump/zfuse.c @@ -9,7 +9,7 @@ * it under the terms of the MIT license. See LICENSE for details. */ -#define FUSE_USE_VERSION 25 +#define FUSE_USE_VERSION 30 #include #include @@ -109,9 +109,9 @@ static int zfuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler, if (strcmp(path, "/") != 0) return -ENOENT; - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); - filler(buf, &l.path[1], NULL, 0); + filler(buf, ".", NULL, 0, 0); + filler(buf, "..", NULL, 0, 0); + filler(buf, &l.path[1], NULL, 0, 0); return 0; } @@ -214,7 +214,7 @@ int zfuse_mount_dump(void) stat_root_init(); stat_dump_init(); snprintf(l.path, sizeof(l.path), "/dump.%s", dfo_name()); - return fuse_main(args.argc, args.argv, &zfuse_ops); + return fuse_main(args.argc, args.argv, &zfuse_ops, NULL); } /*