1 .\" $FreeBSD: src/share/man/man4/wst.4,v 1.8.2.3 2001/12/21 10:07:09 ru Exp $
3 .\" Warner Losh <imp@village.org>. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
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.
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
39 driver provides support for a
41 tape drive connected to an
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
49 interface; however, only the raw interface is usually used (or
50 recommended). In general the interfaces are similar to those
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
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
68 The tape can be unmounted, bringing the session to a
69 close in several ways. These include:
72 Closing an `unmount device',
73 referred to as sub-mode 00 below.
79 command, reachable through the
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.)
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
93 .Pa /dev/wst Ar Y Pa ctl. Ar X ,
97 is the drive number and
100 .Sh MODES AND SUB-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
109 command. When a device corresponding to a particular mode is first
110 mounted, the operating parameters for that
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.
117 In addition to the four operating modes mentioned above,
118 bits 0 and 1 of the minor number are interpreted as
120 The sub-modes differ in the action taken when the device is closed:
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.
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.
133 A close will rewind the device.
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.
139 This is a special mode, known as the
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.
153 tapes may run in either
157 block-size modes. Most
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:
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
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.
171 may be any value supported by the device, the
173 controller and the system (usually between 1 byte and 64 Kbytes,
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.
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.
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,
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.)
198 .Sh FILE MARK HANDLING
199 The handling of file marks on write is automatic.
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
216 is given in the specification, that number of tape devices are configured.
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.
224 .Bl -tag -width /dev/wst[0-9] -compact
231 .An "S\(/oren Schmidt" Aq sos@sos.freebsd.dk
232 wrote this driver which first