Having thought about it a little more, I don't see why the symmetric
double link (i.e., like the page hash, not like the buffer hash)
couldn't be used with single-pointer tables, using similar tests for
NULL in insertion and deletion.
> > > - encapsulating the next pointer inside a struct
> > > hash_head_##FOOBAR
> >
> > I think the generic list macros give you that for free.
>
> Umm, if you use such, you get lists.h style type-casting stuff which
> doesnt have a nice interface as
You could wrap the final product in inlines with internal typecasts.
As you pointed out, C just doesn't have templates.
> > Naturally. And trying to reduce the size of the macros. It's not
> > that easy to get stuff that has dozens of lines ending with "\"
> > into the kernel. You might have better luck just generalizing a
> > few short sets of common operations used in hashes, and showing
> > examples of how you'd use them to rewrite some of the existing hash
> > code. Obviously, the new, improved approach has to be no less
> > efficient than the current way of doing things.
>
> All those \s are to encapsulate the whole thing into the
> template-style macro - not that I like this, but I cannot see an
> alternative.
An obvious alternative is to leave things the way they are. I've
noticed that this is a stance Linus typically adopts for improvements
that aren't clearly better in every way ;-)
-- Daniel - 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/