diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-12 21:48:32 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:07 -0400 |
commit | 9f343e24f541bef3d5f081925eae5734c2c39c28 (patch) | |
tree | 50acbc53466bed838042a96a789d43c016ec8c61 /fs/bcachefs/opts.c | |
parent | 8479938d7a0f6c6cf6362c72880e753b3d7a707a (diff) | |
download | linux-9f343e24f541bef3d5f081925eae5734c2c39c28.tar.gz linux-9f343e24f541bef3d5f081925eae5734c2c39c28.tar.bz2 linux-9f343e24f541bef3d5f081925eae5734c2c39c28.zip |
bcachefs: bch_opt_fn
Minor refactoring to get rid of some unneeded token pasting.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/opts.c')
-rw-r--r-- | fs/bcachefs/opts.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c index 0c0c83fa4264..96c2f3c2fbce 100644 --- a/fs/bcachefs/opts.c +++ b/fs/bcachefs/opts.c @@ -167,11 +167,9 @@ const struct bch_option bch2_opt_table[] = { #define OPT_UINT(_min, _max) .type = BCH_OPT_UINT, \ .min = _min, .max = _max #define OPT_STR(_choices) .type = BCH_OPT_STR, \ - .min = 0, .max = ARRAY_SIZE(_choices),\ + .min = 0, .max = ARRAY_SIZE(_choices), \ .choices = _choices -#define OPT_FN(_fn) .type = BCH_OPT_FN, \ - .parse = _fn##_parse, \ - .to_text = _fn##_to_text +#define OPT_FN(_fn) .type = BCH_OPT_FN, .fn = _fn #define x(_name, _bits, _flags, _type, _sb_opt, _default, _hint, _help) \ [Opt_##_name] = { \ @@ -298,10 +296,7 @@ int bch2_opt_parse(struct bch_fs *c, *res = ret; break; case BCH_OPT_FN: - if (!c) - return 0; - - ret = opt->parse(c, val, res); + ret = opt->fn.parse(c, val, res, err); if (ret < 0) { if (err) prt_printf(err, "%s: parse error", @@ -344,7 +339,7 @@ void bch2_opt_to_text(struct printbuf *out, prt_printf(out, "%s", opt->choices[v]); break; case BCH_OPT_FN: - opt->to_text(out, c, sb, v); + opt->fn.to_text(out, c, sb, v); break; default: BUG(); |