X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=cmd_option.c;h=6ce34016f5dba7f0dca4e376c2893c0d6c84c1c8;hb=0a284fc4ffcbb46f0a4b921415ef12a9c75fa05c;hp=b5f632695d44ddc8894184b3bdf1a00ee3da284c;hpb=e142c4ca01fe36a2936e1287e22e57c491b65109;p=bcachefs-tools-debian diff --git a/cmd_option.c b/cmd_option.c index b5f6326..6ce3401 100644 --- a/cmd_option.c +++ b/cmd_option.c @@ -20,6 +20,7 @@ #include "cmds.h" #include "libbcachefs.h" +#include "libbcachefs/errcode.h" #include "libbcachefs/opts.h" #include "libbcachefs/super-io.h" @@ -64,7 +65,7 @@ int cmd_set_option(int argc, char *argv[]) struct bch_fs *c = bch2_fs_open(argv, argc, open_opts); if (IS_ERR(c)) { - fprintf(stderr, "error opening %s: %s\n", argv[0], strerror(-PTR_ERR(c))); + fprintf(stderr, "error opening %s: %s\n", argv[0], bch2_err_str(PTR_ERR(c))); exit(EXIT_FAILURE); } @@ -88,17 +89,19 @@ int cmd_set_option(int argc, char *argv[]) bch2_fs_stop(c); return ret; online: - unsigned dev_idx; - struct bchfs_handle fs = bchu_fs_open_by_dev(argv[i], &dev_idx); + { + unsigned dev_idx; + struct bchfs_handle fs = bchu_fs_open_by_dev(argv[i], &dev_idx); - for (i = 0; i < bch2_opts_nr; i++) { - if (!new_opt_strs.by_id[i]) - continue; + for (i = 0; i < bch2_opts_nr; i++) { + if (!new_opt_strs.by_id[i]) + continue; - char *path = mprintf("options/%s", bch2_opt_table[i].attr.name); + char *path = mprintf("options/%s", bch2_opt_table[i].attr.name); - write_file_str(fs.sysfs_fd, path, new_opt_strs.by_id[i]); - free(path); + write_file_str(fs.sysfs_fd, path, new_opt_strs.by_id[i]); + free(path); + } } return 0; }