list_empty()
功能在./include/linux/list.h
定義,它的定義是list_empty功能內核鏈表
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
。