DEVINFO(5)

NAME
DEVINFO - device entry database

DESCRIPTION
DEVINFO is a text file that describes all the possible devices for a system. It is used by MAKEDEV(8) to create special file entries in /dev. It may be named either /dev/DEVINFO or /etc/devinfo. Information about custom local devices, if any, should be placed in DEVINFO.local or /etc/devinfo.local, which has the same syntax.

The file format is free-form. Both C, C++, and shell comments are understood. There are basically four statements:

ignore { proc-device... }
    This causes the specified names to be ignored if found in /proc/devices.

batch { device... }
    This creates a "batch" - a collection of devices which will all be created when the batch is invoked. For example, in the standard DEVINFO, "generic" is a batch.

block device-spec
    This defines one or more block devices.

char device-spec
    This defines one or more character devices.

Here is a sample device-spec:
    (std, 1) {
        mem (kmem) : 1
        null (public) : 3
        core -> "/proc/kcore"
    }

This example defines a group of devices called "std", with major number 1. Running MAKEDEV std will create all the devices in the group; running, for example, MAKEDEV null would make just the one device "null".

It is possible to specify, instead of just "std", something like "std=foo". In this case, the stuff on the right-hand side of the equals sign specifies a name from /proc/devices, and the major number will be retrieved from there if present. If an entry from /proc/devices is specified, the explicit major number may be omitted. In this case, if the number is not found in /proc/devices, attempts to create the device will be rejected.

Inside the braces is a list of specific devices. The name in parenthesis is the "class" - this is something specified in MAKEDEV.cfg (q.v.) that determines the ownership and permissions of the special file created. In the above example, the device "mem" was set to have the class "kmem", but "null" was set to be "public". Ordinarily you'd define "public" to be mode 666, but "kmem" to be mode 660 and owned by group kmem. The number after the colon is the minor number for this particular device - for instance, 3 for "null".

You may also specify a symbolic link with "->". For instance, above, "core" was made a link to /proc/kcore. Note that names may contain any characters, but names that contain things other than alphanumerics, dash, and underscore should be put in double quotes.

An entire range of devices can be created: you may specify a range of numbers in brackets, like this:
    tty[1-8] (tty) : 1
This creates tty1-tty8 with minor device numbers starting with 1. If you specify the range in hex (prefixed by 0x) the device names will be created numbered in hex, as is normal for ptys. The range may appear inside the name string, but there may only be one range.

There is a special syntax for creating the entire banks of devices for a hard drive:
        hd[a-d] 8/64
What this means is as follows: create hda, and 8 partitions on hda (hda1 through hda8), starting with minor number 0. Then create hdb, and 8 partitions, starting with minor number 64. Then hdc, etc., with minor number 64*2 = 128. And so forth. These are automatically placed in the class "disk". The necessary groups and batches are created so you can ask MAKEDEV to create "hd" or "hda" or "hda1" and expect it to do the correct thing.

Note that simple arithmetic is permitted for specifying the minor device number, as this often makes things much clearer and less likely to be accidentally broken.

SEE ALSO
MAKEDEV(8), MAKEDEV.cfg(5)