Specifications

Understanding Device Drivers
2-
7
Major and Minor Numbers 2
Before the operating system can access a device, the device needs its driver installed and a
special device file created for it in /dev. The special device file contains the major and
minor device numbers.
Major Numbers 2
The major number identifies the device class or group, such as a controller for several ter-
minals. It tells the kernel which driver's open routine to call. Installable Driver Tools
(idtools) sequentially assigns major numbers to each device driver as it installs them. It
assigns the numbers by creating an entry in a driver system configuration file, the Master
file, described in a following section.
idtools assigns major numbers separately for block and character devices. This means
two separate special files for two different device drivers might have the same assigned
number. A device that supports both block and character access (for example, the floppy
driver), can have different major numbers for the character and block device files.
Minor Numbers 2
The minor number identifies a specific device, such as a particular terminal. Driver writers
assign minor numbers to special device files in another system configuration file, the
Node file (see the Node(4) manual page).
Minor numbers usually distinguish sub-devices, but can also convey other information.
For example, floppy disk controllers read and write data from floppies in several formats,
and manage two floppy drives. When the kernel opens the special file associated with the
floppy driver, the minor number used to open the file must tell the floppy driver both which
drive to access and what format to use for the I/O operation. In this case, the least signifi-
cant bit of the minor number identifies the drive and the remaining bits identify the format.
Driver Entry Points and Kernel Utilities 2
This section discusses system tables and their associated entry points in detail.
Entry Points 2
Three ways exist to call a device driver:
Initialization calls by boot routines