Re: how does kernel know?

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

 



On Thu, 2004-09-30 at 07:56, Zeeshan Ali wrote:
> Hello,
>    Whenever i open the device /dev/lpN, the kernel automatically loads
> the appropriate driver for that device, as if it has a list of major
> number to module mapping. How/where does the kernel do it?

look in devices.c.. the open is done by chrdev_open(), which eventually
gets the drivers fops structure out of an array called chrdevs that is
simply indexed by the major number of the device being opened.. the
chrdevs array itself is populated through register_chrdev() which
drivers normally call during their initialization.

-Patrick






--
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