I read "Linux device drivers 3rd edition" and found something that I cannot understand.
in chapter 3.2, the author said:
Traditionally, the primary number identifies the driver associated with the device. The lowest number is used by the kernel to determine which device it belongs to.
Then I tried "ls -l / dev" to look, I found something unusual:
brw-rw---- 1 root disk 1, 1 2011-08-23 23:52 ram1 brw-rw---- 1 root disk 1, 2 2011-08-23 23:52 ram2 brw-rw---- 1 root disk 1, 3 2011-08-23 23:52 ram3 brw-rw---- 1 root disk 1, 4 2011-08-23 23:52 ram4 brw-rw---- 1 root disk 1, 5 2011-08-23 23:52 ram5 ... crw-r----- 1 root kmem 1, 1 2011-08-23 23:52 mem crw-r----- 1 root kmem 1, 4 2011-08-23 23:52 port crw-rw-rw- 1 root root 1, 3 2011-08-23 23:52 null crw-rw-rw- 1 root root 1, 5 2011-08-23 23:52 zero
All of these devices (ram1-ram5) have a clone with the same basic, but different name and type. I thought the author said that "the main number means the device class, and the lowest number means the device index. Therefore, Major-Minor identifies a unique device."
Now I am confused. Why can two devices have the same major? What are the device numbers?
Correct me if I am wrong .. Thanks in advance.
source share