Subject: Re: readdir()/getdents() portability -- "."/".." always first?
To: None <M.Drochner@fz-juelich.de>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: current-users
Date: 09/04/2003 18:25:26
Currently, all our filesystems do return '.' and '..' as first two
entries for getdent(). Perhaps it would be good if coda_readdir()
would make sure to do the same.

Jaromir 


Matthias Drochner wrote:
> 
> Hi -
> trying to deploy coda I found that a "make" within the coda mounted
> tree sometimes fails because it fails to find certain source files.
> The reason is appearently the following code in usr.bin/make/dir.c:
> 
> >         if ((d = opendir (name)) != (DIR *) NULL) {
> > [...]
> >             /*
> >              * Skip the first two entries -- these will *always* be . and ..
> >              */
> >             (void)readdir(d);
> >             (void)readdir(d);
> > [...]
> 
> coda uses hash tables to store directory entries and doesn't bother
> to sort the entries for VOP_READDIR. So it happens that a file is
> invisible for "make" it it occupies one of the first two directory
> entries.
> 
> This is probably not coda specific since hashtable / btree or whatever
> optimized filesystems are en vogue.
> 
> Can we _really_ rely on "." and ".." to be the first 2 entries,
> whatever filesystem we use (or whatever system we compile our
> "make" on)?
> 
> best regards
> Matthias
> 

-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-