lkml.org 
[lkml]   [2008]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] readdir mess


On Tue, 12 Aug 2008, Al Viro wrote:
>
> Doesn't work well for readdir(2)...

Sure it does.

> > error = vfs_readdir(file, filldir, &buf);
> > lastdirent = buf.previous;
> > if (lastdirent) {
> > error = count - buf.count;
> > if (put_user(file->f_pos, &lastdirent->d_off))
> > error = -EFAULT;
> > }
> > fput(file);
> > return error;
> >
> > and we wouldn't need any other logic at all.
>
> you've just lost e.g. -EIO for getdents().

No I've not.

If we returned a partial result, we _should_ return a partial result.

And if we got EIO on the first entry, we should return EIO.

The _current_ code is crap. It sometimes returns the error (if the
->readdir() function returned error), and sometimes returns the partial
result (if the "buf.error" was set).

> Frankly, I'd rather keep ->readdir() instances simpler. There are far
> more of those, for one thing. As it is, we only have "stop"/"continue"
> ->readdir() has to care about...

Keeping them simple (and not changing them - always returning zero is what
the _original_ readdir() thing did!) is why the current situation exists.

So if we keep it that way, then we really *KEEP* it that way. Don't go
around changing any of the existing rules. Just make sure that the
callbacks keep on always returning negative or zero (and never positive).

Linus


\
 
 \ /
  Last update: 2008-08-12 22:05    [W:0.332 / U:0.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site