Функция list_empty()
определена в ./include/linux/list.h
, и ее определение
static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}
list_head
структура данных определяется как
struct list_head {
struct list_head *next, *prev;
};
Чего я не понимаю, так это почему эта реализация в ядре проверяет head->next == head
, а не head->next == NULL
&& head->prev == NULL
.