linuxlist: add llist_entry_empty()

Return true if an entry is not included in a llist or
NULL.

Change-Id: Ia4afe3e77f53728db1d139bded5925183dca011f
This commit is contained in:
Alexander Couzens 2022-10-14 17:39:47 +02:00
parent 61359a2cdd
commit 8f23dfa914
1 changed files with 11 additions and 0 deletions

View File

@ -171,6 +171,17 @@ static inline int llist_empty(const struct llist_head *head)
return head->next == head;
}
/*!
* Test whether a linked list entry is empty or not included by any list.
* \param[in] entry the llist to test
* \return 1 if the entry is NULL or not included by any llist.
*/
static inline int llist_entry_empty(const struct llist_head *entry)
{
return entry == NULL || (!entry->next && !entry->prev)
|| (entry->next == LLIST_POISON1 && entry->prev == LLIST_POISON2);
}
static inline void __llist_splice(struct llist_head *llist,
struct llist_head *head)
{