2007-02-26 15:40:21 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2007-04-05 18:29:12 +00:00
|
|
|
#include <uuid/uuid.h>
|
2007-02-26 15:40:21 +00:00
|
|
|
#include "kerncompat.h"
|
|
|
|
#include "radix-tree.h"
|
|
|
|
#include "ctree.h"
|
|
|
|
#include "disk-io.h"
|
|
|
|
#include "print-tree.h"
|
2007-03-16 20:20:31 +00:00
|
|
|
#include "transaction.h"
|
2007-02-26 15:40:21 +00:00
|
|
|
|
2007-02-28 14:40:58 +00:00
|
|
|
int main(int ac, char **av) {
|
2007-03-13 14:46:10 +00:00
|
|
|
struct btrfs_super_block super;
|
|
|
|
struct btrfs_root *root;
|
2007-04-05 18:29:12 +00:00
|
|
|
char uuidbuf[37];
|
2007-03-21 00:35:03 +00:00
|
|
|
|
|
|
|
if (ac != 2) {
|
|
|
|
fprintf(stderr, "usage: %s device\n", av[0]);
|
|
|
|
exit(1);
|
|
|
|
}
|
2007-02-26 15:40:21 +00:00
|
|
|
radix_tree_init();
|
2007-03-21 00:35:03 +00:00
|
|
|
root = open_ctree(av[1], &super);
|
|
|
|
if (!root) {
|
|
|
|
fprintf(stderr, "unable to open %s\n", av[1]);
|
|
|
|
exit(1);
|
|
|
|
}
|
2007-03-13 20:47:54 +00:00
|
|
|
printf("fs tree\n");
|
2007-03-13 14:46:10 +00:00
|
|
|
btrfs_print_tree(root, root->node);
|
2007-02-26 15:40:21 +00:00
|
|
|
printf("map tree\n");
|
2007-03-20 18:38:32 +00:00
|
|
|
btrfs_print_tree(root->fs_info->extent_root,
|
|
|
|
root->fs_info->extent_root->node);
|
|
|
|
printf("inode tree\n");
|
|
|
|
btrfs_print_tree(root->fs_info->inode_root,
|
|
|
|
root->fs_info->inode_root->node);
|
2007-03-13 20:47:54 +00:00
|
|
|
printf("root tree\n");
|
2007-03-20 18:38:32 +00:00
|
|
|
btrfs_print_tree(root->fs_info->tree_root,
|
|
|
|
root->fs_info->tree_root->node);
|
2007-03-21 00:35:03 +00:00
|
|
|
printf("total blocks %Lu\n", btrfs_super_total_blocks(&super));
|
|
|
|
printf("blocks used %Lu\n", btrfs_super_blocks_used(&super));
|
2007-04-05 18:29:12 +00:00
|
|
|
uuidbuf[36] = '\0';
|
|
|
|
uuid_unparse(super.fsid, uuidbuf);
|
|
|
|
printf("uuid %s\n", uuidbuf);
|
2007-02-26 15:40:21 +00:00
|
|
|
return 0;
|
|
|
|
}
|