[haiku-development] Re: Ticket #2617 seekdir and telldir not implemented

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 22 Dec 2009 23:22:45 -0500

Hey! Someone with commit access did end up implementing these functions
(telldir() and seekdir()). And to do it they did had to extend the DIR
struct to include the following:

long                    seek_position;
long                    current_position;

This is exactly what I was proposing when I said "My solution is to extend
the _DIR struct to include a loc and an off property" although the author of
the above code decided to give them more descriptive (but less canonical)
names. He also extended readdir() to set these properties by way of the
do_seek_dir() function. And hey, I was also right that it appears to have
been a lot of work. I am happy to see that somebody did the work for me but
I see that the test for this is still sorely lacking... I am going to try
and tackle that.

John Scipione


On Tue, Aug 19, 2008 at 4:08 PM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>wrote:

> "John Scipione" <jscipione@xxxxxxxxx> wrote:
> > My solution is to extend the _DIR struct to include a loc, and an off
> > property (we already have a size in dir->first_entry.d_reclen).
> > readdir() and seekdir() should set those properties, and telldir can
> > simply return the offset. This means that I am going to have to do
> > some reimplementation work on readdir(). It also means that I am
> > going
> > to have to store the current "chuck" in the _DIR struct as well so
> > that I know what chuck my offset is relative to. It is a lot of work.
> > But in the end I think that it will all be a lot simpler.
>
> There also is a small test app (src/tests/system/libroot/posix/
> dirent_test.cpp) that might help you in getting it right.
>
> Bye,
>    Axel.
>
>
>

Other related posts: