Saturday, 9 March 2013

Re: [gccsdk] unixlib directory iteration doesn't work on Fat32FS

In message <381fea2853.martin@blueyonder.co.uk>
on 7 Mar 2013 Martin Bazley wrote:

> The following bytes were arranged on 7 Mar 2013 by alan buckley :
>
> > On Thu, 7 Mar 2013 11:23:12 Martin Bazley wrote:
> > >
> > > The following bytes were arranged on 6 Mar 2013 by Matthew Phillips :
> > >
> > > I have been wondering about this, with the caveat that I also have not
> > > looked at the UnixLib code. This is for wildcard scanning, right? Why
> > > would it need to go backwards in those circumstances?
> >
> > I've had a brief look at the code, and it appears to scan through the
> > directory with a subscan of directories used for suffix swapping. So I
> > don't think it does go backwards, just into subdirectories and then
> > continues on when the subdirectory is finished.
>
> I don't understand. The value returned in R4 doesn't expire. You can
> perfectly well take a backup on the stack, recurse into the directory
> and continue from where you left off afterwards.
>
> There *is* a known problem with using previous values of R4 when
> deleting or otherwise changing the number of files in a directory at the
> same time as scanning it, but I sincerely hope it isn't doing that!

Still not having looked at the code, my impression is that the routine in
question is returning a single 32-bit word to *its* caller which attempts, in
one word, to keep the position in the directory and the subdirectory. See
the start of the thread where Alan quoted from the code:

/* After preaching the passion, now the hack : when we're going to do
the reverse suffix swapping, we will have up to two outstanding OS_GBPB
sessions : one in the main dir and another in the suffix dir.
How we're going to give an 'off_t' result in telldir describing these
two offsets in OS_GBPB ? Well, we are going to rely on unity monotonic
increase of the offsets and this up to GBPB_MAX_ENUM. If these
conditions are not fullfilled, we stop the enumeration.
Another solution is to return table index numbers which, when presented
to seekdir, will get looked up in a table giving the two internal dir
offsets. */

How exactly it relies on unity monotonic increasing, I don't know. Perhaps
I'd better download unix/dirent.c to see.

--
Matthew Phillips
Durham

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

No comments:

Post a Comment