lkml.org 
[lkml]   [2001]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [CFT][PATCH] large /proc/mounts and friends

On Tue, 16 Oct 2001, Alexander Viro wrote:
> >
> > Al, do you see any problems in this? I bet a lot of /proc files will fit
> > this model, and need only a fairly simple "fillme()" function..
>
> It's _very_ close to what I've done.

Ok, now that I read it right, I agree. And not wasting the low bits of the
position should allows some sparse indexing..

One comment: I really think your "lseek()+read()" interaction is fairly
disgusting, though. the

for (p=m->op->start(m), i=0; i<pos; p=m->op->next(m, p), i++) {
...

thing makes it impossible to "jump" to the right location directly, which
might be perfectly sane and easy for many uses. Maybe simply through a
simple "seek()" interface (that could have a fall-back with the "one entry
at a time" loop using the "next" interface if you think that's going to be
common), and a flag that says "lseek has happened".

So you'd have the start be something like

p = m->op->start(m);
if (m->did_lseek) {
m->did_lseek = 0;
p = m->op->seek(m, pos);
}
p = m->op->next(m, p);

instead of that for-loop..

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:18    [W:0.091 / U:1.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site