John Stultz | 1f5a247 | 2010-12-09 12:02:18 -0800 | [diff] [blame^] | 1 | #ifndef _LINUX_TIMERQUEUE_H |
| 2 | #define _LINUX_TIMERQUEUE_H |
| 3 | |
| 4 | #include <linux/rbtree.h> |
| 5 | #include <linux/ktime.h> |
| 6 | |
| 7 | |
| 8 | struct timerqueue_node { |
| 9 | struct rb_node node; |
| 10 | ktime_t expires; |
| 11 | }; |
| 12 | |
| 13 | struct timerqueue_head { |
| 14 | struct rb_root head; |
| 15 | struct timerqueue_node *next; |
| 16 | }; |
| 17 | |
| 18 | |
| 19 | extern void timerqueue_add(struct timerqueue_head *head, |
| 20 | struct timerqueue_node *node); |
| 21 | extern void timerqueue_del(struct timerqueue_head *head, |
| 22 | struct timerqueue_node *node); |
| 23 | extern struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head); |
| 24 | extern struct timerqueue_node *timerqueue_iterate_next( |
| 25 | struct timerqueue_node *node); |
| 26 | |
| 27 | static inline void timerqueue_init(struct timerqueue_node *node) |
| 28 | { |
| 29 | RB_CLEAR_NODE(&node->node); |
| 30 | } |
| 31 | |
| 32 | static 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 */ |