source: trunk/minix/man/man4/mtio.4@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 2.7 KB
Line 
1.TH MTIO 4
2.SH NAME
3mtio \- magnetic tape commands
4.SH SYNOPSIS
5.B "#include <sys/types.h>"
6.br
7.B "#include <sys/mtio.h>"
8.br
9.B "#include <sys/ioctl.h>"
10.SH DESCRIPTION
11.de SP
12.if t .sp 0.4
13.if n .sp
14..
15The magnetic tape devices described in
16.BR sd (4)
17may be sent commands or queried for their status using the following ioctl
18calls:
19.PP
20.RS
21.BR ioctl ( \fIfd ,
22.BR MTIOCTOP ,
23.RB & "struct mtop" )
24.br
25.BR ioctl ( \fIfd ,
26.BR MTIOCGET ,
27.RB & "struct mtget" )
28.RE
29.PP
30The struct mtop, struct mtget and associated definitions are defined in
31<sys/mtio.h> as follows:
32.PP
33.nf
34
35/* Tape operations: ioctl(fd, MTIOCTOP, &struct mtop) */
36
37.ta +4n +7n +15n
38struct mtop {
39 short mt_op; /* Operation (MTWEOF, etc.) */
40 int mt_count; /* Repeat count. */
41};
42
43.ta +17n +5n
44#define MTWEOF 0 /* Write End-Of-File Marker */
45#define MTFSF 1 /* Forward Space File mark */
46#define MTBSF 2 /* Backward Space File mark */
47#define MTFSR 3 /* Forward Space Record */
48#define MTBSR 4 /* Backward Space Record */
49#define MTREW 5 /* Rewind tape */
50#define MTOFFL 6 /* Rewind and take Offline */
51#define MTNOP 7 /* No-Operation, set status only */
52#define MTRETEN 8 /* Retension (completely wind and rewind) */
53#define MTERASE 9 /* Erase the tape and rewind */
54#define MTEOM 10 /* Position at End-Of-Media */
55#define MTMODE 11 /* Select tape density */
56#define MTBLKZ 12 /* Select tape block size */
57
58/* Tape status: ioctl(fd, MTIOCGET, &struct mtget) */
59
60.ta +4n +7n +15n
61struct mtget {
62 short mt_type; /* Type of tape device. */
63
64 /* Device dependent "registers". */
65 short mt_dsreg; /* Drive status register. */
66 short mt_erreg; /* Error register. */
67
68 /* Misc info. */
69 off_t mt_resid; /* Residual count. */
70 off_t mt_fileno; /* Current File Number. */
71 off_t mt_blkno; /* Current Block Number within file. */
72 off_t mt_blksize; /* Current block size. */
73};
74
75.fi
76.PP
77See
78.BR mt (1)
79for a detailed description on what each operation does. The mt_type field
80is always zero, there is no use for it yet. Mt_dsreg is 0 (OK), 1 (Error),
81or 2 (EOF encountered.) Mt_erreg holds the SCSI sense key of the last
82operation. Mt_blksize is the current tape block size in bytes, zero if the
83block size is variable.
84.PP
85Note that one can issue these commands on a file descriptor that is in use
86to read or write data, something that
87.B mt
88can't do. So you can add eof markers in the middle of an output stream,
89or get the status of a device before a rewind-on-close tape rewinds.
90.PP
91The driver will automatically add an end of file marker to a tape that is
92written to if you execute a space command. If you write eof markers
93yourself then the driver will not add one extra on close.
94.SH "SEE ALSO"
95.BR mt (1),
96.BR sd (4).
97.SH AUTHOR
98Kees J. Bot (kjb@cs.vu.nl)
Note: See TracBrowser for help on using the repository browser.