Re: char-major

From: Tommy Reynolds (TommyReynolds_at_yahoo.com)
Date: 07/23/04


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.



Relevant Pages

  • Re: [PATCH] Reformat MAINTAINERS entry for Cirrus CS4280/CS461X sound driver
    ... Mailbox disabled for this username ... The entry looks outdated anyhow ("kernel 2.2 driver"). ...
    (Linux-Kernel)
  • Re: Make my own modules for kernel 2.4.32
    ... > kernel, the way is clear but the box need some modules to be loaded at ... > modifying the various Makefiles && config files, ... You have to add an 'obj-m' entry to the Makefile located in the same ... You should look at any driver provided as a patch for the kernel, ...
    (Linux-Kernel)
  • Re: 2.6.30-rc4 kernel
    ... I think there may be a problem with the 2.6.30 kernel that is ... # Generic Driver Options ... # PCI IDE chipsets support ... # Other IDE chipsets support ...
    (Linux-Kernel)
  • 2.6.30-rc4 kernel
    ... kernel panic - not syncing: ... # Generic Driver Options ... # PCI IDE chipsets support ... # Other IDE chipsets support ...
    (Linux-Kernel)
  • [PATCH 18-rc2] Fix typos in /Documentation : N-P
    ... Again, if you're not gonna do synchronization with disk drives (dang, ... -the kernel. ... There are two options specific to PSX driver portion. ... The driver uses the settings from the EEPROM set in the SCSI BIOS ...
    (Linux-Kernel)