21#define as_tree tree_node_t tree_node
28#define tree_entry(node, type) container_of((node), type, tree_node)
29#define tree_node(element) (&((element)->tree_node))
30#define tree_parent(node, type) (tree_entry(tree_node(node)->parent, type))
32#define tree_children_list(node) (&((node)->tree_node.children))
33#define tree_child_entry(node, type) container_of((node), type, tree_node.list_node)
34#define tree_child_node(node) (&((node)->tree_node.list_node))
36#define tree_foreach_child(t, v, h) \
37 for (__typeof(tree_child_entry(tree_child_node(h), t)) v = tree_child_entry(tree_children_list(h)->next, t); tree_child_node(v) != tree_children_list(h); \
38 v = tree_child_entry(tree_child_node(v)->next, t))
MOSAPI void(1, 2) fatal_abort(const char *fmt
list_node_t list_head
A linked list head.
struct tree_node tree_node_t
MOSAPI void tree_node_init(tree_node_t *node)
#define tree_node(element)
MOSAPI void tree_add_child(tree_node_t *parent, tree_node_t *child)