RE: crap, i think LKD3 explains linked list head nodes incorrectly ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 21 Nov 2010, Bruce Blinn wrote:

> >   that also suggests that a passage on p. 91 of LKD3 is
> > inaccurate, where it claims that "because the lists are
> > circular, you can generally pass any element for head."  but
> > that can't be right, since you must *always* keep track of
> > the head node for any list, to avoid processing it normally.
> > if you simply drop someone into the middle of a circular,
> > doubly-linked kernel list, there is no way that i can see to
> > know which node in that list is the head node when you run
> > across it during iteration.
> >
> >   does this make sense?
>
> I think you are assuming that all lists have a separate list_head
> structure to locate the head of the list. I am not sure that is
> correct. For example, the task structures are linked toghether in a
> curcular list with no separate list_head structure.  The
> init_task->tasks.next field is usually the starting point, but
> current->tasks.next should work just as well.

  that may be true, but if it is, it's a *very* special case in that
it represents a list that *starts* with an initial entry (init_task),
so it can be processed differently.  can you point out where a new
entry is added to that particular list?

rday

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux