Subject: making all fd's point at vnodes?
To: None <tech-kern@netbsd.org>
From: Bill Sommerfeld <sommerfeld@netbsd.org>
List: tech-kern
Date: 06/16/2001 12:33:18
So, we currently have two levels of dispatch in the read/write path
before we get to the "meat": there's  descriptor type dispatch, which
until recently was just "socket" vs "vnode" (and we just got
DTYPE_PIPE, and kqueue's are coming, too); then, we hit the
descriptor-type dispatch routine which turns around and does *another*
level of dispatch based on the socket or vnode type.

If you look at vn_read() or soo_read(), you see that they do almost no
useful work -- they just shuffle arguments and call right through to
to the next lower layer.  

I think it makes sense to flatten these layers together.  as a first
cut, this would involve:

 1) make file->f_data into a "struct vnode *"
 2) nuke "struct fileops" entirely
 3) mutate kern/sys_socket.c into "sockfs"; likewise for the new pipe
implementation and kqueues.  (sockfs would *not* be mountable; it
would be an internal vnode implementation similar to specfs or
deadfs).
 4) tweak the VOP_READ() and VOP_WRITE() function signatures (to
resemble the current vn_read signature), eliminating the flag and lock
juggling done at the vn_read() level.
 5) nuke "ioflag"'s separate flag space; instead, merge the IO_* flags
into the same flag space as the F* and O_* flags..
(looks like the only "new" ones are IO_NODELOCKED and IO_UNIT;
IO_APPEND==FAPPEND==O_APPEND, IO_SYNC==FFSYNC==O_SYNC,
IO_NDELAY==FNONBLOCK, IO_DSYNC==FDSYNC|FRSYNC==O_DSYNC|O_RSYNC, and
IO_ALTSEMANTICS==FALTIO==O_ALT_IO).

					- Bill