Switch from fuse2 to fuse3

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 <ginggs@debian.org>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Graham Inggs
2021-07-13 17:25:04 +02:00
committed by Jan Höppner
parent 6acf6ed76d
commit e679a88d88
10 changed files with 58 additions and 54 deletions

View File

@@ -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

View File

@@ -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 <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -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 */

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -15,7 +15,7 @@
#include <fcntl.h>
#include <unistd.h>
#define FUSE_USE_VERSION 26
#define FUSE_USE_VERSION 30
#include <fuse.h>
#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;
}

View File

@@ -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

View File

@@ -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 <errno.h>
#include <fcntl.h>
@@ -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

View File

@@ -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)

View File

@@ -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 <errno.h>
#include <fcntl.h>
@@ -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);
}
/*