Add better description.
[dragonfly.git] / share / man / man4 / wst.4
CommitLineData
984263bc 1.\" $FreeBSD: src/share/man/man4/wst.4,v 1.8.2.3 2001/12/21 10:07:09 ru Exp $
6e285212 2.\" $DragonFly: src/share/man/man4/Attic/wst.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
984263bc
MD
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
38The
39.Nm
40driver provides support for a
41.Tn atapi
42tape drive connected to an
43.Tn IDE
44bus. It allows the tape to be run in up to four different modes
45depending on minor numbers and supports several different `sub-modes'.
46The device can have both a
47.Em raw
48interface and a
49.Em block
50interface; however, only the raw interface is usually used (or
51recommended). In general the interfaces are similar to those
52described by
53.Xr sa 4
54or
55.Xr st 4 .
56.Pp
57An IDE adapter must also be configured into the kernel before the tape
58drive can be configured. In addition, ATAPI must be enabled in the
59kernel as well.
60.Sh MOUNT SESSIONS
61The
62.Nm
63driver is based around the concept of a
64.Dq Em mount session ,
65which is defined as the period between the time that a tape is
66mounted, and the time when it is unmounted. Any parameters set during
67a mount session remain in effect for the remainder of the session or
68until replaced.
69The tape can be unmounted, bringing the session to a
70close in several ways. These include:
71.Bl -enum
72.It
73Closing an `unmount device',
74referred to as sub-mode 00 below.
75An example is
76.Pa /dev/rwst0 .
77.It
78Using the MTOFFL
79.Xr ioctl 2
80command, reachable through the
81.Sq Cm offline
82command of
83.Xr wst 1 .
84.It
85Opening a different mode will implicitly unmount the tape, thereby closing
86off the mode that was previously mounted. All parameters will be loaded
87freshly from the new mode. (See below for more on modes.)
88.El
89.Pp
90Parameters that are required to last across the unmounting of a tape
91should be set on the control device. This is sub-mode 3 (see below) and is
92reached 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
96where
97.Ar Y
98is the drive number and
99.Ar X
100is the mode number.
101.Sh MODES AND SUB-MODES
102There are four
103.Sq operation
104modes.
105These are controlled by bits 2 and 3 of the minor number and
106are designed to allow users to easily read and write different formats
107of tape on devices that allow multiple formats. The parameters for
108each mode can be set individually by hand with the
109.Xr mt 1
110command. When a device corresponding to a particular mode is first
111mounted, the operating parameters for that
112mount session
113are copied from that mode. Further changes to the parameters during the
114session will change those in effect for the session but not those set
115in the operation mode. To change the parameters for an operation mode,
116one must either assign the parameters to the control device.
117.Pp
118In addition to the four operating modes mentioned above,
119bits 0 and 1 of the minor number are interpreted as
120.Sq sub-modes .
121The sub-modes differ in the action taken when the device is closed:
122.Bl -tag -width XXXX
123.It 00
124A close will rewind the device; if the tape has been
125written, then a file mark will be written before the rewind is requested.
126The device is unmounted.
127.It 01
128A close will leave the tape mounted.
129If the tape was written to, a file mark will be written.
130No other head positioning takes place.
131Any further reads or writes will occur directly after the
132last read, or the written file mark.
133.It 10
134A close will rewind the device.
135If the tape has been
136written, then a file mark will be written before the rewind is requested.
137On completion of the rewind an unload command will be issued.
138The device is unmounted.
139.It 11
140This is a special mode, known as the
141.Dq control device
142for the mode. Parameters set for the mode while in this sub-mode will
143be remembered from one mount to the next. This allows the system
144administrator to set different characteristics (e.g., density,
145blocksize and eventually compression)
146on each mode, and have the different modes keep those parameters
147independent of any parameter changes a user may invoke during a single
148mount session. At the completion of the user's mount session, drive
149parameters will revert to those set by the administrator. I/O
150operations cannot be performed on this device/sub-mode.
151.El
152.Sh BLOCKING MODES
153.Tn ATAPI
154tapes may run in either
155.Sq Em variable
156or
157.Sq Em fixed
158block-size modes. Most
159.Tn QIC Ns -type
160devices run in fixed block-size mode, where most nine-track tapes and
161many new cartridge formats allow variable block-size. The difference
162between the two is as follows:
163.Bl -inset
164.It Variable block-size:
165Each write made to the device results in a single logical record
166written to the tape. One can never read or write
167.Em part
168of a record from tape (though you may request a larger block and read
169a smaller record); nor can one read multiple blocks. Data from a
170single write is therefore read by a single read.
171The block size used
172may be any value supported by the device, the
173.Tn IDE
174controller and the system (usually between 1 byte and 64 Kbytes,
175sometimes more).
176.Pp
177When reading a variable record/block from the tape, the head is
178logically considered to be immediately after the last item read,
179and before the next item after that.
180If the next item is a file mark,
181but it was never read, then the next
182process to read will immediately hit the file mark and receive an end-of-file notification.
183.It Fixed block-size
184Data written by the user is passed to the tape as a succession of
185fixed size blocks. It may be contiguous in memory, but it is
186considered to be a series of independent blocks.
187One may never write
188an amount of data that is not an exact multiple of the blocksize. One
189may read and write the same data as a different set of records, In
190other words, blocks that were written together may be read separately,
191and vice-versa.
192.Pp
193If one requests more blocks than remain in the file, the drive will
194encounter the file mark. Because there is some data to return (unless
195there were no records before the file mark), the read will succeed,
196returning that data. The next read will return immediately with an
197EOF. (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
200The handling of file marks on write is automatic.
201If the user has
202written to the tape, and has not done a read since the last write,
203then a file mark will be written to the tape when the device is
204closed. If a rewind is requested after a write, then the driver
205assumes that the last file on the tape has been written, and ensures
206that there are two file marks written to the tape. The exception to
207this is that there seems to be a standard (which we follow, but don't
208understand why) that certain types of tape do not actually write two
209file marks to tape, but when read, report a `phantom' file mark when the
210last 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
212block devices. This has not been determined yet, and they are treated
213as separate behaviors by the driver at this time.)
214.Sh KERNEL CONFIGURATION
215In configuring, if an optional
216.Ar count
217is given in the specification, that number of tape devices are configured.
218.Pp
219.Sh NOTES
220Some motherboards and IDE controllers are out of spec when it comes to
221certain minor, but critical to tape, sections of ATAPI spec. These
222motherboards are mostly rare, with the exception of the Natoma 440FX
223chipset found on Pentium Pro motherboards.
224.Sh FILES
225.Bl -tag -width /dev/wst[0-9] -compact
226.It Pa /dev/wst[0-9]
227device entries
228.El
229.Sh DIAGNOSTICS
230None.
231.Sh HISTORY
232.An "S\(/oren Schmidt" Aq sos@sos.freebsd.dk
233wrote this driver which first
234appeared in
235.Fx 3.0 .