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

431 lines
9.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Devfs pseudo file system</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="Raw devices"
HREF="rawdev.html"><LINK
REL="NEXT"
TITLE="Common bus types (SCSI and other)"
HREF="scsibus.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="rawdev.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="scsibus.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="devfs"
></A
>Chapter 12. Devfs pseudo file system</H1
><P
>&#13;The main documentation for devfs can be found at: reference
<A
HREF="refs.html#W5"
>W5</A
>. The devfs name conventions for the
SCSI subsystem are outlined in <A
HREF="dnamesdevfs.html"
>Section 3.3</A
>.
Devfs is selected by the kernel build option CONFIG_DEVFS_FS and whether
it is mounted at boot time (as <TT
CLASS="filename"
>/dev</TT
>) or not is
controlled by the kernel build option CONFIG_DEVFS_MOUNT. The latter option
can be overridden by the kernel boot time options "devfs=mount" or
"devfs=nomount", whichever is appropriate.
</P
><P
>&#13;The devfs SCSI node names with their default permissions are:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;disc rw------- whole disk including mbr
part1 rw------- first partition {...p1}
...
part15 rw------- 15th partition {...p15}
cd rw-rw-rw- cd or dvd devices
mt rw-rw-rw- tape mode 0 with rewind {...m0}
mtl rw-rw-rw- tape mode 1 with rewind {...m1}
mtm rw-rw-rw- tape mode 2 with rewind {...m2}
mta rw-rw-rw- tape mode 3 with rewind {...m3}
mtn rw-rw-rw- tape mode 0 with no rewind {...m0n}
mtln rw-rw-rw- tape mode 1 with no rewind {...m1n}
mtmn rw-rw-rw- tape mode 2 with no rewind {...m2n}
mtan rw-rw-rw- tape mode 3 with no rewind {...m3n}
generic rw-r-----
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;These node names are only present if the corresponding device (or sub-entities
of the device (e.g. partitions)) and driver are present. For example if
there is no sg driver present then there is no "generic" device name. The
strings that appear above in braces are appended to the abridged "c0b0t0u0"
notations outlined below as appropriate.
</P
><P
>&#13;The devfs file names that are block or character special files will be
called the primary device names in this description. The devfs daemon, called
devfsd, introduces many symbolic links to those primary device names. This is
done both for backward compatibility and convenience. These symbolic links
will be called secondary device names.
</P
><P
>&#13;The secondary device names are controlled by the devfsd configuration file
usually found in <TT
CLASS="filename"
>/etc/devfsd.conf</TT
> . Following is a
list of secondary device names when the default devfsd.conf file is used:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;
Secondary name slink to this primary device name
--------------------------------------------------------------
/dev/sda /dev/scsi/host0/bus0/target2/lun0/disc
/dev/sda1 /dev/scsi/host0/bus0/target2/lun0/part1
/dev/sd/c0b0t2u0 /dev/scsi/host0/bus0/target2/lun0/disc
/dev/sd/c0b0t2u0p1 /dev/scsi/host0/bus0/target2/lun0/part1
/dev/sr0 /dev/scsi/host0/bus0/target4/lun0/cd
/dev/sr/c0b0t4u0 /dev/scsi/host0/bus0/target4/lun0/cd
/dev/st0 /dev/scsi/host1/bus0/target0/lun0/mt
/dev/nst0a /dev/scsi/host1/bus0/target0/lun0/mtan
/dev/st/c1b0t0u0m0 /dev/scsi/host1/bus0/target0/lun0/mt
/dev/st/c1b0t0u0m3n /dev/scsi/host1/bus0/target0/lun0/mtan
/dev/sg0 /dev/scsi/host0/bus0/target2/lun0/generic
/dev/sg1 /dev/scsi/host0/bus0/target4/lun0/generic
/dev/sg2 /dev/scsi/host1/bus0/target0/lun0/generic
/dev/sg/c0b0t2u0 /dev/scsi/host0/bus0/target2/lun0/generic
/dev/sg/c0b0t4u0 /dev/scsi/host0/bus0/target4/lun0/generic
/dev/sg/c1b0t0u0 /dev/scsi/host1/bus0/target0/lun0/generic
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;Note that the more common <TT
CLASS="filename"
>/dev/scd0</TT
> variant for SCSI
cdroms is not supported. There are also <TT
CLASS="filename"
>/dev/discs</TT
>,
<TT
CLASS="filename"
>/dev/cdroms</TT
> and <TT
CLASS="filename"
>/dev/tapes</TT
>
directories that contain symbolic links to all devices (i.e. not just
SCSI devices) that fall into that categorization:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;
Secondary name slink to this primary device
------------------------------------------------------------
/dev/discs/disc0 /dev/ide/host0/bus0/target0/lun0 *
/dev/discs/disc1 /dev/scsi/host0/bus0/target2/lun0 *
/dev/cdroms/cdrom0 /dev/ide/host0/bus1/target1/lun0/cd
/dev/cdroms/cdrom1 /dev/scsi/host0/bus0/target4/lun0/cd
/dev/tapes/tape0 /dev/scsi/host1/bus0/target0/lun0 *
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;Those entries marked with "*" are directories containing the primary devices.
Note that IDE/ATA devices are listed before SCSI devices. These secondary device
names mimic the same persistence rules as the primary device names. So when
a SCSI device (?), or its lower level driver or its upper level driver are
removed then so are the primary and secondary device names associated with it.
</P
><P
>&#13;When devfs is mounted as <TT
CLASS="filename"
>/dev</TT
>, the old
"<TT
CLASS="filename"
>/dev/sda6</TT
>" type can still be used
in some contexts. This may be convenient if typing is required at the
kernel boot time prompt. For example if a user wants to change the root
partition on a "devfs" machine then any of the following examples
may be used as a kernel boot time option:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13; root=/dev/sda6
root=/dev/scsi/host0/bus0/target0/lun0/part6
root=/dev/sd/c0b0t0u0p6
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;There are many device scanning programs that expect to see the pre-devfs
device names present and it will some time before they become devfs aware.
Also some programs rely on a open of <TT
CLASS="filename"
>/dev/sg0</TT
>
(for example) to load the
sg driver (assuming it is a module and not already loaded). This can
be arranged by an entry in <TT
CLASS="filename"
>/etc/devfsd.conf</TT
> file of:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13; LOOKUP sg.* MODLOAD
</PRE
></FONT
></TD
></TR
></TABLE
>
and the following in <TT
CLASS="filename"
>/etc/modules.devfs</TT
> :
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13; probeall /dev/sg scsi-hosts sg
alias /dev/sg* /dev/sg
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;The sg device permissions can be changed with this entry in the
<TT
CLASS="filename"
>/etc/devfsd.conf</TT
> file:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13; REGISTER scsi/host.*/bus.*/target.*/lun.*/generic
PERMISSIONS 0.0 rw-rw-rw-
</PRE
></FONT
></TD
></TR
></TABLE
>
See "man devfsd" for more information.
</P
><P
>&#13;An application can determine whether devfs is active by the presence or
otherwise of the file <TT
CLASS="filename"
>/dev/.devfsd</TT
>.
</P
><P
>&#13;A feature of a /dev directory based on a persistent file system (e.g.
ext2) is the ability to associate permissions with a device file name
and keep them from one boot to the next. As noted above the default
action of devfs is to assign device file name permissions anew each time
a machine is booted. The PERMISSIONS action in the <TT
CLASS="filename"
>&#13;/etc/devfsd.conf</TT
> can be used to assert permissions but
this may be considered a little awkward. The devfs document
(<A
HREF="refs.html#W5"
>W5</A
>) describes a method for getting the best
of both worlds. This technique relies on the recently added feature
in lk 2.4 to mount the same file system at multiple points.
</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="rawdev.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="scsibus.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Raw devices</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Common bus types (SCSI and other)</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>