BSD 4_3_Tahoe release
[unix-history] / usr / src / man / man4 / tahoe / mtio.4
CommitLineData
40a07efa
KM
1.\" Copyright (c) 1986 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
ca67e7b4 5.\" @(#)mtio.4 6.1 (Berkeley) 11/24/86
40a07efa 6.\"
ca67e7b4 7.TH MT 4 "November 24, 1986"
40a07efa
KM
8.UC 7
9.SH NAME
10mt \- UNIX magtape interface
11.SH DESCRIPTION
12The files
13.I "cy0s, ..., cy15s"
14refer to the UNIX magtape drives,
15which may be on the VERSABUS using the CIPHER tapemaster formatter
16.IR cy (4),
17The following description applies to any of the transport/controller pairs.
18The files
19.I "cy0s, ..., cy15s"
20are read/written in 25ips,
21The density (1600 bpi or 3200 bpi) is selected by a switch on the drive.
22The files
23.I "cy0s, ..., cy7s"
24are rewound when closed.
25The non-rewinding files are named
26.I ncy[0-7]
27respectively.
28.PP
29For compatibility, the
30.I [n]cy*s
31files are linked to appropriate
32.I [n]mt*
33files.
34.PP
35When a file open for writing is closed, two file-marks are written.
36If the tape is not to be rewound
37it is positioned with the head between the two
38file-marks.
39.PP
40A standard tape consists of a
41series of 1024 byte records terminated by two
42file-marks.
43To the extent possible, the system makes
44it possible, if inefficient, to treat
45the tape like any other file.
46Seeks have their usual meaning and it is possible
47to read or write a byte at a time.
48.PP
49The
50.I mt
51files discussed above are useful
52when it is desired to access the tape in a way
53compatible with ordinary files.
54When foreign tapes are to be dealt with, and especially
55when long records are to be read or written, the
56`raw' interface is appropriate.
57Writing in very small units is inadvisable,
58however, because it tends to create monstrous record
59gaps. The associated files are named
60.I "rcy0s, ..., rcy15s,"
61but the same minor-device considerations as for the regular files still apply,
62as well as the appropriate
63.I r[n]mt*
64links.
65.PP
66A number of other ioctl operations are available
67on raw magnetic tape.
68The following definitions are from <sys/mtio.h>:
69.PP
70.nf
71/*
72 * Structures and definitions for mag tape io control commands
73 */
74
75/* mag tape io control commands */
76#define MTIOCTOP (('m'<<8)|1) /* do a mag tape op */
77#define MTIOCGET (('m'<<8)|2) /* get mag tape status */
78
79/* structure for MTIOCTOP - mag tape op command */
80struct mtop {
81 short mt_op; /* operations defined below */
82 daddr_t mt_count; /* how many of them */
83};
84
85/* operations */
86#define MTWEOF 0 /* write an end-of-file record */
87#define MTFSF 1 /* forward space file */
88#define MTBSF 2 /* backward space file */
89#define MTFSR 3 /* forward space record */
90#define MTBSR 4 /* backward space record */
91#define MTREW 5 /* rewind */
92#define MTOFFL 6 /* rewind and put the drive offline */
93#define MTNOP 7 /* no operation, sets status only */
94
95/* structure for MTIOCGET - mag tape get status command */
96
97struct mtget {
98 short mt_type; /* type of magtape device */
99/* the following two registers are grossly device dependent */
100 short mt_dsreg; /* ``drive status'' register */
101 short mt_erreg; /* ``error'' register */
102/* end device-dependent registers */
103 short mt_resid; /* residual count */
104/* the following two are not yet implemented */
105 daddr_t mt_fileno; /* file number of current position */
106 daddr_t mt_blkno; /* block number of current position */
107/* end not yet implemented */
108};
109
110/*
111 * Constants for mt_type byte
112 */
113#define MT_ISTS 01
114#define MT_ISHT 02
115#define MT_ISTM 03
116.fi
117.ft R
118.PP
119Each
120.I read
121or
122.I write
123call reads or writes the next record on the tape.
124In the write case the record has the same length as the
125buffer given.
126During a read, the record size is passed
127back as the number of bytes read, provided it is no greater
128than the buffer size;
129if the record is long, an error is indicated.
130In raw tape I/O seeks are ignored.
131A zero byte count is returned when a tape mark is read,
132but another read will fetch the first record of the
133new tape file.
134.SH FILES
135/dev/mt?,
136/dev/rmt?
137.SH "SEE ALSO"
138mt(1), tar(1), cy(4)
139.SH BUGS