aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBernd Schubert <bschubert@ddn.com>2024-09-19 15:03:55 +0200
committerBernd Schubert <bernd.schubert@fastmail.fm>2024-11-13 16:43:59 +0100
commit15f5c811239abca80eda2d988be7a9a9848f7c10 (patch)
treeefc000f312d984f5cd4282fef5353e2c66aa60a7 /include
parent82cca94678e6b914e76bfb3fdb5ac176568fe0e1 (diff)
downloadlibfuse-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 'include')
-rw-r--r--include/fuse_common.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 38bac4e..1abac5a 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -7,6 +7,7 @@
/** @file */
+#include <stdbool.h>
#if !defined(FUSE_H_) && !defined(FUSE_LOWLEVEL_H_)
#error "Never include <fuse_common.h> directly; use <fuse.h> or <fuse_lowlevel.h> instead."
#endif
@@ -1034,6 +1035,23 @@ void fuse_loop_cfg_convert(struct fuse_loop_config *config,
struct fuse_loop_config_v1 *v1_conf);
#endif
+
+static inline bool fuse_set_feature_flag(struct fuse_conn_info *conn,
+ uint64_t flag)
+{
+ if (conn->capable & flag) {
+ conn->want |= flag;
+ return true;
+ }
+ return false;
+}
+
+static inline void fuse_unset_feature_flag(struct fuse_conn_info *conn,
+ uint64_t flag)
+{
+ conn->want &= ~flag;
+}
+
/* ----------------------------------------------------------- *
* Compatibility stuff *
* ----------------------------------------------------------- */