On Wed, 20 Dec 2000, Rajesh Fowkar wrote:

> Thanks sojan for making the difference clear.
> Where can you find the major and minor numbers for kernel modules.
> 

Should this thread be moved to programming?

In the kernel modules, the major number is indicated while registering the
device

for ex: register_chrdev(major_number,"my_device",&fops);

The kernel does not differentiate between minor numbers. When any process,
access a device with the major number my driver registered, the
corresponding entry point in my driver will be called. It is the driver's
responsibility to take care of differences in minor number.

device file entries are special files, which specify a major and minor
number..

ls -l /dev/hda*
brw-rw-rw-    1 root     disk       3,   0 May  6  1998 /dev/hda
brw-rw-rw-    1 root     disk       3,   1 May  6  1998 /dev/hda1
brw-rw----    1 root     disk       3,  10 May  6  1998 /dev/hda10
brw-rw----    1 root     disk       3,  11 May  6  1998 /dev/hda11
brw-rw----    1 root     disk       3,  12 May  6  1998 /dev/hda12

The major number of the hd driver is 3. The minor numbers are 0,1.... etc
etc. Note that the device entry can have any name, as long as the major
and minor numbers match.

Regards
Soj.



----------------------------------------------
LIH is all for free speech.  But it was created
for a purpose.  Violations of the rules of
this list will result in stern action.

Reply via email to