1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_INTERVAL_TREE_H
3 #define _LINUX_INTERVAL_TREE_H
5 #include <linux/rbtree.h>
7 struct interval_tree_node {
9 unsigned long start; /* Start of interval */
10 unsigned long last; /* Last location _in_ interval */
11 unsigned long __subtree_last;
15 interval_tree_insert(struct interval_tree_node *node,
16 struct rb_root_cached *root);
19 interval_tree_remove(struct interval_tree_node *node,
20 struct rb_root_cached *root);
22 extern struct interval_tree_node *
23 interval_tree_iter_first(struct rb_root_cached *root,
24 unsigned long start, unsigned long last);
26 extern struct interval_tree_node *
27 interval_tree_iter_next(struct interval_tree_node *node,
28 unsigned long start, unsigned long last);
30 #endif /* _LINUX_INTERVAL_TREE_H */