Skip to content

Commit e229c2f

Browse files
Arnaldo Carvalho de Melodavem330
authored andcommitted
[LIST]: Introduce list_for_each_entry_from
For iterating over list of given type continuing from existing point. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7b204af commit e229c2f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/linux/list.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,17 @@ static inline void list_splice_init(struct list_head *list,
410410
prefetch(pos->member.next), &pos->member != (head); \
411411
pos = list_entry(pos->member.next, typeof(*pos), member))
412412

413+
/**
414+
* list_for_each_entry_from - iterate over list of given type
415+
* continuing from existing point
416+
* @pos: the type * to use as a loop counter.
417+
* @head: the head for your list.
418+
* @member: the name of the list_struct within the struct.
419+
*/
420+
#define list_for_each_entry_from(pos, head, member) \
421+
for (; prefetch(pos->member.next), &pos->member != (head); \
422+
pos = list_entry(pos->member.next, typeof(*pos), member))
423+
413424
/**
414425
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
415426
* @pos: the type * to use as a loop counter.

0 commit comments

Comments
 (0)