Disk Drivers


Table of Contents

Disk Drivers 
WHERE IT CONNECTS TOGETHER 

Disk Drivers 

http://www.linux-sxs.org/hardware/scsidrv.html

When you make a reference to /dev/anything, the kernel translates this to a MAJOR device number. Every major device in a linux OS has a corresponding, unique, 'driver'. Serial drivers, console drivers, ide drivers, scsi hd drivers. Think of some overall generic device, a scanner for instance, it requires a major device number to handle the unique characteristics of scanners in general. Not specific scanners, scanners in general with their unique (but generic) command set.

The major device number for scsi hard drives (/dev/sda to infinity) is 64. The corresponding driver for '64' is sd_mod.o Short for sCSIdISK_modULE.o

The major device number for scsi cd's (/dev/scd0 to infinity) is 32. The corresponding driver for '32' is sr_mod.o Short for sCSICDrOM_modULE.o

The major device number 99 could be registered as spaghetti. Whatever spaggetti does, the kernel loads it. The point being the kernel has no interest in scsi, cd roms, hard drives or spaghetti. That functionality is entirely up to the module concerned.

sd_mod.o is a generic SCSI disk handler. sr_mod is a generic SCSI cd handler. They respectively handle an abstract command set of their own. "move head", "read track" etc. They massage these abstact commands into the scsi interface via another module scsi_mod.o

scsi_mod.o is generic. It provides another layer of abstraction between the different device type handlers (cd, hd, tape), and the actual card that does the work. In the steps provided, scsi_mod.o relies on the aha152x or the ncr53c810 driver to do the dirty work.

device_driver (sd_mod.o) -> scsi driver (scsi_mod.o) -> card driver (aha152x.o) -> physical device

WHERE IT CONNECTS TOGETHER 

modprobe aha152x <parms> loads the card driver (ie a driver capable of handling an AHA1510 cheap scsi). It discovers that this card driver relies on scsi_mod.o, and loads it too. scsi_mod.o relies on nothing. It doesn't care what talks to it.

Immediately after a modprobe, if you "lsmod", you will discover only two modules present, the aha, and the scsi.

It is only at the time of "mount"ing a device that the final piece to the puzzle fits in place. The major device number causes it's respective module to be loaded. Typing "lsmod" again, will reveal sr_mod (or sd_mod) are now loaded and information is also displayed where these modules are attached to each other.

It is well worth your time removing modules and attempting to "mount" devices and discovering the various error messages that occur. The mail groups are full of such messages due to these problems.