# (ls -l; ls -l rmt) | grep "23, 6" crw-rw-rw- 1 root sys 23, 64 Mar 10 13:19 tape crw-rw-rw- 1 root sys 23, 65 Dec 18 16:05 nrtape crw-rw-rw- 1 root sys 23, 66 May 11 1992 tapens crw-rw-rw- 1 root sys 23, 67 May 11 1992 nrtapens crw-rw-rw- 2 root sys 23, 64 Mar 5 13:20 tps0d2 crw-rw-rw- 2 root sys 23, 65 Mar 5 13:20 tps0d2nr crw-rw-rw- 2 root sys 23, 66 Mar 5 13:20 tps0d2ns crw-rw-rw- 2 root sys 23, 67 Mar 5 13:20 tps0d2nrns ----------------------------------------------------------------------------- Note: "nr" stands for "non-rewind" and "ns" stands for "non byte-swapping". Other details of tape devices for this IRIX example are found in the man pages for "tps" devices: TPS(7M) Silicon Graphics TPS(7M) NAME tps - SCSI tape interface SYNOPSIS /dev/mt/tps* /dev/rmt/tps* DESCRIPTION The IRIS-4D series workstations support the Small Computer System Interface (SCSI) for various tape drives, including QIC24 and QIC150 1/4" cartridges, 9 track, 8 mm video, and DAT (digital audio tape) tapedrives. Since so many different types of devices are supported, and not all their features can be determined directly from the drive, a configuration table defines their capablities. This is usually found in the file /usr/sysgen/master.d/tpsc. The special files are named according to the convention discussed in intro(7): /dev/{r}mt/tpsd{nr}{ns}{v}{.density} Where {nr} is the no-rewind on close device, {ns} is the non-byte swapping device, and {v} is the variable block size device (supported only for 9 track and 8 mm). Density for 9 track tape is one of 800, 1600, 3200, or 6250 and for the Exabyte 8500 it is one of 8200 and 8500. These special devices are accessable by only one user or program at a time. Typically, if this device is used as the system tape drive, the device specific names described here are linked to user friendly names in the /dev directory. see NOTES below, and mtio(7) for a description of these names. SPECIAL FEATURES The different devices support a multitude of capablities. In particular, some support multiple densities, some support fixed block size only, some support variable block sizes, some support multiple speeds, some support direct transfer of audio data over the SCSI bus. Some of these features are selected by which minor device is opened, and others must be set via ioctl commands. The list of capablities that a particular drive supports is set by the MTCAN_* bits set in the master.d/tpsc file for that drive. When a capablity required for an operation is not set, the EINVAL error code is returned for the request. In particular, in audio mode, the variable block size device must always be used for i/o, and parameters such as the recording frequency, program number, etc. are all part of the data stream. Additionally, when in audio mode the rewind and seek commands return immediately. If the drive is closed in this state, subsequent opens will block until they are completed. If the drive remains open, then certain commands, such as MTIOCGET and MTIOCAUDPOSN may be used to determine the current position Page 1 Release 4.0.5 May 1992 TPS(7M) Silicon Graphics TPS(7M) of the tape during the seek or rewind operation. The MTAUD tape op is used to enable and disable audio mode. Many of the features that require ioctls can be set or changed via the mt command. The data structures and values for these ioctls can be found in the include file shipped with all systems /usr/include/sys/mtio.h. There are extensive comments in this file, and at this time no attempt has been made to document most of them here, or in the mtio manual page. However, there are a few surprising return values that are mentioned here. In particular, when using partitioned tapes (see mt setpart, or the MTSETPART ioctl), partition 0 is the 'main' partition, which is the final part of the tape, and partition 1 is the partition closest to BOT. Partitioned tapes are intended primarily so that a tape directory can be written at the beginning of the tape, without any worry of overwriting the data portion of the tape. In addition, partitioned tapes indicate BOT (EOT) when at beginning (end) of partition, rather than the 'real' BOT (EOT). Some devices support overwrite at arbitrary tape positions, while others require that the tape be at BOT or EOD (end of data). Others allow overwrite at any filemark (e.g., 8mm, from the BOT side of any filemark). Some experimentation may be necessary to decide what your particular drive supports; ALL drives support at a minimum writing at both BOT and EOD, assuming the media isn't write protected. TAPE MOVEMENT CRITERIA With the following exceptions, the only time the driver ever moves a tape is when told to, and a command that causes tape movement is always issued, assuming that it is a valid command, and the media is loaded. This is intended to be consistent with the jagtape driver. Note that a significant change from IRIX releases prior to 4.0, is that the driver will NOT automatically position to the next filemark on the first command that does i/o to the tape. This means that 'mt bsr', and 'mt fsr' now have meaning since the tape will in fact be left where it is positioned. It is now the programmers/users responsiblity to ensure that the tape is in a valid state for i/o; the drive or driver will still detect and prevent operations not valid for the current tape position, returning an appropriate error in errno. 1. If the first read after an open encounters a filemark before transferring any data, and the tape was not known to be at the top of a filemark or BOT, the filemark will be skipped, and the read retried. Any further errors will be reported exactly as they occur. In particular, if two sequential filemarks are found, the tape will be positioned between them in this case. 2. If a read command encounters into a filemark, that read will return a short count (if any data was read) or 0. If a short count is returned, the next read will return 0, allowing detection of Page 2 Release 4.0.5 May 1992 TPS(7M) Silicon Graphics TPS(7M) filemarks. The read following the read that returns 0 will return the data in the next tape file, if any. Note that this is a change from earlier IRIX releases, which required an explicit MTFSF or other tape ioctl to move the tape, before further reads could be done. The new behavior is consistent with most actual tape drives, and tape drivers in most BSD derived Unix systems. It is also consistent with the IRIX xmt tape driver. Similarly, if an MTFSR ioctl encounters a filemark, it will stop at the filemark, and subsequent reads will return data from the next tapefile, if any. 3. If early warning is encountered on a write or write filemark, the driver will not allow further writes or write filemarks, unless the MTANSI ioctl is issued. Any data remaining is flushed to tape, if possible. For the QIC tape drives, and the 8mm drives, an error is returned on both read and write unless all the data was transferred when early warning is encountered. This is so that older multi- volume backups continue to work, and so that new ones can be read on older releases. All newer drives (9 track, DAT, and other future drive types) will return a short count if not all the data could be transferred. Requests other than read or write will be sent to the tape drive as usual. 4. On close, if the last tape movement operation was a successful write (NOT a write filemark), the following will happen: a) Half-inch tape drives will write two filemarks, and then backspace one file, so that the tape is positioned between the two filemarks just written. If, however, the tape is not in ansi mode, and early warning has been encountered, then no write filemark or backspace will be done; filemarks are never written in audio mode.. b) Other tape drives will write one filemark. No backspace will be done. 5. On the first status request or request that does tape motion after a system boot, a SCSI bus reset, or a tape cartridge insertion, the tape will be rewound and loaded; this occurs even for the norewind devices. In addition, some drives will themselves rewind a tape when it is ejected. This means that if you wish to append a new dataset to a tape that already contains datasets, you should always issue the 'mt feom' command AFTER loading the tape, just prior to using the program that will append to the tape. One should not count on a tape remaining at EOD, just because that is where it was before it was removed. For devices that support it, the prevent media removal command is sent to the drive on open, and released on close, so that eject buttons (when present) are disabled. Page 3 Release 4.0.5 May 1992 TPS(7M) Silicon Graphics TPS(7M) ERROR RETURNS The following errors are returned by this driver; other errors may also be returned by higher levels of the operating system. EAGAIN The drive returned an error indicating it was not ready (tape ejected, drive taken off-line, etc.) EBUSY Returned on opens when the drive has already been opened. EFAULT A bad address was passed in a call that required a data transfer. EINVAL This is returned for requests that are invalid for one reason or another; these include: Attempting to write or write file-mark after reading (except in audio mode, for devices that support it) without an intervening close, or ioctl to re-position the tape, Attempting to read after writing (same exceptions as for writing) Using an invalid count on read, write, write file-mark, etc. Attempting to do MTAFILE on a drive that doesn't support it (the MTCAN_APPEND bit is not set in the master.d/tpsc file). Attempting to do an ioctl on a drive that doesn't support it (such as MTBSR on Cipher 540S), or attempting to do an unsupported MTOP operation, or other unsupported ioctl's. Attempting to write to a QIC24 cartridge from a QIC150 drive (an MTIOCGET should be done, and the *QIC* bits should be checked for in mt_dposn to confirm this error). Attempting to do something when not at BOT that can only be done at BOT, such as writing or reading a Kennedy tape drive at a different speed than was previously used, or switching from the variable block size device to the fixed block size device. (Note that in 4.0, an attempt to use a different density is allowed, but the drive continues to use the original density). EIO A generic error occured, such as a SCSI bus reset, unrecoverable media error, etc. Also occurs on close or read/write if the media has been unloaded while the device is open. ENOMEM An attempt was made to read data with a count less than that at which the block was written; can only happen with drives that support variable block sizes. Can also occur if the kernel memory allocator is not able to allocate memory for the driver structures. ENOSPC On read or space commands that encounter end of tape or end of data; writes that are attempted at end of tape; also some other commands that encounter EOT or EOD. EROFS A write or write file-mark was attempted to a write-protected tape. ENODEV An open was attempted on a device with an invalid scsi controller or SCSI ID specified (i.e., a mknod with the wrong arguments was used to create the device special file), or an Page 4 Release 4.0.5 May 1992 TPS(7M) Silicon Graphics TPS(7M) attempt to open a tape in variable blocksize mode, when the device doesn't support it. Also occurs when the SCSI inquiry command fails, or returns indicating that the device is not a tape device (media not removable, or not a sequential access device). NOTE High density tape cartridges such as the DC6150 (originally called 600 XTD) written on a system equipped with QIC 150 tape drives can NOT be read on older systems. Even if a "low density" tape (such as DC 600A) is used, it is still written at a higher density (QIC 120) than older tape drives can read. Tapes written on the older systems can still be read on the new tape drives, however. Systems with QIC 150 cartridge tape drives such as the Personal Iris are able to read QIC24 tapes (310 oersted) such as the DC 300XL, but are not able to write them. All tape devices other than the QIC (quarter-inch) tape drives have /dev/tape linked to the {ns} device for performance, since there is no compatiblity issue, and byte swapping is done in software. Most newer drives support variable block size devices, and the /dev/tape link uses those by default; when multiple densities are supported, as with 9 track, the link is to the highest capacity device. For compatiblity with earlier IRIX releases, the 8mm device is linked to the fixed block device. See the (unfortunately somewhat confusing) script /dev/MAKEDEV for details; in particular, look at the tapelinks target. FILES /dev/mt/tps[0-3]* /dev/rmt/tps[0-3]* /usr/sysgen/master.d/tpsc contains a configuration table indicating what devices support what features, and what string should be matched against the string returned by the SCSI inquiry command. SEE ALSO bru(1), cpio(1), mt(1), tar(1), ts(7M), xmt(7M), jagtape(7m), dataudio(3), datframe(4) Page 5 Release 4.0.5 May 1992