diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-09-07 05:12:08 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-02-07 08:12:50 +0300 |
commit | 2710c957a8ef4fb00f21acb306e3bd6bcf80c81f (patch) | |
tree | da60d8ec6779b64cbc29ca2b161ed9b9c0b2834e /fs/gfs2/ops_fstype.c | |
parent | 0f89589a8c6f1033cb847a606517998efb0da8ee (diff) | |
download | linux-2710c957a8ef4fb00f21acb306e3bd6bcf80c81f.tar.xz |
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/gfs2/ops_fstype.c')
-rw-r--r-- | fs/gfs2/ops_fstype.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index e8b7b0ce8404..0df8f2df9491 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1271,6 +1271,13 @@ enum opt_quota { Opt_quota_on, }; +static const struct fs_parameter_enum gfs2_param_quota[] = { + {"off", Opt_quota_off }, + {"account", Opt_quota_account }, + {"on", Opt_quota_on }, + {} +}; + static const unsigned int opt_quota_values[] = { [Opt_quota_off] = GFS2_QUOTA_OFF, [Opt_quota_account] = GFS2_QUOTA_ACCOUNT, @@ -1282,11 +1289,23 @@ enum opt_data { Opt_data_ordered = GFS2_DATA_ORDERED, }; +static const struct fs_parameter_enum gfs2_param_data[] = { + {"writeback", Opt_data_writeback }, + {"ordered", Opt_data_ordered }, + {} +}; + enum opt_errors { Opt_errors_withdraw = GFS2_ERRORS_WITHDRAW, Opt_errors_panic = GFS2_ERRORS_PANIC, }; +static const struct fs_parameter_enum gfs2_param_errors[] = { + {"withdraw", Opt_errors_withdraw }, + {"panic", Opt_errors_panic }, + {} +}; + static const struct fs_parameter_spec gfs2_param_specs[] = { fsparam_string ("lockproto", Opt_lockproto), fsparam_string ("locktable", Opt_locktable), @@ -1300,11 +1319,11 @@ static const struct fs_parameter_spec gfs2_param_specs[] = { fsparam_flag ("upgrade", Opt_upgrade), fsparam_flag_no("acl", Opt_acl), fsparam_flag_no("suiddir", Opt_suiddir), - fsparam_enum ("data", Opt_data), + fsparam_enum ("data", Opt_data, gfs2_param_data), fsparam_flag ("meta", Opt_meta), fsparam_flag_no("discard", Opt_discard), fsparam_s32 ("commit", Opt_commit), - fsparam_enum ("errors", Opt_errors), + fsparam_enum ("errors", Opt_errors, gfs2_param_errors), fsparam_s32 ("statfs_quantum", Opt_statfs_quantum), fsparam_s32 ("statfs_percent", Opt_statfs_percent), fsparam_s32 ("quota_quantum", Opt_quota_quantum), @@ -1312,25 +1331,14 @@ static const struct fs_parameter_spec gfs2_param_specs[] = { fsparam_flag_no("rgrplvb", Opt_rgrplvb), fsparam_flag_no("loccookie", Opt_loccookie), /* quota can be a flag or an enum so it gets special treatment */ - __fsparam(fs_param_is_enum, "quota", Opt_quota, fs_param_neg_with_no|fs_param_v_optional), - {} -}; - -static const struct fs_parameter_enum gfs2_param_enums[] = { - { Opt_quota, "off", Opt_quota_off }, - { Opt_quota, "account", Opt_quota_account }, - { Opt_quota, "on", Opt_quota_on }, - { Opt_data, "writeback", Opt_data_writeback }, - { Opt_data, "ordered", Opt_data_ordered }, - { Opt_errors, "withdraw", Opt_errors_withdraw }, - { Opt_errors, "panic", Opt_errors_panic }, + __fsparam(fs_param_is_enum, "quota", Opt_quota, + fs_param_neg_with_no|fs_param_v_optional, gfs2_param_quota), {} }; static const struct fs_parameter_description gfs2_fs_parameters = { .name = "gfs2", .specs = gfs2_param_specs, - .enums = gfs2_param_enums, }; /* Parse a single mount parameter */ |