1
#include "linkedlist.h"
4
prefetch(const void *x)
8
* Insert a new entry between two known consecutive entries.
10
* This is only for internal list manipulation where we know
11
* the prev/next entries already!
14
__list_add(struct list_head *new,
15
struct list_head *prev,
16
struct list_head *next)
25
* list_add - add a new entry
26
* @new: new entry to be added
27
* @head: list head to add it after
29
* Insert a new entry after the specified head.
30
* This is good for implementing stacks.
33
list_add(struct list_head *new, struct list_head *head)
35
__list_add(new, head, head->next);
39
* list_add_tail - add a new entry
40
* @new: new entry to be added
41
* @head: list head to add it before
43
* Insert a new entry before the specified head.
44
* This is useful for implementing queues.
47
list_add_tail(struct list_head *new, struct list_head *head)
49
__list_add(new, head->prev, head);
53
* Delete a list entry by making the prev/next entries
54
* point to each other.
56
* This is only for internal list manipulation where we know
57
* the prev/next entries already!
60
__list_del(struct list_head * prev, struct list_head * next)
67
* list_del - deletes entry from list.
68
* @entry: the element to delete from the list.
69
* Note: list_empty on entry does not return true after this, the entry is
70
* in an undefined state.
73
list_del(struct list_head *entry)
75
__list_del(entry->prev, entry->next);
79
* list_del_init - deletes entry from list and reinitialize it.
80
* @entry: the element to delete from the list.
83
list_del_init(struct list_head *entry)
85
__list_del(entry->prev, entry->next);
86
INIT_LIST_HEAD(entry);
90
* list_move - delete from one list and add as another's head
91
* @list: the entry to move
92
* @head: the head that will precede our entry
95
list_move(struct list_head *list, struct list_head *head)
97
__list_del(list->prev, list->next);
102
* list_move_tail - delete from one list and add as another's tail
103
* @list: the entry to move
104
* @head: the head that will follow our entry
107
list_move_tail(struct list_head *list,
108
struct list_head *head)
110
__list_del(list->prev, list->next);
111
list_add_tail(list, head);
115
* list_empty - tests whether a list is empty
116
* @head: the list to test.
119
list_empty(struct list_head *head)
121
return head->next == head;
125
__list_splice(struct list_head *list,
126
struct list_head *head)
128
struct list_head *first = list->next;
129
struct list_head *last = list->prev;
130
struct list_head *at = head->next;
140
* list_splice - join two lists
141
* @list: the new list to add.
142
* @head: the place to add it in the first list.
145
list_splice(struct list_head *list, struct list_head *head)
147
if (!list_empty(list))
148
__list_splice(list, head);
152
* list_splice_init - join two lists and reinitialise the emptied list.
153
* @list: the new list to add.
154
* @head: the place to add it in the first list.
156
* The list at @list is reinitialised
159
list_splice_init(struct list_head *list,
160
struct list_head *head)
162
if (!list_empty(list)) {
163
__list_splice(list, head);
164
INIT_LIST_HEAD(list);