diff options
author | Christian Brauner <brauner@kernel.org> | 2024-10-14 11:40:56 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-10-14 16:31:15 +0200 |
commit | c2f8fde8689272a55b9319b69dfe7e8f0e2e9dfe (patch) | |
tree | 7febbbcce74400887f7da55c3a8c37857ad037f3 /fs/fs_parser.c | |
parent | 8cf0b93919e13d1e8d4466eb4080a4c4d9d66d7b (diff) |
fs: add helper to use mount option as path or fd
Allow filesystems to use a mount option either as a
file or path.
Link: https://lore.kernel.org/r/20241014-work-overlayfs-v3-1-32b3fed1286e@kernel.org
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/fs_parser.c')
-rw-r--r-- | fs/fs_parser.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/fs_parser.c b/fs/fs_parser.c index 24727ec34e5a..8f583b814e6e 100644 --- a/fs/fs_parser.c +++ b/fs/fs_parser.c @@ -308,6 +308,26 @@ int fs_param_is_fd(struct p_log *log, const struct fs_parameter_spec *p, } EXPORT_SYMBOL(fs_param_is_fd); +int fs_param_is_file_or_string(struct p_log *log, + const struct fs_parameter_spec *p, + struct fs_parameter *param, + struct fs_parse_result *result) +{ + switch (param->type) { + case fs_value_is_string: + return fs_param_is_string(log, p, param, result); + case fs_value_is_file: + result->uint_32 = param->dirfd; + if (result->uint_32 <= INT_MAX) + return 0; + break; + default: + break; + } + return fs_param_bad_value(log, param); +} +EXPORT_SYMBOL(fs_param_is_file_or_string); + int fs_param_is_uid(struct p_log *log, const struct fs_parameter_spec *p, struct fs_parameter *param, struct fs_parse_result *result) { |