From 15f5c811239abca80eda2d988be7a9a9848f7c10 Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Thu, 19 Sep 2024 15:03:55 +0200 Subject: 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. --- include/fuse_common.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/fuse_common.h') 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 #if !defined(FUSE_H_) && !defined(FUSE_LOWLEVEL_H_) #error "Never include directly; use or 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 * * ----------------------------------------------------------- */ -- cgit v1.2.3