Subject: Re: fcntl changes once again.
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Roger Brooks <R.S.Brooks@liverpool.ac.uk>
List: tech-kern
Date: 07/13/1999 22:46:11
On Tue, 13 Jul 1999, Bill Studenmund wrote:

>Flagrant bastardization? fcntl is defined (in syscallargs.h) as taking two
>ints and a void *. How is letting some of them hit the fs a
>bastardization? They are a part of the command space which isn't used, and
>we still leave traditional fcntl's more than enough space to grow (i.e.
>2^31 commands).
>
>The thing I really prefer about fcntls over ioctls is what doing this with
>ioctl's will do to the vnode interface. Irregardless of how userland
>initiates these accesses, we need a new VOP. One, the current ioctl entry,
>which varies from files, device nodes, and fifos. The other, what I want
>to call fcntl, would be the same for all three (for everyone following the
>discussion, see the setup of ffs_vnodeop_entries, ffs_specop_entries, and
>ffs_fifoop_entries in sys/ufs/ffs/ffs_vnops.c).
>
>The idea that ioctl(2) calls one for some codes and the other for others
>strikes me as one of those sick things Linux does and we all rag on.
>That's what I prefered about the fcntl idea. You do a fcntl in userland,
>and you enter here. You do an ioctl and you enter there.


Wouldn't it be better to have something like:


	fcntl( fd, F_SETFSOPT, (void *) &fsopts )


The details of exactly what would be in fsopts are a bit vague, but it could
be something like:

	struct fsopts {
	int	f_fstype;
	int	f_option;
	int	f_value;
	}

The parameter could be passed down the vfs layers (like a streams ioctl) until
it reached a layer of the right fstype.  Setting f_fstype to -1 might be used
to let every layer have a look at it.  If you are going to have more than one
layer of the same filesystem type, you'd probably want another field
(f_fsinstance) to say which of the layers of f_fstype you wanted to modify.

You'd probably also want an F_GETFSOPT (although this could obviously only
return a value from one layer per call), and maybe an F_GETFSTYPE which
would let you sound the layers one at a time to find out what they are.




Roger

------------------------------------------------------------------------------
Roger Brooks (Systems Programmer),          |  Email: R.S.Brooks@liv.ac.uk
Computing Services Dept,                    |  Tel:   +44 151 794 4441
The University of Liverpool,                |  Fax:   +44 151 794 4442
PO Box 147, Liverpool L69 3BX, UK           | 
------------------------------------------------------------------------------