A minor device number is the second component of a device number. In the Linux interface, minor(d) extracts it from a value of type dev_t; the matching major device number supplies its device-class context.[ref]
A concrete Linux allocation distinguishes two character-special interfaces sharing major1: /dev/null has minor3, while /dev/zero has minor5.[ref] The former supplies end-of-file when read, while the latter supplies zero-valued bytes. Their different minor values select different interface behavior within the same major allocation.[ref]
For an original pair comparison, let two registered character-device interfaces have numbers and . Both have minor7, but their complete device numbers differ. Conversely, and share a major while selecting different minor values within it. A minor value alone is therefore insufficient to identify the interface.
Minor numbers are interpreted in the relevant device allocation; there is no universal rule that every minor counts disks, partitions or physical pieces of hardware. The device may also be a purely virtual interface. The conversion functions preserve the structured components:
for supported component values. Extracting the component with the documented interface avoids assuming an implementation-specific bit packing.

Articles by others on the same topic (0)

There are currently no matching articles.