From 2710c957a8ef4fb00f21acb306e3bd6bcf80c81f Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 6 Sep 2019 22:12:08 -0400 Subject: 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 --- mm/shmem.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'mm') 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) -- cgit v1.2.3