blob: 406b103894bd8c50ff774a9de483ffc2c54cdfdc [file] [log] [blame]
John Stultz1f5a2472010-12-09 12:02:18 -08001#ifndef _LINUX_TIMERQUEUE_H
2#define _LINUX_TIMERQUEUE_H
3
4#include <linux/rbtree.h>
5#include <linux/ktime.h>
6
7
8struct timerqueue_node {
9 struct rb_node node;
10 ktime_t expires;
11};
12
13struct timerqueue_head {
14 struct rb_root head;
15 struct timerqueue_node *next;
16};
17
18
19extern void timerqueue_add(struct timerqueue_head *head,
20 struct timerqueue_node *node);
21extern void timerqueue_del(struct timerqueue_head *head,
22 struct timerqueue_node *node);
23extern struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head);
24extern struct timerqueue_node *timerqueue_iterate_next(
25 struct timerqueue_node *node);
26
27static inline void timerqueue_init(struct timerqueue_node *node)
28{
29 RB_CLEAR_NODE(&node->node);
30}
31
32static inline void timerqueue_init_head(struct timerqueue_head *head)
33{
34 head->head = RB_ROOT;
35 head->next = NULL;
36}
37#endif /* _LINUX_TIMERQUEUE_H */