Thread (5 messages) 5 messages, 3 authors, 2012-02-12

function of major/minor device number

From: hz hanks <hidden>
Date: 2012-02-12 21:40:05

Hi,  rday

Thank you for your help. Yes! You did point out my question. I will do
read drivers/char/misc.c for a better understanding.

Best,

2012/2/12 Robert P. J. Day [off-list ref]:
On Sun, 12 Feb 2012, Alexandru Juncu wrote:
quoted
2012/2/12 hz hanks [off-list ref]:
quoted
Hi, all

I have a question about major/minor device number. I know that one can
use int register_chrdev_region(dev_t from, unsigned count, const char
*name); to register a driver with a unique pair of major/minor device
number. But what's the difference between two drivers: in one case
they have same major device number but different minor device number;
on another case they have different major device number but same minor
device number. When I searched the Internet, it said that major device
number is to identify the driver while the minor device number is to
identify specific hardware. But I'm still confused because it seems
legal to share the major device number with different drivers.
?you're talking about the "misc" character device driver here, which
allows you to register very simple and independent character drivers
that need only a single minor number all at major number 10.

?look in /dev for how many char device files have major number 10.
that's the perfect example of what you're talking about. ?see the
source in drivers/char/misc.c.

rday

--

========================================================================
Robert P. J. Day ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Ottawa, Ontario, CANADA
? ? ? ? ? ? ? ? ? ? ? ?http://crashcourse.ca

Twitter: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://twitter.com/rpjday
LinkedIn: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://ca.linkedin.com/in/rpjday
========================================================================
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help