linux-device-driver

Use of MAJOR and MINOR device numbers


I do have some clarifications with regard to the concept of major and minor device numbers. I understand the following concepts.

The question I have is where in exactly these numbers are used. As of I checked, It lead me to the following answer

The kernel uses this number to identify the driver associated with the device

Can anyone help me with this.


Solution

  • Doing a ls -l /dev/* will show something along the lines of

    ...
    crw-rw---T+ 1 root audio 116, 33 sept. 21 09:19 timer
    ...
    

    The 116, 33 are the major and the minor of this specific device.

    Tha major sets the type of the device, usually the driver associated with it. The minor list the first, second, third, ... device of that type.

    There's only one driver per major number and multiple minors are handled by it.

    Of course, now it is possible to dynamically allocate those numbers.