blob: 76b014c968935aa028f2bc6cb78bfdfbd2a1def7 [file] [log] [blame]
Arnaldo Carvalho de Melo361c99a2011-01-11 20:56:53 -02001#include <linux/kernel.h>
Borislav Petkovd944c4e2014-04-25 21:31:02 +02002#include <linux/types.h>
Ingo Molnar3ac1bbc2011-05-22 10:07:37 +02003
Wang Nan4fc62a82015-06-01 07:37:48 +00004#include "../../../include/linux/list.h"
Arnaldo Carvalho de Melo5da50252009-07-01 14:46:08 -03005
Wang Nan4fc62a82015-06-01 07:37:48 +00006#ifndef TOOLS_LIST_H
7#define TOOLS_LIST_H
Arnaldo Carvalho de Melo5da50252009-07-01 14:46:08 -03008/**
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 */
15static 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 Melo43730982010-08-06 16:51:12 -030021
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 Torvalds268bb0c2011-05-20 12:50:29 -070028 for (; pos != (head); pos = pos->next)
Arnaldo Carvalho de Melo5da50252009-07-01 14:46:08 -030029#endif