1#ifndef __LIB_KERNEL_LIST_H
2#define __LIB_KERNEL_LIST_H
108#define list_entry(LIST_ELEM, STRUCT, MEMBER) \
109 ((STRUCT *) ((uint8_t *) &(LIST_ELEM)->next \
110 - offsetof (STRUCT, MEMBER.next)))
122#define LIST_INITIALIZER(NAME) { { NULL, &(NAME).tail }, \
123 { &(NAME).head, NULL } }
struct list_elem * list_pop_front(struct list *)
Removes the front element from LIST and returns it.
bool list_less_func(const struct list_elem *a, const struct list_elem *b, void *aux)
Compares the value of two list elements A and B, given auxiliary data AUX.
struct list_elem * list_min(struct list *, list_less_func *, void *aux)
lib/kernel/list.h
void list_sort(struct list *, list_less_func *, void *aux)
Operations on lists with ordered elements.
void list_init(struct list *)
Initializes LIST as an empty list.
struct list_elem * list_begin(struct list *)
List traversal.
void list_insert_ordered(struct list *, struct list_elem *, list_less_func *, void *aux)
Inserts ELEM in the proper position in LIST, which must be sorted according to LESS given auxiliary d...
struct list_elem * list_head(struct list *)
Return's LIST's head.
void list_push_back(struct list *, struct list_elem *)
Inserts ELEM at the end of LIST, so that it becomes the back in LIST.
struct list_elem * list_prev(struct list_elem *)
Returns the element before ELEM in its list.
struct list_elem * list_rbegin(struct list *)
Returns the LIST's reverse beginning, for iterating through LIST in reverse order,...
struct list_elem * list_next(struct list_elem *)
Returns the element after ELEM in its list.
struct list_elem * list_tail(struct list *)
Return's LIST's tail.
void list_push_front(struct list *, struct list_elem *)
Inserts ELEM at the beginning of LIST, so that it becomes the front in LIST.
void list_splice(struct list_elem *before, struct list_elem *first, struct list_elem *last)
Removes elements FIRST though LAST (exclusive) from their current list, then inserts them just before...
struct list_elem * list_rend(struct list *)
Returns LIST's head.
void list_insert(struct list_elem *, struct list_elem *)
List insertion.
struct list_elem * list_remove(struct list_elem *)
List removal.
bool list_empty(struct list *)
Returns true if LIST is empty, false otherwise.
void list_unique(struct list *, struct list *duplicates, list_less_func *, void *aux)
Iterates through LIST and removes all but the first in each set of adjacent elements that are equal a...
struct list_elem * list_max(struct list *, list_less_func *, void *aux)
Max and min.
size_t list_size(struct list *)
List properties.
struct list_elem * list_front(struct list *)
List elements.
struct list_elem * list_end(struct list *)
Returns LIST's tail.
struct list_elem * list_back(struct list *)
Returns the back element in LIST.
void list_reverse(struct list *)
Miscellaneous.
struct list_elem * list_pop_back(struct list *)
Removes the back element from LIST and returns it.
struct list_elem * next
Next list element.
struct list_elem * prev
Previous list element.
struct list_elem tail
List tail.
struct list_elem head
List head.