diff options
Diffstat (limited to 'include/linux/list.h')
-rw-r--r-- | include/linux/list.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index bdd09efa..d176d0d3 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -98,4 +98,15 @@ static inline void hlist_del_init(struct hlist_node *n) pos; \ pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) +static inline size_t list_count_nodes(struct list_head *head) +{ + struct list_head *pos; + size_t count = 0; + + list_for_each(pos, head) + count++; + + return count; +} + #endif /* _LIST_LIST_H */ |