The status of dynamic devices in 2.6
[Posted December 10, 2003 by corbet]
Some of the new users who are just now beginning to test out the 2.6 kernel
are encountering a bit of a surprise: devfs is now marked as being
deprecated, and users are being pointed to the user-space "udev" solution
instead. The deprecation of devfs is no surprise to those who have been
following the discussions; despite significant fixups over the 2.5
development cycle, the devfs code continues to have problems which are seen
as not being fixable. Some of these problems can lead to kernel deadlocks
and worse. These issues are compounded by the fact that the devfs
maintainer, Richard Gooch, has not been heard from in some time.
The loss of devfs bothers a relatively small number of people; of the large
distributions, only Gentoo uses devfs. But those users have tended to be a
little unhappy with the alternatives - many people who have looked at udev
(which was first examined here back in
April) have concluded that it is not yet ready. Many of the features
of devfs are still missing, udev does not yet handle all types of devices,
and support for the devfs naming scheme has been slow in coming. As a
result, devfs users feel left out in the cold.
What some observers may have missed is that udev development has taken off
in the last couple of months. udev 003,
released on October 16, was mostly the work of its original author,
Greg Kroah-Hartman. Since then udev has picked up its own development
community and evolved considerably. The current release as of this writing
(udev 008) is a much stronger offering, and
several new features are queued up for the 009 release as well. Among
other things, udev now offers:
- A FAQ
file of its own.
- A "callout" option which allows difficult devices to be set up with an
external program.
- Ability to build with klibc for embedded or initramfs usage.
- Proper disk partition support.
- Printf-style formatted dynamic name support.
- Regular expression pattern matching in rules.
- Symbolic link support.
...and quite a bit more. At this point, udev contains something close to
the full set of features needed to enable it to replace devfs.
The problem is not yet entirely solved, however. udev depends on sysfs for
the information needed to configure device nodes, and not all devices have
complete sysfs support at this point. Thus, for example, udev will not yet
work with input devices, misc devices, and some others. Certain kinds of
subtleties (distinguishing CDROM drives from regular disks, for example)
are not yet there. The fault is not with udev itself, but with the
information (or lack thereof) that it gets from the kernel. In many cases,
patches to add the relevant devices to sysfs are in circulation, but have
not yet been merged into 2.6. Once that support has been added, the
picture will be nearly complete.
There is one remaining question from devfs users, however, which has earned
its own place in the FAQ: dynamic loading of drivers. devfs has the
capability to create a device node while deferring loading of the
appropriate driver module until a user program actually opens that device
node. udev cannot do that, and there is no plan to add that support. In
the 2.6 world, driver modules are loaded by the hotplug mechanism when the
device is detected, so there is no need to load them at open time. This
approach bothers some users who prefer not to load drivers for rarely-used
devices, but most users will be able to live with it.
(See also: the udev 008 man page for
information on how udev works, and
Robert Love's HOWTO on using udev
with the development version of Fedora).
(
Log in to post comments)