#include <sys/types.h>
#include "cmds.h"
-#include "libbcache.h"
+#include "libbcachefs.h"
#include "qcow2.h"
#include "tools-util.h"
-#include "bcache.h"
+#include "bcachefs.h"
#include "alloc.h"
#include "btree_cache.h"
#include "btree_iter.h"
static void dump_usage(void)
{
- puts("bcache dump - dump filesystem metadata\n"
- "Usage: bcache dump [OPTION]... <devices>\n"
+ puts("bcachefs dump - dump filesystem metadata\n"
+ "Usage: bcachefs dump [OPTION]... <devices>\n"
"\n"
"Options:\n"
" -o output Output qcow2 image(s)\n"
ptr->offset << 9,
b->written << 9);
}
- bch_btree_iter_unlock(&iter);
+ bch2_btree_iter_unlock(&iter);
}
qcow2_write_image(ca->disk_sb.bdev->bd_fd, fd, &data,
int cmd_dump(int argc, char *argv[])
{
- struct bch_opts opts = bch_opts_empty();
+ struct bch_opts opts = bch2_opts_empty();
struct bch_fs *c = NULL;
const char *err;
char *out = NULL;
opts.nochanges = true;
opts.noreplay = true;
opts.errors = BCH_ON_ERROR_CONTINUE;
- fsck_err_opt = FSCK_ERR_NO;
while ((opt = getopt(argc, argv, "o:fh")) != -1)
switch (opt) {
if (!out)
die("Please supply output filename");
- err = bch_fs_open(argv + optind, argc - optind, opts, &c);
+ err = bch2_fs_open(argv + optind, argc - optind, opts, &c);
if (err)
die("error opening %s: %s", argv[optind], err);
up_read(&c->gc_lock);
- bch_fs_stop(c);
+ bch2_fs_stop(c);
return 0;
}
if (bkey_cmp(k.k->p, end) > 0)
break;
- bch_bkey_val_to_text(c, bkey_type(0, btree_id),
- buf, sizeof(buf), k);
+ bch2_bkey_val_to_text(c, bkey_type(0, btree_id),
+ buf, sizeof(buf), k);
puts(buf);
}
- bch_btree_iter_unlock(&iter);
+ bch2_btree_iter_unlock(&iter);
}
static void list_btree_formats(struct bch_fs *c, enum btree_id btree_id,
if (bkey_cmp(b->key.k.p, end) > 0)
break;
- bch_print_btree_node(c, b, buf, sizeof(buf));
+ bch2_print_btree_node(c, b, buf, sizeof(buf));
puts(buf);
}
- bch_btree_iter_unlock(&iter);
+ bch2_btree_iter_unlock(&iter);
}
static struct bpos parse_pos(char *buf)
static void list_keys_usage(void)
{
- puts("bcache list_keys - list filesystem metadata to stdout\n"
- "Usage: bcache list_keys [OPTION]... <devices>\n"
+ puts("bcachefs list_keys - list filesystem metadata to stdout\n"
+ "Usage: bcachefs list_keys [OPTION]... <devices>\n"
"\n"
"Options:\n"
" -b (extents|inodes|dirents|xattrs) Btree to list from\n"
int cmd_list(int argc, char *argv[])
{
- struct bch_opts opts = bch_opts_empty();
+ struct bch_opts opts = bch2_opts_empty();
struct bch_fs *c = NULL;
enum btree_id btree_id = BTREE_ID_EXTENTS;
struct bpos start = POS_MIN, end = POS_MAX;
opts.nochanges = true;
opts.norecovery = true;
opts.errors = BCH_ON_ERROR_CONTINUE;
- fsck_err_opt = FSCK_ERR_NO;
while ((opt = getopt(argc, argv, "b:s:e:m:h")) != -1)
switch (opt) {
case 'b':
btree_id = read_string_list_or_die(optarg,
- bch_btree_ids, "btree id");
+ bch2_btree_ids, "btree id");
break;
case 's':
start = parse_pos(optarg);
if (optind >= argc)
die("Please supply device(s) to check");
- err = bch_fs_open(argv + optind, argc - optind, opts, &c);
+ err = bch2_fs_open(argv + optind, argc - optind, opts, &c);
if (err)
die("error opening %s: %s", argv[optind], err);
die("Invalid mode");
}
- bch_fs_stop(c);
+ bch2_fs_stop(c);
return 0;
}