Re: how does kernel know?

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

 



That is done by the filesystem in which your device file is. 

Say for example you have /dev/lp1 in root filesystem which is ext3.
When this file is created in the filesystem, major and minor number
are put in the disk inode. When you open this file using open system
call, ext3 filesystem reads this info from disk inode and calls some 
routines to intialize file_operations struct for the incore inode to
some general device file operations. These general device file
operations eventually find the device corresponding to major number
and call the device specific open routines.

I hope that clears your doubt.

cheers,
Manu

On Thu, 30 Sep 2004 16:56:26 +0500, Zeeshan Ali <zeenix@xxxxxxxxx> 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?
> 

----------------
Manu Garg
http://manugarg.freezope.org

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