Re: [linux-usb] Re: USB device allocation

Theodore Y. Ts'o (tytso@MIT.EDU)
Tue, 5 Oct 1999 22:57:22 -0400


Date: Tue, 5 Oct 1999 21:49:41 -0400
From: Johannes Erdfelt <jerdfelt@sventech.com>

I was advocating devfs because it's there. My understanding about devfs
now is that's mostly userspace. The only thing kernel space is a /proc
like dynamic fs interface for devfs. All of the policy is in userspace.

... and it's the policy part which is the hard part.

Look, there's basically three pieces to the problem. One part is somehow
notifying the user-space daemon that some device has appeared, so it can
take appropriate action (either creating the device, or changing the
modes on the device after devfs magically makes it appears).
The second part is the user-space daemon itself, where all of the policy
is contained. And the third part is the the filesystem interface which
makes "/dev" appear, and maintaines persistance of ownership and modes
across reboots, etc.

Devfs uses the dynamic filesystem idea for the first and third parts,
while it's "neat", it's not the right interface for doing things. The
problems are most obvious in the third part: /dev has state that needs
to be persistent. If you store it in a real filesystem, you get that
for free. With devfs, you have this extra kernel code to store all of
the devices in memory, and in a real filesystem you get this for free.
In order to handle persistence, in devfs you have to have this horrible
kludge where you run tar over the devfs at shutdown time. And, any
claims of performance speedup because "devfs is in memory", is
completely negated by the dcache layer anyway. So why not use a real
filesystem, eliminate the devfs code and the extra filesystem, and
dispense with the "tar cf" kludge?

I think everyone has agreed that a daemon needs to exist, which is
userspace, has some sort of interface to the kernel to be notified about
additions and deletions and creates a /dev based on user policy. Do you
agree with this? Does anyone disagree with this?

The main thing which we are missing right now is a standard interface
where the kernel can dump out all devices in some standard form, and
notify user-space programs when new devices have appeared. That's the
only kernel level support we need, and sure, some of Richard's devfs
patches could be used to help give us this dynamic notification
capability. I claim that there are better interfaces than readdir() +
stat() and a dynamic filesystem in order to pass this information to
userspace, though, and I hope most people would agree with me. Why
don't we try to design that interface first, and I suspect the rest will
follow relatively easily.

- Ted

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/