From: kernelnewbies-bounces@xxxxxxxxxxxxxxxxx [mailto:kernelnewbies-bounces@xxxxxxxxxxxxxxxxx]
On Behalf Of Mulyadi Santosa On Wed, May 6, 2015 at 5:39 PM, Huaicheng Li <lhcwhu@xxxxxxxxx> wrote: In my understanding, the head initialised using LIST_HEAD_INIT or defined by LIST_HEAD corresponds to no *real* data field.
Hi Huachieng AFAIK, if the linked list is not circular one, the last node's next should point to NULL, so does the head prev's. This is done so you know when you hit head i.e if !(head.prev) // we're at head }
From list.h: 183 /** 184 * list_empty - tests whether a list is empty 185 * @head: the list to test. 186 */ 187 static inline int list_empty(const struct list_head *head) 188 { 189 return head->next == head; 190 } Jeff Haran |
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies