Re: char-major
From: Tommy Reynolds (TommyReynolds_at_yahoo.com)
Date: 07/23/04
- Next message: Hans Huber: "Disk Druid"
- Previous message: Spamless: "Re: char-major"
- In reply to: Mauro G.: "char-major"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 23 Jul 2004 12:01:13 -0500
On Fri, 23 Jul 2004 16:30:09 +0200, Mauro G. wrote:
> I need to understand what is the mean of aliases "char-major-..." or
> "block-major-..."
Linux keeps a table of entry points (one for block devices such as
disks and another for character devices such as serial ports),
indexed by the device driver number: the _major_ device number.
When an application attempts to open a file, for example
"/dev/console", the kernel gets the major number from the
"/dev/console" inode and then accesses the driver, sort of like this:
results = cdevsw[ major ]->open( filename, mode )
If the table entry for "major" is NULL, there is no driver registered
for that major device number and the kernel asks /sbin/modprobe to
load the driver. Since the kernel does not know the actual name of
the module, the kernel asks /sbin/modprobe for "char-major-N" where
"N" is the table index we got from the inode.
There is never a module named "char-major-5" (or whatever), the
"/etc/modules.conf" or "/etc/modprobe.conf" file uses an "alias" line
to map the generic module name into a specific handler:
alias char-major-5 mycdriver
and the correct module gets automatically loaded and the original
open method call is tried again.
HTH.
- Next message: Hans Huber: "Disk Druid"
- Previous message: Spamless: "Re: char-major"
- In reply to: Mauro G.: "char-major"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|