Next | Prev | Up | Top | Contents | Index

Major and Minor Device Numbers

Internally, the kernel does not deal with filenames to differentiate among devices. Instead, the kernel uses major and minor device numbers. The major device number identifies the driver module to use for a given special device. This varies among operating systems:

While the change from IRIX 5.2 to IRIX 5.3 does not permit the use of all 14 bits of the SVR4 major_t value, it is a compromise between a demand for more major numbers and conserving kernel data space, since the number of major values defines the size of the MAJOR table and the [cb]devsw tables. This increases the size of the variable necessary to contain a major device number from an unsigned char to at least a short. The master.d/README files contain further information on this topic.

Most device drivers do not need to know what their major number(s) are; those that do should use the DDI getmajor() routine and major_t data type to manipulate them.

If you have been accessing the MAJOR array as an array of unsigned chars, it is now an array of unsigned shorts. The DONTCARE value has also changed, and the lboot program has been modified to accommodate these alterations.

In any case, the number you choose as the major number for your device driver must not be assigned to any other device. See /usr/include/sys/major.h on your system for a list of assigned major numbers.

The minor number is 18 bits long and can contain values from 0 to 0x3FFFF. The minor device number has no predetermined use, so your device driver can use the minor device number as you see fit. For example, the driver can use the minor device number to differentiate multiple devices on the same controller.

See the man pages for the MAKEDEV(1M), master(4), mknod(1M) commands for additional information.


Next | Prev | Up | Top | Contents | Index