@@ -131,5 +131,13 @@ static inline bool fs_validate_description(const char *name,
#define fsparam_bdev(NAME, OPT) __fsparam(fs_param_is_blockdev, NAME, OPT, 0, NULL)
#define fsparam_path(NAME, OPT) __fsparam(fs_param_is_path, NAME, OPT, 0, NULL)
#define fsparam_fd(NAME, OPT) __fsparam(fs_param_is_fd, NAME, OPT, 0, NULL)
+/*
+ * Define two parameters with the same name, with types string and flag. The
+ * string parameter can be empty, and thus it effectively allows the parameter
+ * to have a value or to be empty.
+ */
+#define fsparam_string_or_flag(NAME, OPT) \
+ __fsparam(fs_param_is_string, NAME, OPT, fs_param_can_be_empty, NULL), \
+ fsparam_flag(NAME, OPT)
#endif /* _LINUX_FS_PARSER_H */
Add a new helper macro that defines two new parameters, both with the same name, but one of type 'string' and another of type 'flag'. The 'string' parameter may also be empty (i.e. without value). In practice this helper allows a filesystem to easily define a parameter that can be empty (flag) or have a value (string). Suggested-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Luis Henriques <lhenriques@suse.de> --- include/linux/fs_parser.h | 8 ++++++++ 1 file changed, 8 insertions(+)