246 lines
5.0 KiB
HTML
246 lines
5.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Architectural Overview</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="The Linux 2.4 SCSI subsystem HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Introduction"
|
|
HREF="intro.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Names and Addresses"
|
|
HREF="names.html"></HEAD
|
|
><BODY
|
|
CLASS="chapter"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>The Linux 2.4 SCSI subsystem HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="intro.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="names.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="chapter"
|
|
><H1
|
|
><A
|
|
NAME="arch"
|
|
></A
|
|
>Chapter 2. Architectural Overview</H1
|
|
><P
|
|
> The SCSI subsystem has a 3 level architecture with the "upper" level
|
|
being closest to the user/kernel interface while the "lower" level
|
|
is closest to the hardware. The upper level drivers are commonly known
|
|
by a terse two letter abbreviation (e.g. "sd" for SCSI disk driver).
|
|
The names of the corresponding module drivers which, for historical
|
|
reasons, sometimes differ from the built in driver names are shown in
|
|
braces in the following diagram.
|
|
</P
|
|
><DIV
|
|
CLASS="mediaobject"
|
|
><P
|
|
><IMG
|
|
SRC="scsi-arch.jpg"><DIV
|
|
CLASS="caption"
|
|
><P
|
|
> The 3 level driver architecture of the SCSI subsystem.
|
|
</P
|
|
></DIV
|
|
></P
|
|
></DIV
|
|
><P
|
|
> The upper level supports the user-kernel interface. In the case of sd and sr
|
|
this is a block device interface while for st and sg this is a character
|
|
device interface. Any operation using the SCSI subsystem (e.g. reading a
|
|
sector from a disk) involves one driver at each of the 3 levels (e.g. sd,
|
|
SCSI mid level and aic7xxx drivers).
|
|
</P
|
|
><P
|
|
> As can be seen from the diagram, the SCSI mid level is common to all
|
|
operations. The SCSI mid level defines internal interfaces and provides
|
|
common services to the upper and lower level drivers. Ioctls provided by
|
|
the mid level are available to the file descriptors belonging to any of
|
|
the 4 upper level drivers.
|
|
</P
|
|
><P
|
|
> The most common operation on a block device is to "mount" a
|
|
file system. For a sd device typically a partition is mounted
|
|
(e.g. <B
|
|
CLASS="command"
|
|
>mount -t ext2 /dev/sda6 /home</B
|
|
>). For a
|
|
sr device usually the whole device is mounted (e.g. <B
|
|
CLASS="command"
|
|
> mount -t iso9660 /dev/sr0 /mnt/cdrom</B
|
|
>). The <B
|
|
CLASS="command"
|
|
>dd
|
|
</B
|
|
> command can be used to read or write from block devices.
|
|
In this case the block size argument ("bs") needs to be set to
|
|
the block size of the device (e.g. 512 bytes for most disks)
|
|
or an integral multiple of that device block size (e.g. 8192 bytes).
|
|
A recent addition to the block subsystem allows a device (or partition)
|
|
to be mounted more than once, at different mount points.
|
|
</P
|
|
><P
|
|
> Sd is a member of the generic disk family, as is the hd device from the
|
|
IDE subsystem. Apart from mounting sd devices, the <B
|
|
CLASS="command"
|
|
>fdisk
|
|
</B
|
|
> command is available to view or modify a disk's
|
|
partition table. Although the <B
|
|
CLASS="command"
|
|
>hdparm</B
|
|
> command is
|
|
primarily intended for ATA disks (also known as IDE or EIDE disks), some
|
|
options work on SCSI disks.
|
|
</P
|
|
><P
|
|
> Sr is a member of the CD-ROM subsystem. Apart from mounting file
|
|
systems (e.g. iso9660), audio CDs can also be read. The latter
|
|
action does <EM
|
|
>not</EM
|
|
> involve mounting a file
|
|
system but typically by invoking some ioctls. General
|
|
purpose Linux commands such as <B
|
|
CLASS="command"
|
|
>dd</B
|
|
> cannot be
|
|
used on audio CDs.
|
|
</P
|
|
><P
|
|
> St is a char device for reading and writing tapes. Typically the
|
|
<B
|
|
CLASS="command"
|
|
>mt</B
|
|
> command is used to perform data transfers and
|
|
other control functions.
|
|
</P
|
|
><P
|
|
> Sg is a SCSI command pass through device that uses a char device
|
|
interface. General purpose Linux commands should <EM
|
|
>not
|
|
</EM
|
|
> be used on sg devices. Applications such
|
|
as SANE (for scanners), <B
|
|
CLASS="command"
|
|
>cdrecord</B
|
|
> and
|
|
<B
|
|
CLASS="command"
|
|
>cdrdao</B
|
|
> (for cd writers) and
|
|
<B
|
|
CLASS="command"
|
|
>cdparanoia</B
|
|
> (for reading audio CDs digitally) use sg.
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="intro.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="names.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Introduction</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Names and Addresses</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |