summaryrefslogtreecommitdiff
path: root/include/linux/timerlist.h
blob: c46b28ae6e4daf05c6c3f2fad0ce6051df30626a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef _LINUX_TIMERLIST_H
#define _LINUX_TIMERLIST_H

#include <linux/rbtree.h>
#include <linux/ktime.h>


struct timerlist_node {
	struct rb_node node;
	ktime_t expires;
};

struct timerlist_head {
	struct rb_root head;
	struct timerlist_node *next;
};


extern void timerlist_add(struct timerlist_head *head,
				struct timerlist_node *node);
extern void timerlist_del(struct timerlist_head *head,
				struct timerlist_node *node);
extern struct timerlist_node *timerlist_getnext(struct timerlist_head *head);
extern struct timerlist_node *timerlist_iterate_next(
						struct timerlist_node *node);

static inline void timerlist_init(struct timerlist_node *node)
{
	RB_CLEAR_NODE(&node->node);
}

static inline void timerlist_init_head(struct timerlist_head *head)
{
	head->head = RB_ROOT;
	head->next = NULL;
}
#endif /* _LINUX_TIMERLIST_H */