xref: /freebsd/share/man/man4/sa.4 (revision 0640d357f29fb1c0daaaffadd0416c5981413afd)
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.\"	$Id: st.4,v 1.11 1997/03/07 02:49:34 jmg Exp $
27.\"
28.Dd October 15, 1998
29.Dt SA 4
30.Os FreeBSD
31.Sh NAME
32.Nm sa
33.Nd SCSI Sequential Access Device Driver
34.Sh SYNOPSIS
35.Cd device sa0
36.Cd device sa1 at scbus0 target 4 lun 0
37.Sh DESCRIPTION
38The
39.Nm sa
40driver provides support for all
41.Tn SCSI
42devices of the sequential access class that are attached to the system
43through a supported
44.Tn SCSI
45Host Adapter.
46The sequential access class includes tape and other linear access devices.
47.Pp
48A
49.Tn SCSI
50Host
51adapter must also be separately configured into the system
52before a
53.Tn SCSI
54sequential access device can be configured.
55.Sh MOUNT SESSIONS
56The
57.Nm
58driver is based around the concept of a
59.Dq Em mount session ,
60which is defined as the period between the time that a tape is
61mounted, and the time when it is unmounted.  Any parameters set during
62a mount session remain in effect for the remainder of the session or
63until replaced. The tape can be unmounted, bringing the session to a
64close in several ways.  These include:
65.Bl -enum
66.It
67Closing a `rewind device',
68referred to as sub-mode 00 below. An example is
69.Pa /dev/rsa0 .
70.It
71Using the MTOFFL
72.Xr ioctl 2
73command, reachable through the
74.Sq Cm offline
75command of
76.Xr mt 1 .
77.Sh SUB-MODES
78Bits 0 and 1 of the minor number are interpreted as
79.Sq sub-modes .
80The sub-modes differ in the action taken when the device is closed:
81.Bl -tag -width XXXX
82.It 00
83A close will rewind the device; if the tape has been
84written, then a file mark will be written before the rewind is requested.
85The device is unmounted.
86.It 01
87A close will leave the tape mounted.
88If the tape was written to, a file mark will be written.
89No other head positioning takes place.
90Any further reads or writes will occur directly after the
91last read, or the written file mark.
92.It 10
93A close will rewind the device. If the tape has been
94written, then a file mark will be written before the rewind is requested.
95On completion of the rewind an unload command will be issued.
96The device is unmounted.
97.Sh BLOCKING MODES
98.Tn SCSI
99tapes may run in either
100.Sq Em variable
101or
102.Sq Em fixed
103block-size modes.  Most
104.Tn QIC Ns -type
105devices run in fixed block-size mode, where most nine-track tapes and
106many new cartridge formats allow variable block-size.  The difference
107between the two is as follows:
108.Bl -inset
109.It Variable block-size:
110Each write made to the device results in a single logical record
111written to the tape.  One can never read or write
112.Em part
113of a record from tape (though you may request a larger block and read
114a smaller record); nor can one read multiple blocks.  Data from a
115single write is therefore read by a single read. The block size used
116may be any value supported by the device, the
117.Tn SCSI
118adapter and the system (usually between 1 byte and 64 Kbytes,
119sometimes more).
120.Pp
121When reading a variable record/block from the tape, the head is
122logically considered to be immediately after the last item read,
123and before the next item after that. If the next item is a file mark,
124but it was never read, then the next
125process to read will immediately hit the file mark and receive an end-of-file notification.
126.It Fixed block-size
127Data written by the user is passed to the tape as a succession of
128fixed size blocks.  It may be contiguous in memory, but it is
129considered to be a series of independent blocks. One may never write
130an amount of data that is not an exact multiple of the blocksize.  One
131may read and write the same data as a different set of records, In
132other words, blocks that were written together may be read separately,
133and vice-versa.
134.Pp
135If one requests more blocks than remain in the file, the drive will
136encounter the file mark.  Because there is some data to return (unless
137there were no records before the file mark), the read will succeed,
138returning that data, The next read will return immediately with a value
139of 0.  (As above, if the file mark is never read, it remains for the next
140process to read if in no-rewind mode.)
141.El
142.Sh FILE MARK HANDLING
143The handling of file marks on write is automatic. If the user has
144written to the tape, and has not done a read since the last write,
145then a file mark will be written to the tape when the device is
146closed.  If a rewind is requested after a write, then the driver
147assumes that the last file on the tape has been written, and ensures
148that there are two file marks written to the tape.  The exception to
149this is that there seems to be a standard (which we follow, but don't
150understand why) that certain types of tape do not actually write two
151file marks to tape, but when read, report a `phantom' file mark when the
152last file is read.  These devices include the QIC family of devices.
153(It might be that this set of devices is the same set as that of fixed
154block devices.  This has not been determined yet, and they are treated
155as separate behaviors by the driver at this time.)
156.Sh IOCTLS
157The
158.Nm sa
159driver supports all of the ioctls of
160.Xr mtio 4 .
161.Sh FILES
162.Bl -tag -width /dev/[n][e]rsa[0-9] -compact
163.It Pa /dev/[n][e]rsa[0-9]
164general form:
165.It Pa /dev/rsa0
166Rewind on close
167.It Pa /dev/nrsa0
168No rewind on close
169.It Pa /dev/erst0
170Eject on close (if capable)
171.Sh BUGS
172This driver lacks many of the hacks required to deal with older devices.
173Many older
174.Tn SCSI-1
175devices may not work properly with this driver yet.
176.Pp
177The device node interface for different tape formats and modes should
178be rethought after considering the strategies employed by other vendors.
179.Pp
180Support for fast indexing and tape status reporting is lacking.
181.Sh DIAGNOSTICS
182None.
183.Sh SEE ALSO
184.Xr mt 1 ,
185.Xr scsi 4 ,
186.Xr sa 9
187.Sh HISTORY
188The
189.Nm sa
190driver was written for the
191.Tn CAM
192.Tn SCSI
193subsystem by Justin T. Gibbs and Kenneth Merry.
194Many ideas were gleaned from the
195.Nm st
196device driver written and ported from
197.Tn Mach
1982.5
199by Julian Elischer.
200