]> git.ozlabs.org Git - petitboot/blob - lib/list/list.c
Use a list for device->boot_options
[petitboot] / lib / list / list.c
1
2 #include "list/list.h"
3
4 void list_init(struct list *list)
5 {
6         list->head.next = &list->head;
7         list->head.prev = &list->head;
8 }
9
10 void list_add(struct list *list, struct list_item *new)
11 {
12         new->next = list->head.next;
13         new->prev = &list->head;
14
15         list->head.next->prev = new;
16         list->head.next = new;
17 }
18
19 void list_remove(struct list_item *item)
20 {
21         item->next->prev = item->prev;
22         item->prev->next = item->next;
23 }
24