Lines Matching refs:list
38 static inline void list_node_append(struct list_node *list, in list_node_append() argument
41 if (list == NULL) { in list_node_append()
46 node->prev = list->prev; in list_node_append()
47 list->prev->next = node; in list_node_append()
48 list->prev = node; in list_node_append()
49 node->next = list; in list_node_append()
63 static inline void list_node_insert_after(struct list_node *list, in list_node_insert_after() argument
66 if (list == NULL) { in list_node_insert_after()
71 node->prev = list; in list_node_insert_after()
72 node->next = list->next; in list_node_insert_after()
73 list->next->prev = node; in list_node_insert_after()
74 list->next = node; in list_node_insert_after()
77 static inline void list_node_insert_before(struct list_node *list, in list_node_insert_before() argument
80 if (list == NULL) { in list_node_insert_before()
85 node->next = list; in list_node_insert_before()
86 node->prev = list->prev; in list_node_insert_before()
87 list->prev->next = node; in list_node_insert_before()
88 list->prev = node; in list_node_insert_before()
111 struct kmod_list *kmod_list_append(struct kmod_list *list, const void *data) in kmod_list_append() argument
120 list_node_append(list ? &list->node : NULL, &new->node); in kmod_list_append()
122 return list ? list : new; in kmod_list_append()
125 struct kmod_list *kmod_list_insert_after(struct kmod_list *list, in kmod_list_insert_after() argument
130 if (list == NULL) in kmod_list_insert_after()
131 return kmod_list_append(list, data); in kmod_list_insert_after()
138 list_node_insert_after(&list->node, &new->node); in kmod_list_insert_after()
140 return list; in kmod_list_insert_after()
143 struct kmod_list *kmod_list_insert_before(struct kmod_list *list, in kmod_list_insert_before() argument
148 if (list == NULL) in kmod_list_insert_before()
149 return kmod_list_append(list, data); in kmod_list_insert_before()
156 list_node_insert_before(&list->node, &new->node); in kmod_list_insert_before()
175 struct kmod_list *kmod_list_prepend(struct kmod_list *list, const void *data) in kmod_list_prepend() argument
184 list_node_append(list ? &list->node : NULL, &new->node); in kmod_list_prepend()
189 struct kmod_list *kmod_list_remove(struct kmod_list *list) in kmod_list_remove() argument
193 if (list == NULL) in kmod_list_remove()
196 node = list_node_remove(&list->node); in kmod_list_remove()
197 free(list); in kmod_list_remove()
205 struct kmod_list *kmod_list_remove_data(struct kmod_list *list, in kmod_list_remove_data() argument
211 for (itr = list; itr != NULL; itr = kmod_list_next(list, itr)) { in kmod_list_remove_data()
217 return list; in kmod_list_remove_data()
232 struct kmod_list *kmod_list_remove_n_latest(struct kmod_list *list, in kmod_list_remove_n_latest() argument
235 struct kmod_list *l = list; in kmod_list_remove_n_latest()
259 KMOD_EXPORT struct kmod_list *kmod_list_prev(const struct kmod_list *list, in kmod_list_prev() argument
262 if (list == NULL || curr == NULL) in kmod_list_prev()
265 if (list == curr) in kmod_list_prev()
284 KMOD_EXPORT struct kmod_list *kmod_list_next(const struct kmod_list *list, in kmod_list_next() argument
287 if (list == NULL || curr == NULL) in kmod_list_next()
290 if (curr->node.next == &list->node) in kmod_list_next()
309 KMOD_EXPORT struct kmod_list *kmod_list_last(const struct kmod_list *list) in kmod_list_last() argument
311 if (list == NULL) in kmod_list_last()
313 return container_of(list->node.prev, struct kmod_list, node); in kmod_list_last()