Doubt in major and minor numbers
Robert P. J. Day
rpjday at crashcourse.ca
Sun Nov 16 06:20:21 EST 2014
On Sun, 16 Nov 2014, me storage wrote:
> Hi All,
>
> I am reading chapter 3 in LDD3 i checked same topics in LDD2 so i
> got some confusions.According to my understanding Major number is
> used by kernel to identify the driver i.e major number tells about
> driver . Minor number is used by the driver module to know about the
> device which is using this module i.e minor number related to device
> number can i any one please tell am i correct? if wrong please
> explain me a bit more
for the most part, that is entirely correct -- the major number
identifies the driver (either block or char), and you can see the
current list of registered drivers with:
$ cat /proc/devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
...
Character devices:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
...
and while the minor number *usually* then identifies a particular
instance of a device being controlled by that driver, it doesn't
*have* to. in fact, the driver is free to interpret the minor number
any way it wants but, as you suggest, it typically just refers to a
specific instance of a device.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
More information about the Kernelnewbies
mailing list