1 .\" $NetBSD: mtio.4,v 1.15 2003/08/07 10:31:03 agc Exp $
3 .\" Copyright (c) 1983, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" 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.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" from: @(#)mtio.4 8.1 (Berkeley) 6/5/93
37 .Nd generic magnetic tape I/O interface
43 Magnetic tape has been the computer system backup and data transfer
44 medium of choice for decades, because it has historically been
45 cheaper in cost per bit stored, and the formats have been designed
46 for portability and storage.
47 However, tape drives have generally been the slowest mass
48 storage devices attached to any computer system.
50 Magnetic tape comes in a wide variety of formats, from classic 9-track,
51 through various Quarter Inch Cartridge
53 variants, to more modern systems using 8mm video tape, and
56 There have also been a variety of proprietary tape systems, including
61 Regardless of the specific characteristics of the particular tape
62 transport mechanism (tape drive),
64 tape I/O has two interfaces:
68 I/O through the block interface of a tape device is similar to I/O
69 through the block special device for a disk driver: the individual
73 calls can be done in any amount of bytes, but all data is buffered
74 through the system buffer cache, and I/O to the device is done in
75 1024 byte sized blocks.
76 This limitation is sufficiently restrictive that the block interface
77 to tape devices is rarely used.
81 interface differs in that all I/O can be done in arbitrary sized blocks,
82 within the limitations for the specific device and device driver,
83 and all I/O is synchronous.
84 This is the most flexible interface, but since there is very little
85 that is handled automatically by the kernel, user programs must
86 implement specific magnetic tape handling routines, which puts the onus
87 of correctness on the application programmer.
88 .Ss DEVICE NAME CONVENTIONS
89 Each magnetic tape subsystem has a couple of special devices
92 The block device is usually named for the driver, e.g.
99 The raw device name is the block device name with an
104 By default, the tape driver will rewind the tape drive when the
106 To make it possible for multiple program invocations to
107 sequentially write multiple files on the same tape, a
108 .Qq no rewind on close
109 device is provided, denoted by the letter
111 prepended to the name of the device, e.g.
117 command can be used to explicitly rewind, or otherwise position a
118 tape at a particular point with the no-rewind device.
119 .Ss FILE MARK HANDLING
120 Two end-of-file (EOF) markers mark the end of a tape (EOT), and
121 one end-of-file marker marks the end of a tape file.
123 By default, the tape driver will write two End Of File (EOF) marks
124 and rewind the tape when the device is closed after the last write.
126 If the tape is not to be rewound it is positioned with the
127 head in between the two tape marks, where the next write
128 will over write the second end-of-file marker.
130 All of the magnetic tape devices may be manipulated with the
136 operations are available on raw magnetic tape.
139 for their definitions.
140 .\" The following definitions are from
141 .\" .Aq Pa sys/mtio.h :
143 .\" there was a copy of sys/mtio.h here. silly.
146 The manual pages for specific tape device drivers should list their
147 particular capabilities and limitations.
161 The status should be returned in a device independent format.
165 is updated to deal with non-512 byte per sector disk media through the
166 system buffer cache, perhaps a more sane tape interface can be