]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/opts.c
Update bcachefs sources to 6a25f7a00d bcachefs: fix ioctl code
[bcachefs-tools-debian] / libbcachefs / opts.c
index 7c4cf80481563e1fc2a4e7c9ed59a50f7d26e6cf..b1bbf092c0d6ae27ccdb77c0419206974eb27b58 100644 (file)
@@ -72,7 +72,7 @@ const struct bch_option bch2_opt_table[] = {
 #undef BCH_OPT
 };
 
-static enum bch_opt_id bch2_opt_lookup(const char *name)
+static int bch2_opt_lookup(const char *name)
 {
        const struct bch_option *i;
 
@@ -181,7 +181,7 @@ int bch2_parse_mount_opts(struct bch_opts *opts, char *options)
                if (val) {
                        id = bch2_opt_lookup(name);
                        if (id < 0)
-                               return -EINVAL;
+                               continue;
 
                        ret = parse_one_opt(id, val, &v);
                        if (ret < 0)
@@ -196,8 +196,9 @@ int bch2_parse_mount_opts(struct bch_opts *opts, char *options)
                                v = 0;
                        }
 
-                       if (bch2_opt_table[id].type != BCH_OPT_BOOL)
-                               return -EINVAL;
+                       if (id < 0 ||
+                           bch2_opt_table[id].type != BCH_OPT_BOOL)
+                               continue;
                }
 
                bch2_opt_set(opts, id, v);
@@ -209,7 +210,7 @@ int bch2_parse_mount_opts(struct bch_opts *opts, char *options)
 enum bch_opt_id bch2_parse_sysfs_opt(const char *name, const char *val,
                                    u64 *res)
 {
-       enum bch_opt_id id = bch2_opt_lookup(name);
+       int id = bch2_opt_lookup(name);
        int ret;
 
        if (id < 0)
@@ -225,7 +226,7 @@ enum bch_opt_id bch2_parse_sysfs_opt(const char *name, const char *val,
 ssize_t bch2_opt_show(struct bch_opts *opts, const char *name,
                     char *buf, size_t size)
 {
-       enum bch_opt_id id = bch2_opt_lookup(name);
+       int id = bch2_opt_lookup(name);
        const struct bch_option *opt;
        u64 v;