diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/timerlist.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/timerlist.h b/include/linux/timerlist.h new file mode 100644 index 000000000000..c46b28ae6e4d --- /dev/null +++ b/include/linux/timerlist.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef _LINUX_TIMERLIST_H | ||
2 | #define _LINUX_TIMERLIST_H | ||
3 | |||
4 | #include <linux/rbtree.h> | ||
5 | #include <linux/ktime.h> | ||
6 | |||
7 | |||
8 | struct timerlist_node { | ||
9 | struct rb_node node; | ||
10 | ktime_t expires; | ||
11 | }; | ||
12 | |||
13 | struct timerlist_head { | ||
14 | struct rb_root head; | ||
15 | struct timerlist_node *next; | ||
16 | }; | ||
17 | |||
18 | |||
19 | extern void timerlist_add(struct timerlist_head *head, | ||
20 | struct timerlist_node *node); | ||
21 | extern void timerlist_del(struct timerlist_head *head, | ||
22 | struct timerlist_node *node); | ||
23 | extern struct timerlist_node *timerlist_getnext(struct timerlist_head *head); | ||
24 | extern struct timerlist_node *timerlist_iterate_next( | ||
25 | struct timerlist_node *node); | ||
26 | |||
27 | static inline void timerlist_init(struct timerlist_node *node) | ||
28 | { | ||
29 | RB_CLEAR_NODE(&node->node); | ||
30 | } | ||
31 | |||
32 | static inline void timerlist_init_head(struct timerlist_head *head) | ||
33 | { | ||
34 | head->head = RB_ROOT; | ||
35 | head->next = NULL; | ||
36 | } | ||
37 | #endif /* _LINUX_TIMERLIST_H */ | ||