2 #define HEADER_LIST_H 1
10 struct list_elem *prev, *next;
15 struct list_elem head, tail;
18 #define list_entry(LIST_ELEM, STRUCT, MEMBER) \
19 ((STRUCT *) ((uint8_t *) (LIST_ELEM) - offsetof (STRUCT, MEMBER)))
21 void list_init (struct list *);
23 struct list_elem *list_begin (struct list *);
24 struct list_elem *list_end (struct list *);
25 struct list_elem *list_next (struct list_elem *);
26 struct list_elem *list_prev (struct list_elem *);
28 void list_insert (struct list_elem *, struct list_elem *);
29 void list_splice (struct list_elem *before,
30 struct list_elem *first, struct list_elem *last);
31 void list_push_front (struct list *, struct list_elem *);
32 void list_push_back (struct list *, struct list_elem *);
34 void list_remove (struct list_elem *);
35 struct list_elem *list_pop_front (struct list *);
36 struct list_elem *list_pop_back (struct list *);
38 struct list_elem *list_front (struct list *);
39 struct list_elem *list_back (struct list *);
41 size_t list_size (struct list *);
42 bool list_empty (struct list *);
44 void list_reverse (struct list *);
46 typedef bool list_less_func (const struct list_elem *a,
47 const struct list_elem *b, void *aux);
49 void list_merge (struct list *, struct list *,
50 list_less_func *, void *aux);
51 void list_sort (struct list *,
52 list_less_func *, void *aux);
53 void list_insert_ordered (struct list *, struct list_elem *,
54 list_less_func *, void *aux);
55 void list_unique (struct list *,
56 list_less_func *, void *aux);