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