Subject: devfs (was Re: Not updating device file inode change times)
To: Eduardo E. Horvath <eeh@one-o.com>
From: Todd Vierling <tv@pobox.com>
List: tech-kern
Date: 09/04/1998 12:31:38
[MOVING TO TECH-KERN - NOTE HEADER!]

On Fri, 4 Sep 1998, Eduardo E. Horvath wrote:

: If we had a normal /dev devfs with standard devices (i.e. /dev/sd0a) then
: we could union-mount another filesystem on top of it to cache any 
: permission changes.  Then reconfiguring the machine involves
: un-union-mounting the cache filesystem, runing `rm -rf' on it, and
: re-union-mounting it.  The cache filesystem could even be (gasp) /dev :).

[Pipe dream brainstorm]

There is a solution here that also solves the problem of having /dev nodes
on a NFS server (remember, that can be dangerous if the OS's, or even just
the _architectures_ are different).  The NFS server problem is one I'm
presently faced with.

Make /dev be mounted dynamically inside the kernel at boot, before init is
run.  This guarantees the existence of /dev/console, and allows the
underlying /dev directory to be completely empty.

devfs would be a layer filesystem of its own, who would check the lower
layer for files that do not exist in devfs, and files with the same name as
devices which contain only:

- file access and modification times
- file ownership and permissions

which would be modified in the lower layer as necessary.  If there is no
backing file in the lower layer for a given /dev node, it is created at any
time that one of the above needs to be changed (0 bytes, similar to a
"touch").  A special value for mtime (0, perhaps) would indicate a
"whiteout" to the devfs such that nodes could be deleted.

This doesn't handle renaming nodes, unfortunately.  However, it does allow
nodes to have symlinks inside /dev.

Devices needing nodes would need to export names for devfs to create the
necessary nodes.  This would probably be some kind of callback hook passed
into the attach function.

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)