Initial import from FreeBSD RELENG_4:
[games.git] / share / man / man4 / wst.4
1 .\" $FreeBSD: src/share/man/man4/wst.4,v 1.8.2.3 2001/12/21 10:07:09 ru Exp $
2 .\" Copyright (c) 1998
3 .\"     Warner Losh <imp@village.org>.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\"
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" SUCH DAMAGE.
26 .\"
27 .Dd August 27, 1998
28 .Dt WST 4
29 .Os
30 .Sh NAME
31 .Nm wst
32 .Nd ATAPI Tape drive
33 .Sh SYNOPSIS
34 .Cd options ATAPI
35 .Cd device wst
36 .Sh DESCRIPTION
37 The
38 .Nm
39 driver provides support for a
40 .Tn atapi
41 tape drive connected to an
42 .Tn IDE
43 bus.  It allows the tape to be run in up to four different modes
44 depending on minor numbers and supports several different `sub-modes'.
45 The device can have both a
46 .Em raw
47 interface and a
48 .Em block
49 interface; however, only the raw interface is usually used (or
50 recommended).  In general the interfaces are similar to those
51 described by
52 .Xr sa 4
53 or
54 .Xr st 4 .
55 .Pp
56 An IDE adapter must also be configured into the kernel before the tape
57 drive can be configured.  In addition, ATAPI must be enabled in the
58 kernel as well.
59 .Sh MOUNT SESSIONS
60 The
61 .Nm
62 driver is based around the concept of a
63 .Dq Em mount session ,
64 which is defined as the period between the time that a tape is
65 mounted, and the time when it is unmounted.  Any parameters set during
66 a mount session remain in effect for the remainder of the session or
67 until replaced.
68 The tape can be unmounted, bringing the session to a
69 close in several ways.  These include:
70 .Bl -enum
71 .It
72 Closing an `unmount device',
73 referred to as sub-mode 00 below.
74 An example is
75 .Pa /dev/rwst0 .
76 .It
77 Using the MTOFFL
78 .Xr ioctl 2
79 command, reachable through the
80 .Sq Cm offline
81 command of
82 .Xr wst 1 .
83 .It
84 Opening a different mode will implicitly unmount the tape, thereby closing
85 off the mode that was previously mounted.  All parameters will be loaded
86 freshly from the new mode.  (See below for more on modes.)
87 .El
88 .Pp
89 Parameters that are required to last across the unmounting of a tape
90 should be set on the control device.  This is sub-mode 3 (see below) and is
91 reached through a file with a name of the form
92 .Sm off
93 .Pa /dev/wst Ar Y Pa ctl. Ar X ,
94 .Sm on
95 where
96 .Ar Y
97 is the drive number and
98 .Ar X
99 is the mode number.
100 .Sh MODES AND SUB-MODES
101 There are four
102 .Sq operation
103 modes.
104 These are controlled by bits 2 and 3 of the minor number and
105 are designed to allow users to easily read and write different formats
106 of tape on devices that allow multiple formats.  The parameters for
107 each mode can be set individually by hand with the
108 .Xr mt 1
109 command.  When a device corresponding to a particular mode is first
110 mounted, the operating parameters for that
111 mount session
112 are copied from that mode.  Further changes to the parameters during the
113 session will change those in effect for the session but not those set
114 in the operation mode.  To change the parameters for an operation mode,
115 one must either assign the parameters to the control device.
116 .Pp
117 In addition to the four operating modes mentioned above,
118 bits 0 and 1 of the minor number are interpreted as
119 .Sq sub-modes .
120 The sub-modes differ in the action taken when the device is closed:
121 .Bl -tag -width XXXX
122 .It 00
123 A close will rewind the device; if the tape has been
124 written, then a file mark will be written before the rewind is requested.
125 The device is unmounted.
126 .It 01
127 A close will leave the tape mounted.
128 If the tape was written to, a file mark will be written.
129 No other head positioning takes place.
130 Any further reads or writes will occur directly after the
131 last read, or the written file mark.
132 .It 10
133 A close will rewind the device.
134 If the tape has been
135 written, then a file mark will be written before the rewind is requested.
136 On completion of the rewind an unload command will be issued.
137 The device is unmounted.
138 .It 11
139 This is a special mode, known as the
140 .Dq control device
141 for the mode.  Parameters set for the mode while in this sub-mode will
142 be remembered from one mount to the next.  This allows the system
143 administrator to set different characteristics (e.g., density,
144 blocksize and eventually compression)
145 on each mode, and have the different modes keep those parameters
146 independent of any parameter changes a user may invoke during a single
147 mount session.  At the completion of the user's mount session, drive
148 parameters will revert to those set by the administrator.  I/O
149 operations cannot be performed on this device/sub-mode.
150 .El
151 .Sh BLOCKING MODES
152 .Tn ATAPI
153 tapes may run in either
154 .Sq Em variable
155 or
156 .Sq Em fixed
157 block-size modes.  Most
158 .Tn QIC Ns -type
159 devices run in fixed block-size mode, where most nine-track tapes and
160 many new cartridge formats allow variable block-size.  The difference
161 between the two is as follows:
162 .Bl -inset
163 .It Variable block-size:
164 Each write made to the device results in a single logical record
165 written to the tape.  One can never read or write
166 .Em part
167 of a record from tape (though you may request a larger block and read
168 a smaller record); nor can one read multiple blocks.  Data from a
169 single write is therefore read by a single read.
170 The block size used
171 may be any value supported by the device, the
172 .Tn IDE
173 controller and the system (usually between 1 byte and 64 Kbytes,
174 sometimes more).
175 .Pp
176 When reading a variable record/block from the tape, the head is
177 logically considered to be immediately after the last item read,
178 and before the next item after that.
179 If the next item is a file mark,
180 but it was never read, then the next
181 process to read will immediately hit the file mark and receive an end-of-file notification.
182 .It Fixed block-size
183 Data written by the user is passed to the tape as a succession of
184 fixed size blocks.  It may be contiguous in memory, but it is
185 considered to be a series of independent blocks.
186 One may never write
187 an amount of data that is not an exact multiple of the blocksize.  One
188 may read and write the same data as a different set of records, In
189 other words, blocks that were written together may be read separately,
190 and vice-versa.
191 .Pp
192 If one requests more blocks than remain in the file, the drive will
193 encounter the file mark.  Because there is some data to return (unless
194 there were no records before the file mark), the read will succeed,
195 returning that data.  The next read will return immediately with an
196 EOF.  (As above, if the file mark is never read, it remains for the next process to read if in no-rewind mode.)
197 .El
198 .Sh FILE MARK HANDLING
199 The handling of file marks on write is automatic.
200 If the user has
201 written to the tape, and has not done a read since the last write,
202 then a file mark will be written to the tape when the device is
203 closed.  If a rewind is requested after a write, then the driver
204 assumes that the last file on the tape has been written, and ensures
205 that there are two file marks written to the tape.  The exception to
206 this is that there seems to be a standard (which we follow, but don't
207 understand why) that certain types of tape do not actually write two
208 file marks to tape, but when read, report a `phantom' file mark when the
209 last file is read.  These devices include the QIC family of devices.
210 (It might be that this set of devices is the same set as that of fixed
211 block devices.  This has not been determined yet, and they are treated
212 as separate behaviors by the driver at this time.)
213 .Sh KERNEL CONFIGURATION
214 In configuring, if an optional
215 .Ar count
216 is given in the specification, that number of tape devices are configured.
217 .Pp
218 .Sh NOTES
219 Some motherboards and IDE controllers are out of spec when it comes to
220 certain minor, but critical to tape, sections of ATAPI spec.  These
221 motherboards are mostly rare, with the exception of the Natoma 440FX
222 chipset found on Pentium Pro motherboards.
223 .Sh FILES
224 .Bl -tag -width /dev/wst[0-9] -compact
225 .It Pa /dev/wst[0-9]
226 device entries
227 .El
228 .Sh DIAGNOSTICS
229 None.
230 .Sh HISTORY
231 .An "S\(/oren Schmidt" Aq sos@sos.freebsd.dk
232 wrote this driver which first
233 appeared in
234 .Fx 3.0 .