+#include "rbtree.h"
+#include "ioctl.h"
+#else
+#include <btrfs/kerncompat.h>
+#include <btrfs/rbtree.h>
+#include <btrfs/ioctl.h>
+#endif /* BTRFS_FLAT_INCLUDES */
+
+#include <time.h>
+
+enum btrfs_list_layout {
+ BTRFS_LIST_LAYOUT_DEFAULT = 0,
+ BTRFS_LIST_LAYOUT_TABLE,
+ BTRFS_LIST_LAYOUT_RAW
+};
+
+/*
+ * one of these for each root we find.
+ */
+struct root_info {
+ struct rb_node rb_node;
+ struct rb_node sort_node;
+
+ /* this root's id */
+ u64 root_id;
+
+ /* equal the offset of the root's key */
+ u64 root_offset;
+
+ /* flags of the root */
+ u64 flags;
+
+ /* the id of the root that references this one */
+ u64 ref_tree;