summaryrefslogtreecommitdiff
path: root/fs/nfs/fs_context.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-09-06 22:12:08 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2020-02-07 00:12:50 -0500
commit2710c957a8ef4fb00f21acb306e3bd6bcf80c81f (patch)
treeda60d8ec6779b64cbc29ca2b161ed9b9c0b2834e /fs/nfs/fs_context.c
parent0f89589a8c6f1033cb847a606517998efb0da8ee (diff)
fs_parse: get rid of ->enums
Don't do a single array; attach them to fsparam_enum() entry instead. And don't bother trying to embed the names into those - it actually loses memory, with no real speedup worth mentioning. Simplifies validation as well. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfs/fs_context.c')
-rw-r--r--fs/nfs/fs_context.c62
1 files changed, 32 insertions, 30 deletions
diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
index 2c6dc1b6cc92..01c76885f54e 100644
--- a/fs/nfs/fs_context.c
+++ b/fs/nfs/fs_context.c
@@ -83,6 +83,34 @@ enum nfs_param {
Opt_wsize,
};
+enum {
+ Opt_local_lock_all,
+ Opt_local_lock_flock,
+ Opt_local_lock_none,
+ Opt_local_lock_posix,
+};
+
+static const struct fs_parameter_enum nfs_param_enums_local_lock[] = {
+ { "all", Opt_local_lock_all },
+ { "flock", Opt_local_lock_flock },
+ { "none", Opt_local_lock_none },
+ {}
+};
+
+enum {
+ Opt_lookupcache_all,
+ Opt_lookupcache_none,
+ Opt_lookupcache_positive,
+};
+
+static const struct fs_parameter_enum nfs_param_enums_lookupcache[] = {
+ { "all", Opt_lookupcache_all },
+ { "none", Opt_lookupcache_none },
+ { "pos", Opt_lookupcache_positive },
+ { "positive", Opt_lookupcache_positive },
+ {}
+};
+
static const struct fs_parameter_spec nfs_param_specs[] = {
fsparam_flag_no("ac", Opt_ac),
fsparam_u32 ("acdirmax", Opt_acdirmax),
@@ -98,13 +126,13 @@ static const struct fs_parameter_spec nfs_param_specs[] = {
fsparam_flag_no("cto", Opt_cto),
fsparam_flag ("fg", Opt_fg),
__fsparam(fs_param_is_string, "fsc", Opt_fscache,
- fs_param_neg_with_no|fs_param_v_optional),
+ fs_param_neg_with_no|fs_param_v_optional, NULL),
fsparam_flag ("hard", Opt_hard),
__fsparam(fs_param_is_flag, "intr", Opt_intr,
- fs_param_neg_with_no|fs_param_deprecated),
- fsparam_enum ("local_lock", Opt_local_lock),
+ fs_param_neg_with_no|fs_param_deprecated, NULL),
+ fsparam_enum ("local_lock", Opt_local_lock, nfs_param_enums_local_lock),
fsparam_flag_no("lock", Opt_lock),
- fsparam_enum ("lookupcache", Opt_lookupcache),
+ fsparam_enum ("lookupcache", Opt_lookupcache, nfs_param_enums_lookupcache),
fsparam_flag_no("migration", Opt_migration),
fsparam_u32 ("minorversion", Opt_minorversion),
fsparam_string("mountaddr", Opt_mountaddr),
@@ -145,35 +173,9 @@ static const struct fs_parameter_spec nfs_param_specs[] = {
{}
};
-enum {
- Opt_local_lock_all,
- Opt_local_lock_flock,
- Opt_local_lock_none,
- Opt_local_lock_posix,
-};
-
-enum {
- Opt_lookupcache_all,
- Opt_lookupcache_none,
- Opt_lookupcache_positive,
-};
-
-static const struct fs_parameter_enum nfs_param_enums[] = {
- { Opt_local_lock, "all", Opt_local_lock_all },
- { Opt_local_lock, "flock", Opt_local_lock_flock },
- { Opt_local_lock, "none", Opt_local_lock_none },
- { Opt_local_lock, "posix", Opt_local_lock_posix },
- { Opt_lookupcache, "all", Opt_lookupcache_all },
- { Opt_lookupcache, "none", Opt_lookupcache_none },
- { Opt_lookupcache, "pos", Opt_lookupcache_positive },
- { Opt_lookupcache, "positive", Opt_lookupcache_positive },
- {}
-};
-
static const struct fs_parameter_description nfs_fs_parameters = {
.name = "nfs",
.specs = nfs_param_specs,
- .enums = nfs_param_enums,
};
enum {