]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/sa.4
This commit was generated by cvs2svn to compensate for changes in r52746,
[FreeBSD/FreeBSD.git] / share / man / man4 / sa.4
1 .\" Copyright (c) 1996
2 .\"     Julian Elischer <julian@freebsd.org>.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\"
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .Dd June 6, 1999
29 .Dt SA 4
30 .Os FreeBSD
31 .Sh NAME
32 .Nm sa
33 .Nd SCSI Sequential Access Device Driver
34 .Sh SYNOPSIS
35 .Cd device sa0
36 .Cd device sa1 at scbus0 target 4 unit 0
37 .Sh DESCRIPTION
38 The
39 .Nm sa
40 driver provides support for all
41 .Tn SCSI
42 devices of the sequential access class that are attached to the system
43 through a supported
44 .Tn SCSI
45 Host Adapter.
46 The sequential access class includes tape and other linear access devices.
47 .Pp
48 A
49 .Tn SCSI
50 Host
51 adapter must also be separately configured into the system
52 before a
53 .Tn SCSI
54 sequential access device can be configured.
55 .Sh MOUNT SESSIONS
56 The 
57 .Nm
58 driver is based around the concept of a 
59 .Dq Em mount session ,
60 which is defined as the period between the time that a tape is
61 mounted, and the time when it is unmounted.  Any parameters set during
62 a mount session remain in effect for the remainder of the session or
63 until replaced. The tape can be unmounted, bringing the session to a
64 close in several ways.  These include:
65 .Bl -enum
66 .It
67 Closing a `rewind device',
68 referred to as sub-mode 00 below. An example is 
69 .Pa /dev/rsa0 .
70 .It
71 Using the MTOFFL
72 .Xr ioctl 2
73 command, reachable through the
74 .Sq Cm offline
75 command of
76 .Xr mt 1 .
77 .El
78 .Pp
79 It should be noted that tape devices are exclusive open devices, except in
80 the case where a control mode device is opened. In the latter case, exclusive
81 access is only sought when needed (e.g., to set parameters).
82 .Sh SUB-MODES
83 Bits 0 and 1 of the minor number are interpreted as
84 .Sq sub-modes .
85 The sub-modes differ in the action taken when the device is closed:
86 .Bl -tag -width XXXX
87 .It 00
88 A close will rewind the device; if the tape has been 
89 written, then a file mark will be written before the rewind is requested.
90 The device is unmounted.
91 .It 01
92 A close will leave the tape mounted.
93 If the tape was written to, a file mark will be written.
94 No other head positioning takes place.
95 Any further reads or writes will occur directly after the
96 last read, or the written file mark.
97 .It 10
98 A close will rewind the device. If the tape has been 
99 written, then a file mark will be written before the rewind is requested.
100 On completion of the rewind an unload command will be issued.
101 The device is unmounted.
102 .Sh BLOCKING MODES
103 .Tn SCSI
104 tapes may run in either 
105 .Sq Em variable
106 or
107 .Sq Em fixed
108 block-size modes.  Most 
109 .Tn QIC Ns -type
110 devices run in fixed block-size mode, where most nine-track tapes and
111 many new cartridge formats allow variable block-size.  The difference
112 between the two is as follows:
113 .Bl -inset
114 .It Variable block-size:
115 Each write made to the device results in a single logical record
116 written to the tape.  One can never read or write 
117 .Em part
118 of a record from tape (though you may request a larger block and read
119 a smaller record); nor can one read multiple blocks.  Data from a
120 single write is therefore read by a single read. The block size used
121 may be any value supported by the device, the
122 .Tn SCSI
123 adapter and the system (usually between 1 byte and 64 Kbytes,
124 sometimes more).
125 .Pp
126 When reading a variable record/block from the tape, the head is
127 logically considered to be immediately after the last item read,
128 and before the next item after that. If the next item is a file mark,
129 but it was never read, then the next
130 process to read will immediately hit the file mark and receive an end-of-file notification.
131 .It Fixed block-size:
132 Data written by the user is passed to the tape as a succession of
133 fixed size blocks.  It may be contiguous in memory, but it is
134 considered to be a series of independent blocks. One may never write
135 an amount of data that is not an exact multiple of the blocksize.  One
136 may read and write the same data as a different set of records, In
137 other words, blocks that were written together may be read separately,
138 and vice-versa.
139 .Pp
140 If one requests more blocks than remain in the file, the drive will
141 encounter the file mark.  Because there is some data to return (unless
142 there were no records before the file mark), the read will succeed,
143 returning that data, The next read will return immediately with a value
144 of 0.  (As above, if the file mark is never read, it remains for the next
145 process to read if in no-rewind mode.)
146 .El
147 .Sh FILE MARK HANDLING
148 The handling of file marks on write is automatic. If the user has
149 written to the tape, and has not done a read since the last write,
150 then a file mark will be written to the tape when the device is
151 closed.  If a rewind is requested after a write, then the driver
152 assumes that the last file on the tape has been written, and ensures
153 that there are two file marks written to the tape.  The exception to
154 this is that there seems to be a standard (which we follow, but don't
155 understand why) that certain types of tape do not actually write two
156 file marks to tape, but when read, report a `phantom' file mark when the
157 last file is read.  These devices include the QIC family of devices.
158 (It might be that this set of devices is the same set as that of fixed
159 block devices.  This has not been determined yet, and they are treated
160 as separate behaviors by the driver at this time.)
161 .Sh IOCTLS
162 The
163 .Nm sa
164 driver supports all of the ioctls of
165 .Xr mtio 4 .
166 .Sh FILES
167 .Bl -tag -width /dev/[n][e]rsa[0-9] -compact
168 .It Pa /dev/[n][e]rsa[0-9]
169 general form:
170 .It Pa /dev/rsa0
171 Rewind on close
172 .It Pa /dev/nrsa0
173 No rewind on close
174 .It Pa /dev/ersa0
175 Eject on close (if capable)
176 .It Pa /dev/rsa0.ctl
177 Control mode device (to examine state while another program is
178 accessing the device, e.g.).
179 .Sh BUGS
180 This driver lacks many of the hacks required to deal with older devices.
181 Many older
182 .Tn SCSI-1
183 devices may not work properly with this driver yet.
184 .Pp
185 Additionally, certain 
186 tapes (QIC tapes mostly) that were written under FreeBSD 2.X
187 aren't automatically read correctly with this driver: you may need to
188 explicitly set variable block mode or set to the blocksize that works best
189 for your device in order to read tapes written under FreeBSD 2.X.
190 .Pp
191 Fine grained density and compression mode support that is bound to specific
192 device names needs to be added.
193 .Pp
194 Support for fast indexing by use of partitions is missing.
195 .Sh DIAGNOSTICS
196 None.
197 .Sh SEE ALSO
198 .Xr mt 1 ,
199 .Xr scsi 4
200 .Sh HISTORY
201 The
202 .Nm sa
203 driver was written for the
204 .Tn CAM
205 .Tn SCSI
206 subsystem by Justin T. Gibbs and Kenneth Merry.
207 Many ideas were gleaned from the
208 .Nm st
209 device driver written and ported from
210 .Tn Mach
211 2.5
212 by Julian Elischer.
213 .sp
214 The current owner of record is Matthew Jacob who has suffered too many
215 years of breaking tape drivers.