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;
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;
}
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 };
n.label = read_file_str(fs.sysfs_fd, label_attr);
free(label_attr);
- darray_append(devs, n);
+ darray_push(&devs, n);
}
closedir(dir);