diff options
author | Bernd Schubert <bschubert@ddn.com> | 2024-09-19 15:03:55 +0200 |
---|---|---|
committer | Bernd Schubert <bernd.schubert@fastmail.fm> | 2024-11-13 16:43:59 +0100 |
commit | 15f5c811239abca80eda2d988be7a9a9848f7c10 (patch) | |
tree | efc000f312d984f5cd4282fef5353e2c66aa60a7 /example/passthrough_hp.cc | |
parent | 82cca94678e6b914e76bfb3fdb5ac176568fe0e1 (diff) | |
download | libfuse-15f5c811239abca80eda2d988be7a9a9848f7c10.tar.gz |
Add fuse_set_feature_flag() / fuse_unset_feature_flag
Simplify setting feature flags a bit by adding a helper
function.
Also move the check for valid flags into a funtion we can re-use
in a later patch.
Diffstat (limited to 'example/passthrough_hp.cc')
-rw-r--r-- | example/passthrough_hp.cc | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/example/passthrough_hp.cc b/example/passthrough_hp.cc index bfaada5..1f6647f 100644 --- a/example/passthrough_hp.cc +++ b/example/passthrough_hp.cc @@ -190,36 +190,29 @@ static int get_fs_fd(fuse_ino_t ino) { static void sfs_init(void *userdata, fuse_conn_info *conn) { (void)userdata; - if (fs.passthrough && conn->capable & FUSE_CAP_PASSTHROUGH) - conn->want |= FUSE_CAP_PASSTHROUGH; - else + if (!fuse_set_feature_flag(conn, FUSE_CAP_PASSTHROUGH)) fs.passthrough = false; /* Passthrough and writeback cache are conflicting modes */ - if (fs.timeout && !fs.passthrough && - conn->capable & FUSE_CAP_WRITEBACK_CACHE) - conn->want |= FUSE_CAP_WRITEBACK_CACHE; + if (fs.timeout && !fs.passthrough) + fuse_set_feature_flag(conn, FUSE_CAP_WRITEBACK_CACHE); - if (conn->capable & FUSE_CAP_FLOCK_LOCKS) - conn->want |= FUSE_CAP_FLOCK_LOCKS; + fuse_set_feature_flag(conn, FUSE_CAP_FLOCK_LOCKS); if (fs.nosplice) { // FUSE_CAP_SPLICE_READ is enabled in libfuse3 by default, // see do_init() in in fuse_lowlevel.c // Just unset both, in case FUSE_CAP_SPLICE_WRITE would also get enabled // by default. - conn->want &= ~FUSE_CAP_SPLICE_READ; - conn->want &= ~FUSE_CAP_SPLICE_WRITE; + fuse_unset_feature_flag(conn, FUSE_CAP_SPLICE_READ); + fuse_unset_feature_flag(conn, FUSE_CAP_SPLICE_WRITE); } else { - if (conn->capable & FUSE_CAP_SPLICE_WRITE) - conn->want |= FUSE_CAP_SPLICE_WRITE; - if (conn->capable & FUSE_CAP_SPLICE_READ) - conn->want |= FUSE_CAP_SPLICE_READ; + fuse_set_feature_flag(conn, FUSE_CAP_SPLICE_WRITE); + fuse_set_feature_flag(conn, FUSE_CAP_SPLICE_READ); } /* This is a local file system - no network coherency needed */ - if (conn->capable & FUSE_CAP_DIRECT_IO_ALLOW_MMAP) - conn->want |= FUSE_CAP_DIRECT_IO_ALLOW_MMAP; + fuse_set_feature_flag(conn, FUSE_CAP_DIRECT_IO_ALLOW_MMAP); /* Disable the receiving and processing of FUSE_INTERRUPT requests */ conn->no_interrupt = 1; |