lkml.org 
[lkml]   [2002]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [TRIVIAL PATCH] Remove list_t infection.

On Tue, 3 Sep 2002, Jamie Lokier wrote:
>
> 1. struct list
> 2. struct list_node
>
> With these two types, `list_add' et al. can actually _check_ that you
> got the arguments the right way around.

Well, the thing is, one of the _advantages_ of "struct list_head" is
exactly the fact that the implementation is 100% agnostic about whether a
list entry is the head, or just part of the list.

This was actually _the_ major design goal for me. I know the "struct
list_head" interfaces are kind of weird (some people initially really
didn't like the fact that you had to use magic macros to convert from
lists to the containing structures etc, and it's funny to think that a few
years ago that list structure was considered "strange"), but the fact that
any list entry can be the head of the list was very important.

Some uses of list_head uses "traditional" heads for the linked lists (as
heads for hashing etc), while many others just build up the list of all
entries, and each entry is a head in its own right and there is no
"external head" at all.

That's important. And you'd lose that if list_add() and friends tried to
distinguish between a list head and a list entry.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.085 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site