]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/opts.c
Update bcachefs sources to 8dbfede1d9 fixup! bcachefs: More info on check_bucket_ref...
[bcachefs-tools-debian] / libbcachefs / opts.c
index 407b221e8f6c9ced8d00e3c9db66c9d225abc3fc..04e2989cd6b392703592c134b211eefce3d26220 100644 (file)
@@ -9,8 +9,6 @@
 #include "super-io.h"
 #include "util.h"
 
-#include <linux/pretty-printers.h>
-
 #define x(t, n) [n] = #t,
 
 const char * const bch2_metadata_versions[] = {
@@ -271,8 +269,9 @@ int bch2_opt_parse(struct bch_fs *c,
        case BCH_OPT_BOOL:
                ret = kstrtou64(val, 10, res);
                if (ret < 0 || (*res != 0 && *res != 1)) {
-                       prt_printf(err, "%s: must be bool",
-                              opt->attr.name);
+                       if (err)
+                               prt_printf(err, "%s: must be bool",
+                                          opt->attr.name);
                        return ret;
                }
                break;
@@ -283,7 +282,7 @@ int bch2_opt_parse(struct bch_fs *c,
                if (ret < 0) {
                        if (err)
                                prt_printf(err, "%s: must be a number",
-                                      opt->attr.name);
+                                          opt->attr.name);
                        return ret;
                }
                break;
@@ -292,7 +291,7 @@ int bch2_opt_parse(struct bch_fs *c,
                if (ret < 0) {
                        if (err)
                                prt_printf(err, "%s: invalid selection",
-                                      opt->attr.name);
+                                          opt->attr.name);
                        return ret;
                }
 
@@ -306,7 +305,7 @@ int bch2_opt_parse(struct bch_fs *c,
                if (ret < 0) {
                        if (err)
                                prt_printf(err, "%s: parse error",
-                                      opt->attr.name);
+                                          opt->attr.name);
                        return ret;
                }
        }
@@ -532,33 +531,11 @@ void bch2_opt_set_sb(struct bch_fs *c, const struct bch_option *opt, u64 v)
 
 struct bch_io_opts bch2_opts_to_inode_opts(struct bch_opts src)
 {
-       struct bch_io_opts ret = { 0 };
-#define x(_name, _bits)                                        \
-       if (opt_defined(src, _name))                                    \
-               opt_set(ret, _name, src._name);
-       BCH_INODE_OPTS()
-#undef x
-       return ret;
-}
-
-struct bch_opts bch2_inode_opts_to_opts(struct bch_io_opts src)
-{
-       struct bch_opts ret = { 0 };
-#define x(_name, _bits)                                        \
-       if (opt_defined(src, _name))                                    \
-               opt_set(ret, _name, src._name);
-       BCH_INODE_OPTS()
-#undef x
-       return ret;
-}
-
-void bch2_io_opts_apply(struct bch_io_opts *dst, struct bch_io_opts src)
-{
-#define x(_name, _bits)                                        \
-       if (opt_defined(src, _name))                                    \
-               opt_set(*dst, _name, src._name);
+       return (struct bch_io_opts) {
+#define x(_name, _bits)        ._name = src._name,
        BCH_INODE_OPTS()
 #undef x
+       };
 }
 
 bool bch2_opt_is_inode_opt(enum bch_opt_id id)