About head of kernel linked list structure

Bernd Petrovitsch bernd at petrovitsch.priv.at
Thu May 7 21:02:08 EDT 2015


Hi all!

On Don, 2015-05-07 at 17:57 +0700, Mulyadi Santosa wrote:
> On Wed, May 6, 2015 at 5:39 PM, Huaicheng Li <lhcwhu at gmail.com> wrote:
> > In my understanding, the head initialised using LIST_HEAD_INIT or defined
> > by LIST_HEAD corresponds to no *real* data field.
> > But it *does* have its own _next_ and _prev_ pointers. The _next_ pointer
> > points to the first real node in the doubly linked list,
> > and the _prev_ pointer points to the last real node.
[...]
> 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)
What programming language?

	Bernd
-- 
"I dislike type abstraction if it has no real reason. And saving
on typing is not a good reason - if your typing speed is the main
issue when you're coding, you're doing something seriously wrong."
    - Linus Torvalds




More information about the Kernelnewbies mailing list