On Mon, 27 Mar 2000, Jamie Lokier wrote:

> > Presumably this is so that the floppy driver can check that nobody
> > expects to read or write the disk while a format is in progress?
> > If so, I accept the need for O_NONE.
> 
> No, it's so fdformat can open /dev/fd0 before fd0 knows what floppy
> format to use, and so it doesn't try to autosense the format.  But I'm
> not sure fdformat actually does this -- it was mentioned by someone
> during the O_NONE thread, thqat is all I know.

OK.  If this is the case, then I'm with you on preferring a
/dev/fd0Nodetect.

> > lstat("./defines.h", {st_mode=S_IFREG|0664, st_size=318, ...}) = 0
> > open("./defines.h", O_RDONLY|O_LARGEFILE) = 6
> > [ is bad ]

> > open(path, O_RDONLY|O_DEFEROPEN)    = 6
> > fstat(6, ...)                               = 0
> > fcntl(6, F_REALLYOPEN)                      = 0

> > is safe (though we do need O_SYMLINK to complete the picture).
>
> Use O_NOFOLLOW.

Not hardlink-proof.

> (How do you intend to use O_SYMLINK?)

To provide for atomic open/fstat/read instead of the racy lstat/readlink.
Actually, I suppose that just readlink() would do, if used properly.

> > > Your O_DEFEROPEN actually seems like the right thing in many cases,
> > > like when you want to open a device file prior to fstat(), and you
> > > don't really want to open the device.
> > 
> > Yep.  I just don't understand your desire to combine the two.
> 
> They're so similar -- do we really need to very similar different
> thingws.

As I see it, they are only similar because of your desire to abuse one to
provide the other.  Despite its fairly silly overloading in the floppy
driver, O_NONE means "give me a filehandle _to this object_ upon which I
can neither read nor write".  Delayed open means "pathnames suck, give me
a stable handle to the inode (but not the object) at the end of this
path".

> If so, let's isolate the orthognal differences and make them work in
> all reasonable circumstances.  Hence F_REOPEN.

This does open up a few holes, though I don't think that they are
significant ones.  I wouldn't have a problem with this.

Matthew.

Reply via email to