]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/opts.c
Update bcachefs sources to 04f2d2ae5b bcachefs: Fix build error on weird gcc
[bcachefs-tools-debian] / libbcachefs / opts.c
index b07f3dcfe35414381d45b621d7964e081fe5c369..0c0c83fa426407ee6beff0bd3b0b75e3c6a53cc3 100644 (file)
@@ -9,17 +9,15 @@
 #include "super-io.h"
 #include "util.h"
 
-#include <linux/pretty-printers.h>
-
 #define x(t, n) [n] = #t,
 
-const char * const bch2_metadata_versions[] = {
-       BCH_METADATA_VERSIONS()
+const char * const bch2_error_actions[] = {
+       BCH_ERROR_ACTIONS()
        NULL
 };
 
-const char * const bch2_error_actions[] = {
-       BCH_ERROR_ACTIONS()
+const char * const bch2_version_upgrade_opts[] = {
+       BCH_VERSION_UPGRADE_OPTS()
        NULL
 };
 
@@ -35,6 +33,7 @@ const char * const bch2_sb_compat[] = {
 
 const char * const bch2_btree_ids[] = {
        BCH_BTREE_IDS()
+       "interior btree node",
        NULL
 };
 
@@ -270,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;
@@ -282,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;
@@ -291,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;
                }
 
@@ -305,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;
                }
        }
@@ -531,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)