]> git.tue.mpg.de Git - paraslash.git/commitdiff
[btr:] Add btr_log_tree().
authorAndre Noll <maan@systemlinux.org>
Sun, 3 Jan 2010 03:12:01 +0000 (04:12 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 3 Jan 2010 03:12:01 +0000 (04:12 +0100)
buffer_tree.c
buffer_tree.h
filter.c

index cd3a3c78a45db3babb73c34a3b860b55c2d99bd7..5d8e33fc17748dc1347af4f1ec57f15a8b662741 100644 (file)
@@ -371,3 +371,20 @@ bool btr_eof(struct btr_node *btrn)
 
        return (len == 0 && btr_no_parent(btrn));
 }
+
+void log_tree_recursively(struct btr_node *btrn, int loglevel, int depth)
+{
+       struct btr_node *ch;
+       const char spaces[] = "                 ", *space = spaces + 16 - depth;
+
+       if (depth > 16)
+               return;
+       para_log(loglevel, "%s%s\n", space, btrn->name);
+       FOR_EACH_CHILD(ch, btrn)
+               log_tree_recursively(ch, loglevel, depth + 1);
+}
+
+void btr_log_tree(struct btr_node *btrn, int loglevel)
+{
+       return log_tree_recursively(btrn, loglevel, 0);
+}
index 589bde2779d5baeb43b15fbfaeeca952ac59b018..77343f83587cc7db810108ca0f548eb1af0e06e0 100644 (file)
@@ -21,3 +21,4 @@ void btr_pushdown(struct btr_node *btrn);
 void *btr_context(struct btr_node *btrn);
 void btr_merge(struct btr_node *btrn, size_t dest_size);
 bool btr_eof(struct btr_node *btrn);
+void btr_log_tree(struct btr_node *btrn, int loglevel);
index 88a0bd75dcb2ec3a70cd83854827aca3dce9b8a6..ed8cde41b3a650c028ab6b365f642b8a5604f3ab 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -192,6 +192,7 @@ static int __noreturn main_btr(void)
 
        s.default_timeout.tv_sec = 1;
        s.default_timeout.tv_usec = 0;
+       btr_log_tree(sit->btrn, LL_INFO);
        ret = schedule(&s);
 err:
        if (ret < 0)