File:  [CSRG BSD Unix] / 43BSDTahoe / man / man4 / tahoe / mtio.4
Revision 1.1: download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
CVS tags: MAIN, HEAD
Initial revision

.\" Copyright (c) 1986 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)mtio.4	6.1 (Berkeley) 11/24/86
.\"
.TH MT 4 "November 24, 1986"
.UC 7
.SH NAME
mt \- UNIX magtape interface
.SH DESCRIPTION
The files
.I "cy0s, ..., cy15s"
refer to the UNIX magtape drives,
which may be on the VERSABUS using the CIPHER tapemaster formatter
.IR cy (4),
The following description applies to any of the transport/controller pairs.
The files
.I "cy0s, ..., cy15s"
are read/written in 25ips, 
The density (1600 bpi or 3200 bpi) is selected by a switch on the drive.
The files
.I "cy0s, ..., cy7s"
are rewound when closed.
The non-rewinding files are named
.I ncy[0-7]
respectively.
.PP
For compatibility, the
.I [n]cy*s
files are linked to appropriate
.I [n]mt*
files.
.PP
When a file open for writing is closed, two file-marks are written.
If the tape is not to be rewound
it is positioned with the head between the two
file-marks.
.PP
A standard tape consists of a
series of 1024 byte records terminated by two
file-marks.
To the extent possible, the system makes
it possible, if inefficient, to treat
the tape like any other file.
Seeks have their usual meaning and it is possible
to read or write a byte at a time.
.PP
The
.I mt
files discussed above are useful
when it is desired to access the tape in a way
compatible with ordinary files.
When foreign tapes are to be dealt with, and especially
when long records are to be read or written, the
`raw' interface is appropriate.
Writing in very small units is inadvisable,
however, because it tends to create monstrous record
gaps.  The associated files are named
.I "rcy0s, ..., rcy15s,"
but the same minor-device considerations as for the regular files still apply,
as well as the appropriate
.I r[n]mt*
links.
.PP
A number of other ioctl operations are available
on raw magnetic tape.
The following definitions are from <sys/mtio.h>:
.PP
.nf
/*
 * Structures and definitions for mag tape io control commands
 */

/* mag tape io control commands */
#define MTIOCTOP	(('m'<<8)|1)	/* do a mag tape op */
#define MTIOCGET	(('m'<<8)|2)	/* get mag tape status */

/* structure for MTIOCTOP - mag tape op command */
struct	mtop	{
	short	mt_op;		/* operations defined below */
	daddr_t	mt_count;	/* how many of them */
};

/* operations */
#define MTWEOF	0	/* write an end-of-file record */
#define MTFSF	1	/* forward space file */
#define MTBSF	2	/* backward space file */
#define MTFSR	3	/* forward space record */
#define MTBSR	4	/* backward space record */
#define MTREW	5	/* rewind */
#define MTOFFL	6	/* rewind and put the drive offline */
#define MTNOP	7	/* no operation, sets status only */

/* structure for MTIOCGET - mag tape get status command */

struct	mtget	{
	short	mt_type;		/* type of magtape device */
/* the following two registers are grossly device dependent */
	short	mt_dsreg;		/* ``drive status'' register */
	short	mt_erreg;		/* ``error'' register */
/* end device-dependent registers */
	short	mt_resid;		/* residual count */
/* the following two are not yet implemented */
	daddr_t mt_fileno;	/* file number of current position */
	daddr_t mt_blkno;	/* block number of current position */
/* end not yet implemented */
};

/*
 * Constants for mt_type byte
 */
#define MT_ISTS		01
#define MT_ISHT		02
#define MT_ISTM		03
.fi
.ft R
.PP
Each
.I read
or
.I write
call reads or writes the next record on the tape.
In the write case the record has the same length as the
buffer given.
During a read, the record size is passed
back as the number of bytes read, provided it is no greater
than the buffer size;
if the record is long, an error is indicated.
In raw tape I/O seeks are ignored.
A zero byte count is returned when a tape mark is read,
but another read will fetch the first record of the
new tape file.
.SH FILES
/dev/mt?,
/dev/rmt?
.SH "SEE ALSO"
mt(1), tar(1), cy(4)
.SH BUGS

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.