Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 1 | #include <linux/kernel.h> |
Borislav Petkov | d944c4e | 2014-04-25 21:31:02 +0200 | [diff] [blame] | 2 | #include <linux/types.h> |
Ingo Molnar | 3ac1bbc | 2011-05-22 10:07:37 +0200 | [diff] [blame] | 3 | |
Wang Nan | 4fc62a8 | 2015-06-01 07:37:48 +0000 | [diff] [blame] | 4 | #include "../../../include/linux/list.h" |
Arnaldo Carvalho de Melo | 5da5025 | 2009-07-01 14:46:08 -0300 | [diff] [blame] | 5 | |
Wang Nan | 4fc62a8 | 2015-06-01 07:37:48 +0000 | [diff] [blame] | 6 | #ifndef TOOLS_LIST_H |
| 7 | #define TOOLS_LIST_H |
Arnaldo Carvalho de Melo | 5da5025 | 2009-07-01 14:46:08 -0300 | [diff] [blame] | 8 | /** |
| 9 | * list_del_range - deletes range of entries from list. |
| 10 | * @begin: first element in the range to delete from the list. |
| 11 | * @end: last element in the range to delete from the list. |
| 12 | * Note: list_empty on the range of entries does not return true after this, |
| 13 | * the entries is in an undefined state. |
| 14 | */ |
| 15 | static inline void list_del_range(struct list_head *begin, |
| 16 | struct list_head *end) |
| 17 | { |
| 18 | begin->prev->next = end->next; |
| 19 | end->next->prev = begin->prev; |
| 20 | } |
Arnaldo Carvalho de Melo | 4373098 | 2010-08-06 16:51:12 -0300 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * list_for_each_from - iterate over a list from one of its nodes |
| 24 | * @pos: the &struct list_head to use as a loop cursor, from where to start |
| 25 | * @head: the head for your list. |
| 26 | */ |
| 27 | #define list_for_each_from(pos, head) \ |
Linus Torvalds | 268bb0c | 2011-05-20 12:50:29 -0700 | [diff] [blame] | 28 | for (; pos != (head); pos = pos->next) |
Arnaldo Carvalho de Melo | 5da5025 | 2009-07-01 14:46:08 -0300 | [diff] [blame] | 29 | #endif |