DevFS a short introduction

Devfs is an alternative to "real" the special device-nodes in the /dev directory on your root filesystem. Kernel device drivers can register devices by name rather than major and minor numbers. These devices will appear in devfs automatically. Devfs has been in the kernel since 2.3.46 and ROCK Linux was the first distribution that adapted it!

What is special?

With devfs you will only see the device-node that are present on your system and they are human-readable names like /etc/ide/host0/../disc. not /dev/hda ;-)! To get arround the long names all discs are also grouped in /dev/discs, and the cdroms in /dev/cdroms. A short overview:

IDE devices: /dev/ide/hostX/busY/...
SCSI devices: /dev/scsi/hostX/busY/...
All discs: /dev/discs/discX/...
All cdroms: /dev/cdroms/cdromX/cd
All floppies: /dev/floppy/X
Seriel port: /dev/tts/X
Parallel port printets: /dev/printers/X
Video4Linux devices: /dev/v4l/X
New style input devices: /dev/input/...

But devfs has one problem: The devices-nodes appear automatically when a driver recognizes a module. But whow should a module be auto-loaded if no device-node is there to trigger this?
For this a new devfs-daemon got created which receives events from the devefs to possibly perform action when a progams open/lookup files in /dev.

The damon gets configured in /etc/devfsd.conf. A short example:

LOOKUP loop/* MODLOAD
LOOKUP ppp MODLOAD

LOOKUP scsi/* MODLOAD
REGISTER scsi/.*/generic PERMISSIONS root.cdwrite 660
The LOOKUP event occures when a program tries to find a node. For example cdrecord wants to open a scsi device to burn a CD. In this case it opens a file in scsi/host0/... and so triggers devfsd to evalutate the scsi/* line and to perform the MODLOAD action.
The MODLOAD action will try to load a modulde by using /etc/modules.devfsd and /etc/modules.conf. The modules.devfsd is a auto-generated files which mappes the names slightly. For example all scsi names will be mapped to scsi-hosts and some other needed modules. So you only have to place a line like "probeall scsi-hosts aic7xxx" in your /etc/modules.conf.

Permisson configuration

Permissions should be configured using the REGISTER event which happens when a new device is recognized and the device-node gets registered. The example above should be self-explaining ...

Far more details about devfs can be found at Richard Gooch's devfs page

Last modified: 2003-06-13 04:27 Copyright © 1998-2003