Re: devfs vs udev, thoughts from a devfs user

Theodore Ts'o
2004-02-10T20:13:55Z

On Tue, Feb 10, 2004 at 10:43:03AM -0800, Mike Bell wrote:
> That's a valid point against the existing devfs/devfsd, there are a few
> of those (the races, for instance). But it's not inherent to the idea of
> a devfs.

At least some races are inherent to the idea of having a filesystem
which is mounted on /dev. At some level, this seems to be your main
complaint to the udev/sysfs combination --- that you cannot mount some
particular magic filesystem on top of /dev. But think about it. If
you are having the kernel specify a specific name, and then allow
devfsd program to override it (but have it magically appear in /dev if
devfsd is not running) it is very hard to avoid the races, and it
certainly makes it hard to do anything other than the one sender, one
receiver model.

If instead you have a filesystem which fundamentally must be mounted
somewhere else, such that there is no question that it can't be
mounted on /dev, and you have a notifer which tells you what's going
on --- well, you have the udev/sysfs combination.

You could pontentially do this if you mount the devfs filesystem on
/devfs, but as near as I can tell, that was just a stalking horse by
the devfs folks who tried to be all things to all people. If you're
going to mount devfs on /devfs, then udev/sysfs does a better job,
because that's what it's designed to do.

> > udev defaults to this. Which is the sane thing to do.
>
> I don't know about that. from what I remember of the original devfs
> discussion, it was along the lines of "LSB involves every device in
> /dev, and is dumb. We need a new scheme, this is as good as any. Anyone
> who has a better idea for how devices should be laid out, let me know."

What udev defaults to is making the namespace be controlled strictly
by the userspace. (i.e., the mount devfs on /devfs approach).

As far as putting everything device name in a single directory, that
doesn't happen in /sysfs, since the filesystem tree reflects the
system's device tree. And in terms of where to put the devices in
/dev, in udev that's strictly a userpsace issue --- which is where it
should be.

- Ted