aboutsummaryrefslogtreecommitdiffstats
path: root/src
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 /src
parent50e4309ed0fb9f2570b250b5de14bf424e293427 (diff)
downloadbindfs-e1a3ff7f06fb970294e4217bbf6e2ede3543274b.tar.gz
Require at least FUSE 2.8, and 2.9 for lock forwarding.
Fixes #40.
Diffstat (limited to 'src')
-rw-r--r--src/bindfs.c12
1 files changed, 12 insertions, 0 deletions
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) {