aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2016-10-02 16:13:22 +0100
committerMartin Pärtel <martin.partel@gmail.com>2016-10-02 16:13:22 +0100
commite1a3ff7f06fb970294e4217bbf6e2ede3543274b (patch)
tree036824ae49d157381a258e41c3b391256236c21d
parent50e4309ed0fb9f2570b250b5de14bf424e293427 (diff)
downloadbindfs-e1a3ff7f06fb970294e4217bbf6e2ede3543274b.tar.gz
Require at least FUSE 2.8, and 2.9 for lock forwarding.
Fixes #40.
-rw-r--r--ChangeLog5
-rw-r--r--configure.ac4
-rw-r--r--src/bindfs.c12
3 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c63e707..3633f60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-02 Martin Pärtel <martin dot partel at gmail dot com>
+
+ * Require FUSE 2.9 at compile-time.
+ * Also compile with FUSE 2.8, but without support for lock forwarding.
+
2016-09-25 Martin Pärtel <martin dot partel at gmail dot com>
* Fix bug in readdir() introduced with 1.13.1. This fixes a bug when
diff --git a/configure.ac b/configure.ac
index 59d3bdb..306f4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,9 @@ AC_COMPILE_IFELSE(
)
# Check for fuse
-PKG_CHECK_MODULES([fuse], [fuse >= 2.6.0])
+PKG_CHECK_MODULES([fuse], [fuse >= 2.9.0],
+ [AC_DEFINE([HAVE_FUSE_29], [1], [Have FUSE >= 2.9.0])],
+ [PKG_CHECK_MODULES([fuse], [fuse >= 2.8.0])])
AC_CONFIG_FILES([Makefile \
src/Makefile \
diff --git a/src/bindfs.c b/src/bindfs.c
index 004c771..460f362 100644
--- a/src/bindfs.c
+++ b/src/bindfs.c
@@ -1103,6 +1103,7 @@ static int bindfs_write(const char *path, const char *buf, size_t size,
return res;
}
+/* This callback is only installed if lock forwarding is enabled. */
static int bindfs_lock(const char *path, struct fuse_file_info *fi, int cmd,
struct flock *lock)
{
@@ -1113,6 +1114,7 @@ static int bindfs_lock(const char *path, struct fuse_file_info *fi, int cmd,
return 0;
}
+/* This callback is only installed if lock forwarding is enabled. */
static int bindfs_flock(const char *path, struct fuse_file_info *fi, int op)
{
int res = flock(fi->fh, op);
@@ -1378,8 +1380,10 @@ static struct fuse_operations bindfs_oper = {
.open = bindfs_open,
.read = bindfs_read,
.write = bindfs_write,
+#ifdef HAVE_FUSE_29
.lock = bindfs_lock,
.flock = bindfs_flock,
+#endif
.ioctl = bindfs_ioctl,
.statfs = bindfs_statfs,
.release = bindfs_release,
@@ -2220,6 +2224,7 @@ int main(int argc, char *argv[])
bindfs_oper.removexattr = NULL;
}
+#ifdef HAVE_FUSE_29
/* Check that lock forwarding is not enabled in single-threaded mode. */
if (settings.enable_lock_forwarding && !od.multithreaded) {
fprintf(stderr, "To use --enable-lock-forwarding, you must use "
@@ -2233,6 +2238,13 @@ int main(int argc, char *argv[])
bindfs_oper.lock = NULL;
bindfs_oper.flock = NULL;
}
+#else
+ if (settings.enable_lock_forwarding) {
+ fprintf(stderr, "To use --enable-lock-forwarding, bindfs must be "
+ "compiled with FUSE 2.9.0 or newer.\n");
+ return 1;
+ }
+#endif
/* Remove the ioctl implementation unless the user has enabled it */
if (!settings.enable_ioctl) {