Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mtio(4) [minix man page]

MTIO(4) 						     Kernel Interfaces Manual							   MTIO(4)

NAME
mtio - magnetic tape commands SYNOPSIS
#include <sys/types.h> #include <sys/mtio.h> #include <sys/ioctl.h> DESCRIPTION
The magnetic tape devices described in sd(4) may be sent commands or queried for their status using the following ioctl calls: ioctl(fd, MTIOCTOP, &struct mtop) ioctl(fd, MTIOCGET, &struct mtget) The struct mtop, struct mtget and associated definitions are defined in <sys/mtio.h> as follows: /* Tape operations: ioctl(fd, MTIOCTOP, &struct mtop) */ struct mtop { short mt_op; /* Operation (MTWEOF, etc.) */ int mt_count; /* Repeat count. */ }; #define MTWEOF 0 /* Write End-Of-File Marker */ #define MTFSF 1 /* Forward Space File mark */ #define MTBSF 2 /* Backward Space File mark */ #define MTFSR 3 /* Forward Space Record */ #define MTBSR 4 /* Backward Space Record */ #define MTREW 5 /* Rewind tape */ #define MTOFFL 6 /* Rewind and take Offline */ #define MTNOP 7 /* No-Operation, set status only */ #define MTRETEN 8 /* Retension (completely wind and rewind) */ #define MTERASE 9 /* Erase the tape and rewind */ #define MTEOM 10 /* Position at End-Of-Media */ #define MTMODE 11 /* Select tape density */ #define MTBLKZ 12 /* Select tape block size */ /* Tape status: ioctl(fd, MTIOCGET, &struct mtget) */ struct mtget { short mt_type; /* Type of tape device. */ /* Device dependent "registers". */ short mt_dsreg; /* Drive status register. */ short mt_erreg; /* Error register. */ /* Misc info. */ off_t mt_resid; /* Residual count. */ off_t mt_fileno; /* Current File Number. */ off_t mt_blkno; /* Current Block Number within file. */ off_t mt_blksize; /* Current block size. */ }; See mt(1) for a detailed description on what each operation does. The mt_type field is always zero, there is no use for it yet. Mt_dsreg is 0 (OK), 1 (Error), or 2 (EOF encountered.) Mt_erreg holds the SCSI sense key of the last operation. Mt_blksize is the current tape block size in bytes, zero if the block size is variable. Note that one can issue these commands on a file descriptor that is in use to read or write data, something that mt can't do. So you can add eof markers in the middle of an output stream, or get the status of a device before a rewind-on-close tape rewinds. The driver will automatically add an end of file marker to a tape that is written to if you execute a space command. If you write eof markers yourself then the driver will not add one extra on close. SEE ALSO
mt(1), sd(4). AUTHOR
Kees J. Bot (kjb@cs.vu.nl) MTIO(4)

Check Out this Related Man Page

MT(1)							      General Commands Manual							     MT(1)

NAME
mt - magnetic tape control SYNOPSIS
mt [-f device] [count] DESCRIPTION
Mt is a user interface to the magnetic tape commands described in mtio(4). It allows one to space a tape forwards or backwards, write end of file markers, etc. With the -f option a tape device can be named, otherwise the environment variable TAPE is used if set, otherwise the default device /dev/nrst4 is assumed. Standard input is used if the tape name is a dash (-). The count argument is used to tell how many blocks or files to space or how many file markers to write. It may be a C-style decimal, octal or hexadecimal constant, by default "1". Command is the action to perform, it may be one of the following, or any unambiguous prefix (like st for status): eof, weof Write count end-of-file markers. fsf Forward space count file markers. fsr Forward space count records. (The size of a record depends on the tape, and may even be variable, depending on the size of the writes.) bsf Backwards space count files. The count may be zero to backspace to the start of the current file. (A tape device need not support backwards movement, or may be very slow doing it. Rewinding and forward spacing may be better.) bsr Backwards space count records. The tape is positioned after the last block of the previous file if you hit a filemark when spacing backwards. The block count is set to -1 to indicate that the driver has no idea where it is on the previous file. eom Forward space to the end of media. rewind Rewind the tape. offline, rewoffl Rewind and take offline. This may cause some drives to eject the tape. status Shows the status of the drive, the sense key of the last SCSI error, current file number, current record number, residual count if the last command that encountered end-of-file, and the current block size. retension Removes tape tension by winding and rewinding the tape completely. erase Erases the tape completely and rewinds it. density Sets the density code to read or write the tape to count. Density codes supported depend on the drive. This command need not be used if the drive senses the proper density on read and can only write one density. blksize, blocksize Sets the block size used to read or write the tape to count. This command may be used to select a fixed block size for a variable block size tape. This will speed up I/O for small block sizes. Use a zero count to use variable sized blocks again. ENVIRONMENT
TAPE Tape drive to use if set. FILES
/dev/nrst4 Default tape device. SEE ALSO
mtio(4), st(4). AUTHOR
Kees J. Bot (kjb@cs.vu.nl) MT(1)
Man Page