[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] New MiNTlib & FreeMiNT functions



On Wed, 2008-02-27 at 12:57 +0100, Frank Naumann wrote:
> Hello!
> 
> >> First you must define a format that Fread() give back on an open
> >> directory. Then you need to enhance every (I think at least ext2, minix,
> >> vfat and the ramfs) xfs to support this new feature and to return this
> >> format on a Fread(). At the moment the xfs just return the on disk data (I
> >> think this is a very bad idea).
> >
> > I'll check the situation with Fread, but that should just return EISDIR
> > as reading isn't allowed. So I'll fix this.
> 
> That's the point I mean with side effects ... Fread() mainly pass through 
> to the xdd. There is no check inside any xfs read() against directories 
> ...
> 
> Btw. now I'm very curious. What's the advantage if we can open directories 
> but can't read these directories? Just for fchdir()?

Yes, but fdopendir takes an open file descriptor and hands back a DIR
structure. They are convenience functions that coreutils and findutils
take advantage of.

> > Remember, we only allow opening a directory READONLY !
> 
> Even read access may have side effects. There are a lot of code paths you 
> can apply on a filedescriptor. For example fchown, fchmod, fcntl, fselect, 
> flock, fforce, fdup and a lot, lot more. All these code paths expect until 
> now only regular files. You need to check and verify all these code paths 
> for side effects (inside kernel and maybe also inside mintlib).

Yes, absolutely. Will do for the next round of patches.

Alan.