From e9b83dba79a87935e08aa0c7d6cdc20a48f2ae28 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 26 Jul 2021 17:01:48 -0300 Subject: [PATCH] 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 --- list.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/list.h b/list.h index 6072919..d5aee43 100644 --- a/list.h +++ b/list.h @@ -289,6 +289,14 @@ static inline void list_splice_init(struct list_head *list, #define list_first_entry(ptr, type, member) \ list_entry((ptr)->next, type, member) +/** + * list_next_entry - get the next element in list + * @pos: the type * to cursor + * @member: the name of the list_head within the struct. + */ +#define list_next_entry(pos, member) \ + list_entry((pos)->member.next, typeof(*(pos)), member) + /** * list_for_each - iterate over a list * @pos: the &struct list_head to use as a loop cursor.