Add support for true/false & yes/no in bool-type options
PATCH 1/1 Add support for true/false & yes/no in bool-type options
Currently, when using bcachefs-tools to set options, bool-type options can only accept 1 or 0. Add support for accepting true/false and yes/no for these options.
--- libbcachefs/opts.c | 5 +++++ 1 file changed, 5 insertions(+)
libbcachefs/opts.c +5 -0
@@ -332,6 +332,11 @@ int bch2_opt_parse(struct bch_fs *c,switch (opt->type) {case BCH_OPT_BOOL :if (val) { +if (!strcmp (val,"true" ) || !strcmp (val,"yes" )) + val ="1" ; +else if (!strcmp (val,"false" ) || !strcmp (val,"no" )) + val ="0" ; + ret =kstrtou64 (val,10 , res); }else { ret =0 ;
Signature · 1 line
2.45.2
Quoted 3 lines · Integral
Currently, when using bcachefs-tools to set options, bool-type options can only accept 1 or 0. Add support for accepting true/false and yes/no for these options.
this needs to be against the kernel repo, fs/bcachefs/; tools is imported from there
Quoted 24 lines
--- libbcachefs/opts.c | 5 +++++ 1 file changed, 5 insertions(+)libbcachefs/opts.c +5
-0@@ -332,6 +332,11 @@ int bch2_opt_parse(struct bch_fs *c,switch (opt->type) {case BCH_OPT_BOOL :if (val) { +if (!strcmp (val,"true" ) || !strcmp (val,"yes" )) + val ="1" ; +else if (!strcmp (val,"false" ) || !strcmp (val,"no" )) + val ="0" ; + ret =kstrtou64 (val,10 , res); }else { ret =0 ;Signature · 1 line
2.45.2