Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Michel Lespinasse | fff3fd8 | 2012-10-08 16:31:23 -0700 | [diff] [blame] | 2 | #ifndef _LINUX_INTERVAL_TREE_H |
| 3 | #define _LINUX_INTERVAL_TREE_H |
| 4 | |
| 5 | #include <linux/rbtree.h> |
| 6 | |
| 7 | struct 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 | |
| 14 | extern void |
Davidlohr Bueso | f808c13 | 2017-09-08 16:15:08 -0700 | [diff] [blame] | 15 | interval_tree_insert(struct interval_tree_node *node, |
| 16 | struct rb_root_cached *root); |
Michel Lespinasse | fff3fd8 | 2012-10-08 16:31:23 -0700 | [diff] [blame] | 17 | |
| 18 | extern void |
Davidlohr Bueso | f808c13 | 2017-09-08 16:15:08 -0700 | [diff] [blame] | 19 | interval_tree_remove(struct interval_tree_node *node, |
| 20 | struct rb_root_cached *root); |
Michel Lespinasse | fff3fd8 | 2012-10-08 16:31:23 -0700 | [diff] [blame] | 21 | |
| 22 | extern struct interval_tree_node * |
Davidlohr Bueso | f808c13 | 2017-09-08 16:15:08 -0700 | [diff] [blame] | 23 | interval_tree_iter_first(struct rb_root_cached *root, |
Michel Lespinasse | fff3fd8 | 2012-10-08 16:31:23 -0700 | [diff] [blame] | 24 | unsigned long start, unsigned long last); |
| 25 | |
| 26 | extern struct interval_tree_node * |
| 27 | interval_tree_iter_next(struct interval_tree_node *node, |
| 28 | unsigned long start, unsigned long last); |
| 29 | |
| 30 | #endif /* _LINUX_INTERVAL_TREE_H */ |