harsh sharma wrote:
hi all,
i ls the /dev directory and saw the two numbers called
major and minor numbers for each device....

can anyone tell me what is the significance of these
two numbers and if they are not what difference can it
make....

why only one out of them is not sufficient?


Each device driver in the system is programmed to handle devices of a particular type number. You can take a look at the device drivers and their allocated device types by executing the command "cat /proc/devices".


For every device type, there can be a number of devices on the system. The minor number helps the device driver differentiate between the different devices of its type on the system.

For example, my /proc/devices shows:

 Block devices:
  1 ramdisk
  2 fd
  3 ide0
  7 loop
 [...]

This shows that my IDE disk driver has the major number 3.
The following devices are handled by this driver.

$ ls -l /dev/| grep " 3," | grep ^b | sort -n -k 6 | head
brw-rw----    1 root     disk       3,   0 Jan 30  2003 hda
brw-rw----    1 root     disk       3,   1 Jan 30  2003 hda1
brw-rw----    1 root     disk       3,   2 Jan 30  2003 hda2
brw-rw----    1 root     disk       3,   3 Jan 30  2003 hda3
brw-rw----    1 root     disk       3,   4 Jan 30  2003 hda4
brw-rw----    1 root     disk       3,   5 Jan 30  2003 hda5
brw-rw----    1 root     disk       3,   6 Jan 30  2003 hda6
brw-rw----    1 root     disk       3,   7 Jan 30  2003 hda7
brw-rw----    1 root     disk       3,   8 Jan 30  2003 hda8
brw-rw----    1 root     disk       3,   9 Jan 30  2003 hda9

Whenver you try to read or write from any of these devices, the kernel calls the appropriate device driver according to the major number (3 for ide0), and the device driver knows from the minor number which device/partition you want to read/write from.

- Sandip
--
Sandip Bhattacharya
sandip (at) puroga.com
Puroga Technologies Pvt. Ltd.
Work: http://www.puroga.com        Home: http://www.sandipb.net

GPG: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3


-- Sandip Bhattacharya sandip (at) puroga.com Puroga Technologies Pvt. Ltd. Work: http://www.puroga.com Home: http://www.sandipb.net

GPG: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3


_______________________________________________ ilugd mailinglist -- [EMAIL PROTECTED] http://frodo.hserus.net/mailman/listinfo/ilugd Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to