Re: Sharing of major number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 29 Sep 2004 14:27:13 -0700 (PDT), "Usman S. Ansari"
<uansari@xxxxxxxxx> said:
> Zeeshan, sometime various distribution set up links to actual device
> file. e.g. You can access cdrom by openning /dev/cdrom and this could
> be a link to /dev/hdd or /dev/sdb (first case ide cdrom and second
> case SCSI).
> 
> Usman
> --- Zeeshan Ali <zeenix@xxxxxxxxx> wrote:
> > Hello,
> > 
> > I dont know how to communicate my concern. I can't digest how come
> > MAJOR NUMBER identifies the driver rather than the device type as I
> > see different drivers for different devices of the same type but the
> > device file is ALWAYS the same. E.g (i dont know if this is a good
> > example or not) when i say /dev/video0 the kernel knows i am talking
> > about the tv capture card and when i say /dev/video1 the kernel
> > knows that i am talking of my webcam. Now the major number of both 
> > are the same but the device driver is definatelly not the same. How 
hmm.... it may be more complicated than that.
Usually when drivers are written, minor numbers are also taken into
account.
during implementation of open, usually the fie pointer passed is
examined for the contents of 
 minor numbers. Depending on the minor number, corresponding action is
 taken. Major numbers need not be examined because the kernel will call
 the open() implementation based only on the major numbers.

HTH,
om.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux