summaryrefslogtreecommitdiffstats
path: root/mm/shmem.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 /mm/shmem.c
parent0f89589a8c6f1033cb847a606517998efb0da8ee (diff)
downloadlinux-stable-2710c957a8ef4fb00f21acb306e3bd6bcf80c81f.tar.gz
linux-stable-2710c957a8ef4fb00f21acb306e3bd6bcf80c81f.tar.bz2
linux-stable-2710c957a8ef4fb00f21acb306e3bd6bcf80c81f.zip
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 'mm/shmem.c')
-rw-r--r--mm/shmem.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 8793e8cc1a48..1c02c6c20f45 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3381,9 +3381,19 @@ enum shmem_param {
Opt_uid,
};
+static const struct fs_parameter_enum shmem_param_enums_huge[] = {
+ {"never", SHMEM_HUGE_NEVER },
+ {"always", SHMEM_HUGE_ALWAYS },
+ {"within_size", SHMEM_HUGE_WITHIN_SIZE },
+ {"advise", SHMEM_HUGE_ADVISE },
+ {"deny", SHMEM_HUGE_DENY },
+ {"force", SHMEM_HUGE_FORCE },
+ {}
+};
+
static const struct fs_parameter_spec shmem_param_specs[] = {
fsparam_u32 ("gid", Opt_gid),
- fsparam_enum ("huge", Opt_huge),
+ fsparam_enum ("huge", Opt_huge, shmem_param_enums_huge),
fsparam_u32oct("mode", Opt_mode),
fsparam_string("mpol", Opt_mpol),
fsparam_string("nr_blocks", Opt_nr_blocks),
@@ -3393,18 +3403,9 @@ static const struct fs_parameter_spec shmem_param_specs[] = {
{}
};
-static const struct fs_parameter_enum shmem_param_enums[] = {
- { Opt_huge, "never", SHMEM_HUGE_NEVER },
- { Opt_huge, "always", SHMEM_HUGE_ALWAYS },
- { Opt_huge, "within_size", SHMEM_HUGE_WITHIN_SIZE },
- { Opt_huge, "advise", SHMEM_HUGE_ADVISE },
- {}
-};
-
const struct fs_parameter_description shmem_fs_parameters = {
.name = "tmpfs",
.specs = shmem_param_specs,
- .enums = shmem_param_enums,
};
static int shmem_parse_one(struct fs_context *fc, struct fs_parameter *param)