]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs.c
Delete some dead code
[bcachefs-tools-debian] / libbcachefs.c
index 1c780be1685b111b4c4fe87db64c2e94c3de9802..4fe2c3db401a41afb2f79319986bb4819e31d310 100644 (file)
@@ -597,6 +597,7 @@ next:
 struct bch_opts bch2_parse_opts(struct bch_opt_strs strs)
 {
        struct bch_opts opts = bch2_opts_empty();
+       struct printbuf err = PRINTBUF;
        unsigned i;
        int ret;
        u64 v;
@@ -606,17 +607,16 @@ struct bch_opts bch2_parse_opts(struct bch_opt_strs strs)
                    bch2_opt_table[i].type == BCH_OPT_FN)
                        continue;
 
-               ret = bch2_opt_parse(NULL, "option",
+               ret = bch2_opt_parse(NULL,
                                     &bch2_opt_table[i],
-                                    strs.by_id[i], &v);
+                                    strs.by_id[i], &v, &err);
                if (ret < 0)
-                       die("Invalid %s: %s",
-                           bch2_opt_table[i].attr.name,
-                           strerror(-ret));
+                       die("Invalid option %s", err.buf);
 
                bch2_opt_set_by_id(&opts, i, v);
        }
 
+       printbuf_exit(&err);
        return opts;
 }
 
@@ -689,7 +689,7 @@ dev_names bchu_fs_get_devices(struct bchfs_handle fs)
        struct dirent *d;
        dev_names devs;
 
-       darray_init(devs);
+       darray_init(&devs);
 
        while ((errno = 0), (d = readdir(dir))) {
                struct dev_name n = { 0, NULL, NULL };
@@ -713,7 +713,7 @@ dev_names bchu_fs_get_devices(struct bchfs_handle fs)
                n.label = read_file_str(fs.sysfs_fd, label_attr);
                free(label_attr);
 
-               darray_append(devs, n);
+               darray_push(&devs, n);
        }
 
        closedir(dir);