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