What are the definitions of and the relationships between instances, device numbers, minor nodes, major numbers, and minor numbers?
"Instance numbers" are part of the "shorthand" name for "
dev_info" nodes owned by a particular driver. These nodes are usually associated one-to-one with a particular hardware instance: the two 85C30 chips in a SPARC station each have a
dev_info node called instance zero or
zs and instance one.
Instance numbers are assigned (and owned) by the system, and returned to the driver by
ddi_get_instance(9F). Instance numbers and "shorthand names" are not normally visible outside the kernel.
host% ls -l /devices/pseudo/mm:zero crw-rw-rw- 1 root 13, 12 Oct 11 02:20 /devices/pseudo/mm:zero
"Minor nodes" consist of all the information that is held about a user-accessible device that is the minor number (exported by the special file), part of the name of the special file (the '
zero' in "
mm:zero", minor number 12 of the "
mm" driver), and whether it is block or character. See
ddi_create_minor_node(9F) for how to build one.
"Device numbers" are contained in an opaque type "
dev_t". They consist of a major number and a minor number.
The "major number" is an internal magic number used by the system to bind special files (such as
/devices/pseudo/mm:zero) to device drivers.
In the example above, the "major number" is 13. There is usually no reason for the driver to care what its major number is as they are assigned by the system.
The "minor number" is a component of the device number. It's meaning is entirely up to the device driver, and it is associated with a special file by calling
ddi_create_minor_node(9F). In the above example, the minor number is 12. Minor names are associated with minor numbers, as the part following the colon in the name of the special file ('
zero' in this case).