xref: /dragonfly/share/man/man4/sa.4 (revision 38a690d7)
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: src/share/man/man4/sa.4,v 1.22.2.7 2001/08/17 13:08:39 ru Exp $
27.\" $DragonFly: src/share/man/man4/sa.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
28.\"
29.Dd June 6, 1999
30.Dt SA 4
31.Os
32.Sh NAME
33.Nm sa
34.Nd SCSI Sequential Access device driver
35.Sh SYNOPSIS
36.Cd device sa
37.Cd device sa1 at scbus0 target 4 unit 0
38.Sh DESCRIPTION
39The
40.Nm
41driver provides support for all
42.Tn SCSI
43devices of the sequential access class that are attached to the system
44through a supported
45.Tn SCSI
46Host Adapter.
47The sequential access class includes tape and other linear access devices.
48.Pp
49A
50.Tn SCSI
51Host
52adapter must also be separately configured into the system
53before a
54.Tn SCSI
55sequential access device can be configured.
56.Sh MOUNT SESSIONS
57The
58.Nm
59driver is based around the concept of a
60.Dq Em mount session ,
61which is defined as the period between the time that a tape is
62mounted, and the time when it is unmounted.  Any parameters set during
63a mount session remain in effect for the remainder of the session or
64until replaced.
65The tape can be unmounted, bringing the session to a
66close in several ways.  These include:
67.Bl -enum
68.It
69Closing a `rewind device',
70referred to as sub-mode 00 below.
71An example is
72.Pa /dev/sa0 .
73.It
74Using the MTOFFL
75.Xr ioctl 2
76command, reachable through the
77.Sq Cm offline
78command of
79.Xr mt 1 .
80.El
81.Pp
82It should be noted that tape devices are exclusive open devices, except in
83the case where a control mode device is opened.
84In the latter case, exclusive
85access is only sought when needed (e.g., to set parameters).
86.Sh SUB-MODES
87Bits 0 and 1 of the minor number are interpreted as
88.Sq sub-modes .
89The sub-modes differ in the action taken when the device is closed:
90.Bl -tag -width XXXX
91.It 00
92A close will rewind the device; if the tape has been
93written, then a file mark will be written before the rewind is requested.
94The device is unmounted.
95.It 01
96A close will leave the tape mounted.
97If the tape was written to, a file mark will be written.
98No other head positioning takes place.
99Any further reads or writes will occur directly after the
100last read, or the written file mark.
101.It 10
102A close will rewind the device.
103If the tape has been
104written, then a file mark will be written before the rewind is requested.
105On completion of the rewind an unload command will be issued.
106The device is unmounted.
107.El
108.Sh BLOCKING MODES
109.Tn SCSI
110tapes may run in either
111.Sq Em variable
112or
113.Sq Em fixed
114block-size modes.  Most
115.Tn QIC Ns -type
116devices run in fixed block-size mode, where most nine-track tapes and
117many new cartridge formats allow variable block-size.  The difference
118between the two is as follows:
119.Bl -inset
120.It Variable block-size:
121Each write made to the device results in a single logical record
122written to the tape.  One can never read or write
123.Em part
124of a record from tape (though you may request a larger block and read
125a smaller record); nor can one read multiple blocks.  Data from a
126single write is therefore read by a single read.
127The block size used
128may be any value supported by the device, the
129.Tn SCSI
130adapter and the system (usually between 1 byte and 64 Kbytes,
131sometimes more).
132.Pp
133When reading a variable record/block from the tape, the head is
134logically considered to be immediately after the last item read,
135and before the next item after that.
136If the next item is a file mark,
137but it was never read, then the next
138process to read will immediately hit the file mark and receive an end-of-file notification.
139.It Fixed block-size:
140Data written by the user is passed to the tape as a succession of
141fixed size blocks.  It may be contiguous in memory, but it is
142considered to be a series of independent blocks.
143One may never write
144an amount of data that is not an exact multiple of the blocksize.  One
145may read and write the same data as a different set of records, In
146other words, blocks that were written together may be read separately,
147and vice-versa.
148.Pp
149If one requests more blocks than remain in the file, the drive will
150encounter the file mark.  Because there is some data to return (unless
151there were no records before the file mark), the read will succeed,
152returning that data, The next read will return immediately with a value
153of 0.  (As above, if the file mark is never read, it remains for the next
154process to read if in no-rewind mode.)
155.El
156.Sh FILE MARK HANDLING
157The handling of file marks on write is automatic.
158If the user has
159written to the tape, and has not done a read since the last write,
160then a file mark will be written to the tape when the device is
161closed.  If a rewind is requested after a write, then the driver
162assumes that the last file on the tape has been written, and ensures
163that there are two file marks written to the tape.  The exception to
164this is that there seems to be a standard (which we follow, but don't
165understand why) that certain types of tape do not actually write two
166file marks to tape, but when read, report a `phantom' file mark when the
167last file is read.  These devices include the QIC family of devices.
168(It might be that this set of devices is the same set as that of fixed
169block devices.  This has not been determined yet, and they are treated
170as separate behaviors by the driver at this time.)
171.Sh IOCTLS
172The
173.Nm
174driver supports all of the ioctls of
175.Xr mtio 4 .
176.Sh FILES
177.Bl -tag -width /dev/[n][e]sa[0-9] -compact
178.It Pa /dev/[n][e]sa[0-9]
179general form:
180.It Pa /dev/sa0
181Rewind on close
182.It Pa /dev/nsa0
183No rewind on close
184.It Pa /dev/esa0
185Eject on close (if capable)
186.It Pa /dev/sa0.ctl
187Control mode device (to examine state while another program is
188accessing the device, e.g.).
189.El
190.Sh BUGS
191This driver lacks many of the hacks required to deal with older devices.
192Many older
193.Tn SCSI-1
194devices may not work properly with this driver yet.
195.Pp
196Additionally, certain
197tapes (QIC tapes mostly) that were written under
198.Fx
1992.X
200aren't automatically read correctly with this driver: you may need to
201explicitly set variable block mode or set to the blocksize that works best
202for your device in order to read tapes written under
203.Fx
2042.X.
205.Pp
206Fine grained density and compression mode support that is bound to specific
207device names needs to be added.
208.Pp
209Support for fast indexing by use of partitions is missing.
210.Sh DIAGNOSTICS
211None.
212.Sh SEE ALSO
213.Xr mt 1 ,
214.Xr scsi 4
215.Sh HISTORY
216The
217.Nm
218driver was written for the
219.Tn CAM
220.Tn SCSI
221subsystem by Justin T. Gibbs and Kenneth Merry.
222Many ideas were gleaned from the
223.Nm st
224device driver written and ported from
225.Tn Mach
2262.5
227by
228.An Julian Elischer .
229.Pp
230The current owner of record is
231.An Matthew Jacob
232who has suffered too many
233years of breaking tape drivers.
234