Skip to content

Commit e9b83db

Browse files
committed
list: Adopt list_next_entry() from the Linux kernel
We'll use it to traverse the list of opaque btf_encoder entries in pahole. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 6edae3e commit e9b83db

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

list.h

+8
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ static inline void list_splice_init(struct list_head *list,
289289
#define list_first_entry(ptr, type, member) \
290290
list_entry((ptr)->next, type, member)
291291

292+
/**
293+
* list_next_entry - get the next element in list
294+
* @pos: the type * to cursor
295+
* @member: the name of the list_head within the struct.
296+
*/
297+
#define list_next_entry(pos, member) \
298+
list_entry((pos)->member.next, typeof(*(pos)), member)
299+
292300
/**
293301
* list_for_each - iterate over a list
294302
* @pos: the &struct list_head to use as a loop cursor.

0 commit comments

Comments
 (0)