Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

From: Al Viro
Date: Wed Aug 15 2007 - 00:19:14 EST


On Wed, Aug 15, 2007 at 11:39:45AM +0800, Fengguang Wu wrote:
> On Sun, Aug 12, 2007 at 11:08:46AM -0400, Mathieu Desnoyers wrote:
> >
> > static void *m_next(struct seq_file *m, void *p, loff_t *pos)
> > {
> > - return seq_list_next(p, &modules, pos);
> > + return seq_sorted_list_next(p, &modules, &m->private);
> > }
>
> In theory it is not safe to use something other than the passed in
> *pos as an position indicator. Because seq_file do not always call
> ->next() to advance to the next item. Look at seq_file.c, it sometimes
> increase the pos/index directly! Which also prevents pos to skip
> forward, which is preferred in your case.
>
> The attached patch tries to fix it.
>
> The seq_file.c is so twisted!
>
> Fengguang
> ===
>
> seqfile: remove seq_file's assumption about iterators
>
> The seq_file implementation has some hardcoded index++/pos++ lines,
> which assumes iterators to be *continuous* integers.

What the fuck? It assumes no such thing and a lot of iterators are
nothing like integers. What are you talking about?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/