Re: [PATCH RFC] struct list_node

2007-06-14 Thread Jan Blunck
On Sun, 10 Jun 2007 15:11:30 +1000, Rusty Russell wrote: > > +/* A list node is the same as the head of the list, but it's useful to > + * think of them as a separate type. */ > +struct list_node { > + struct list_head h; > +}; > + > +/* This allows us to support old style list_head as well

Re: [PATCH RFC] struct list_node

2007-06-10 Thread Rusty Russell
On Sun, 2007-06-10 at 13:19 -0700, Linus Torvalds wrote: > And if you want a head, you really do want to use "hlist", since the head > is smaller than a list entry (a single pointer rather than two). No, now you're entirely missing the point. The normal Linux lists are beautiful, and should be u

Re: [PATCH RFC] struct list_node

2007-06-10 Thread Rusty Russell
On Sun, 2007-06-10 at 10:20 -0700, Linus Torvalds wrote: > > On Sun, 10 Jun 2007, Rusty Russell wrote: > > > > The current list.h has the same type for list elements and list heads > > even though most code and coders treat them as distinct. > > I think the old list.h is technically superior to y

Re: [PATCH RFC] struct list_node

2007-06-10 Thread Linus Torvalds
On Sun, 10 Jun 2007, Linus Torvalds wrote: > > The Linux kernel list.h is _better_ than most stupid list implementations > that think that a head node is different from the list node. Exactly > because it very naturally supports the notion of "this structure exists in > a 'ring of entries'" w

Re: [PATCH RFC] struct list_node

2007-06-10 Thread Linus Torvalds
On Sun, 10 Jun 2007, Rusty Russell wrote: > > The current list.h has the same type for list elements and list heads > even though most code and coders treat them as distinct. I think the old list.h is technically superior to yours. Exactly *because* nodes and heads are interchangeable. In fact

Re: [PATCH RFC] struct list_node

2007-06-10 Thread Randy Dunlap
On Sun, 10 Jun 2007 15:11:30 +1000 Rusty Russell wrote: > The current list.h has the same type for list elements and list heads > even though most code and coders treat them as distinct. > > I've had a version of list.h (for userspace work) for about a year > which uses a different type for nodes

[PATCH RFC] struct list_node

2007-06-09 Thread Rusty Russell
The current list.h has the same type for list elements and list heads even though most code and coders treat them as distinct. I've had a version of list.h (for userspace work) for about a year which uses a different type for nodes and it works very well: code is clearer, and mistakes like list_ad