diff --git a/Makefile b/Makefile index 1463b76..f372179 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,19 @@ AR := ar DIST_CFLAGS := $(CFLAGS) DIST_CXXFLAGS := $(CXXFLAGS) -# Detect FUSE version -FUSE_VERSION := $(shell ./detect_fuse.sh) +# Detect FUSE version (can be overridden with FORCE_FUSE=2 or FORCE_FUSE=3) +ifdef FORCE_FUSE + ifeq ($(FORCE_FUSE),2) + FUSE_VERSION := FUSE2 + else ifeq ($(FORCE_FUSE),3) + FUSE_VERSION := FUSE3 + else + $(error FORCE_FUSE must be 2 or 3) + endif +else + FUSE_VERSION := $(shell ./detect_fuse.sh) +endif + ifeq ($(FUSE_VERSION),FUSE3) FUSE_CFLAGS := $(shell pkg-config --cflags fuse3) FUSE_LIBS := -lfuse3 diff --git a/pclsync/pfs.c b/pclsync/pfs.c index fb6f2b0..eadfc5e 100644 --- a/pclsync/pfs.c +++ b/pclsync/pfs.c @@ -28,8 +28,6 @@ DAMAGE. */ -#define FUSE_USE_VERSION 30 - #include #include #include @@ -94,6 +92,9 @@ typedef off_t fuse_off_t; static int shutdown_in_progress = 0; static struct fuse *psync_fuse = NULL; +#if FUSE_USE_VERSION < 30 +static struct fuse_chan *psync_fuse_channel = NULL; +#endif static char *psync_current_mountpoint = NULL; static psync_generic_callback_t psync_start_callback = NULL; char *pfs_fake_prefix = NULL; @@ -3600,7 +3601,8 @@ static void pfs_do_stop(void) { struct fuse_session *se = fuse_get_session(psync_fuse); fuse_session_unmount(se); #else - fuse_unmount(mp, fuse_get_session(psync_fuse)); + fuse_unmount(mp, psync_fuse_channel); + psync_fuse_channel = NULL; #endif clock_gettime(CLOCK_REALTIME, &ts); @@ -3862,6 +3864,7 @@ static int pfs_do_start() { fuse_unmount(mp, ch); goto err0; } + psync_fuse_channel = ch; #endif psync_current_mountpoint = mp; diff --git a/pclsync/pfsxattr.c b/pclsync/pfsxattr.c index 57e9b13..392d00b 100644 --- a/pclsync/pfsxattr.c +++ b/pclsync/pfsxattr.c @@ -29,8 +29,6 @@ DAMAGE. */ -#define FUSE_USE_VERSION 30 - #include #include #include