old-www/HOWTO/SCSI-2.4-HOWTO/dnamesdevfs.html

237 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Device Names in devfs</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="UP"
TITLE="Names and Addresses"
HREF="names.html"><LINK
REL="PREVIOUS"
TITLE="Device Names"
HREF="dnames.html"><LINK
REL="NEXT"
TITLE="Device Names in scsidev"
HREF="dnamesscsidev.html"></HEAD
><BODY
CLASS="sect1"
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="dnames.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. Names and Addresses</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="dnamesscsidev.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="dnamesdevfs"
></A
>3.3. Device Names in devfs</H1
><P
>&#13;The device pseudo file system can be mounted as <TT
CLASS="filename"
>/dev</TT
> in
which case it replaces the traditional Linux device subdirectory.
Alternatively it can be mounted elsewhere (e.g. <TT
CLASS="filename"
>/devfs</TT
>)
and supplement the existing device structure.
</P
><P
>&#13;Without devfs, devices names are typically maintained in the
<TT
CLASS="filename"
>dev</TT
> directory
of the root partition. Hence the device names (and their associated
permissions) have file system persistence. The existence of a device name
does not necessarily imply such a device (or even its driver) is present. To
save users having to create device name entries (with the <B
CLASS="command"
>mknod
</B
> command) most Linux distributions come with thousands of device
names defined in the <TT
CLASS="filename"
>/dev</TT
> directory. When applications
try to open() the device name then an errno value of ENODEV indicates there
is no corresponding device (or driver) currently available.
</P
><P
>&#13;Devfs takes a different approach in which the existence of the device name
is directly related to the presence of the corresponding device (and its
driver).
</P
><P
>&#13;Assuming devfs is mounted on <TT
CLASS="filename"
>/dev</TT
> then SCSI devices
have primary device names that might look like this:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;/dev/scsi/host0/bus0/target1/lun0/disc [whole disk]
/dev/scsi/host0/bus0/target1/lun0/part6 [partition 6]
/dev/scsi/host0/bus0/target1/lun0/generic [sg device for disk]
/dev/scsi/host1/bus0/target2/lun0/cd [CD reader or writer]
/dev/scsi/host1/bus0/target2/lun0/generic [sg device for cd]
/dev/scsi/host2/bus0/target0/lun0/mt [tape mode 0 rewind]
/dev/scsi/host2/bus0/target0/lun0/mtan [tape mode 3 no rewind]
/dev/scsi/host2/bus0/target0/lun0/generic [sg device for tape]
</PRE
></FONT
></TD
></TR
></TABLE
>
The sg device on the third line corresponds to the "whole disk" on the
first line since they have the same SCSI address (i.e.
<TT
CLASS="filename"
>host0/bus0/target1/lun0</TT
>). If the sg driver is a module
and it has not yet been loaded (or it has been unloaded) then the
"generic" device names in the above list will not be present.
</P
><P
>&#13;[Notice the spelling of "disc" as the devfs author favours English spelling
over the American variant.] It can be seen that devfs's naming scheme
closely matches the SCSI addressing discussed in
<A
HREF="scsiaddr.html"
>Section 3.1</A
>. It is worth noting that the IDE subsystem uses
a similar devfs device naming scheme with the word "scsi" replaced with
"ide". Devfs is discussed further in <A
HREF="devfs.html"
>Chapter 12</A
>.
</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="dnames.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="dnamesscsidev.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Device Names</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="names.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Device Names in scsidev</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>