summaryrefslogtreecommitdiff
path: root/print-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-12 12:01:18 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-12 12:01:18 -0400
commit8e17fab249e8541a57558c30e3b6ed8dc3ce0738 (patch)
tree9b091edebf73324e577c2675b002af2df35a28da /print-tree.c
parent2db1ff357094670bafa1cfecffd6e2bda8e9d9fc (diff)
get/set for struct header fields
Diffstat (limited to 'print-tree.c')
-rw-r--r--print-tree.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/print-tree.c b/print-tree.c
index e32a959d..7df16b1e 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -8,11 +8,11 @@
void print_leaf(struct leaf *l)
{
int i;
- int nr = l->header.nritems;
+ u32 nr = btrfs_header_nritems(&l->header);
struct item *item;
struct extent_item *ei;
- printf("leaf %Lu total ptrs %d free space %d\n", l->header.blocknr, nr,
- leaf_free_space(l));
+ printf("leaf %Lu total ptrs %d free space %d\n",
+ btrfs_header_blocknr(&l->header), nr, leaf_free_space(l));
fflush(stdout);
for (i = 0 ; i < nr ; i++) {
item = l->items + i;
@@ -32,22 +32,20 @@ void print_leaf(struct leaf *l)
void print_tree(struct ctree_root *root, struct tree_buffer *t)
{
int i;
- int nr;
+ u32 nr;
struct node *c;
if (!t)
return;
c = &t->node;
- nr = c->header.nritems;
- if (c->header.blocknr != t->blocknr)
- BUG();
- if (is_leaf(c->header.flags)) {
+ nr = btrfs_header_nritems(&c->header);
+ if (btrfs_is_leaf(c)) {
print_leaf((struct leaf *)c);
return;
}
printf("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr,
- node_level(c->header.flags), c->header.nritems,
- (u32)NODEPTRS_PER_BLOCK - c->header.nritems);
+ btrfs_header_level(&c->header), nr,
+ (u32)NODEPTRS_PER_BLOCK - nr);
fflush(stdout);
for (i = 0; i < nr; i++) {
printf("\tkey %d (%Lu %u %Lu) block %Lu\n",
@@ -60,11 +58,11 @@ void print_tree(struct ctree_root *root, struct tree_buffer *t)
struct tree_buffer *next_buf = read_tree_block(root,
c->blockptrs[i]);
struct node *next = &next_buf->node;
- if (is_leaf(next->header.flags) &&
- node_level(c->header.flags) != 1)
+ if (btrfs_is_leaf(next) &&
+ btrfs_header_level(&c->header) != 1)
BUG();
- if (node_level(next->header.flags) !=
- node_level(c->header.flags) - 1)
+ if (btrfs_header_level(&next->header) !=
+ btrfs_header_level(&c->header) - 1)
BUG();
print_tree(root, next_buf);
tree_block_release(root, next_buf);