X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=list.h;h=172fa482ee8a3426ba53c4335d3d6a2df0c0692a;hp=2e0a7ad7eae671a3b0d20706dc9d741f549ab4eb;hb=94a08ec621fef3dff02f8d254a079652fe28698c;hpb=5c4e1dbc4ec6ee963220c5f4e64a04cd6130dc81 diff --git a/list.h b/list.h index 2e0a7ad7..172fa482 100644 --- a/list.h +++ b/list.h @@ -28,6 +28,9 @@ struct list_head { #define LIST_HEAD_INIT(name) { &(name), &(name) } +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + #define INIT_LIST_HEAD(ptr) do { \ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) @@ -92,6 +95,16 @@ static inline void list_del(struct list_head *entry) entry->prev = NULL; } +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + /** * list_empty - tests whether a list is empty * @head: the list to test.