1c2466934SMike Pritchard.\" Copyright (c) 1996 2c2466934SMike Pritchard.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved. 3c2466934SMike Pritchard.\" 4c2466934SMike Pritchard.\" Copyright (c) 1983, 1991, 1993 5c2466934SMike Pritchard.\" The Regents of the University of California. All rights reserved. 6c2466934SMike Pritchard.\" 7c2466934SMike Pritchard.\" Redistribution and use in source and binary forms, with or without 8c2466934SMike Pritchard.\" modification, are permitted provided that the following conditions 9c2466934SMike Pritchard.\" are met: 10c2466934SMike Pritchard.\" 1. Redistributions of source code must retain the above copyright 11c2466934SMike Pritchard.\" notice, this list of conditions and the following disclaimer. 12c2466934SMike Pritchard.\" 2. Redistributions in binary form must reproduce the above copyright 13c2466934SMike Pritchard.\" notice, this list of conditions and the following disclaimer in the 14c2466934SMike Pritchard.\" documentation and/or other materials provided with the distribution. 15dda5b397SEitan Adler.\" 3. Neither the name of the University nor the names of its contributors 16c2466934SMike Pritchard.\" may be used to endorse or promote products derived from this software 17c2466934SMike Pritchard.\" without specific prior written permission. 18c2466934SMike Pritchard.\" 19c2466934SMike Pritchard.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20c2466934SMike Pritchard.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21c2466934SMike Pritchard.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22c2466934SMike Pritchard.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23c2466934SMike Pritchard.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24c2466934SMike Pritchard.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25c2466934SMike Pritchard.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26c2466934SMike Pritchard.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27c2466934SMike Pritchard.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28c2466934SMike Pritchard.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29c2466934SMike Pritchard.\" SUCH DAMAGE. 30c2466934SMike Pritchard.\" 31*43518607SKenneth D. Merry.Dd February 12, 2015 32474fc32bSAlexey Zelkin.Dt MTIO 4 333d45e180SRuslan Ermilov.Os 34c2466934SMike Pritchard.Sh NAME 35c2466934SMike Pritchard.Nm mtio 36eb083802SRuslan Ermilov.Nd FreeBSD magtape interface 37c2466934SMike Pritchard.Sh DESCRIPTION 38c2466934SMike PritchardThe special files 39c2466934SMike Pritchardnamed 40*43518607SKenneth D. Merry.Pa /dev/[en]sa* 41c2466934SMike Pritchardrefer to SCSI tape drives, 42c2466934SMike Pritchardwhich may be attached to the system. 43*43518607SKenneth D. Merry.Pa /dev/sa*.ctl 44c2466934SMike Pritchardare control devices that can be used to issue ioctls to the SCSI 45c2466934SMike Pritchardtape driver to set parameters that are required to last beyond the 46c2466934SMike Pritchardunmounting of a tape. 47c2466934SMike Pritchard.Pp 48c2466934SMike PritchardThe rewind devices automatically rewind 49c2466934SMike Pritchardwhen the last requested read, write or seek has finished, or the end of the tape 506d249eeeSSheldon Hearnhas been reached. 516d249eeeSSheldon HearnThe letter 52c2466934SMike Pritchard.Ql n 53*43518607SKenneth D. Merryis prepended to 54c2466934SMike Pritchardthe name of the no-rewind devices. 55*43518607SKenneth D. MerryThe letter 56*43518607SKenneth D. Merry.Ql e 57*43518607SKenneth D. Merryis prepended to the name of the eject devices. 58c2466934SMike Pritchard.Pp 59c2466934SMike PritchardTapes can be written with either fixed length records or variable length 605203edcdSRuslan Ermilovrecords. 615203edcdSRuslan ErmilovSee 620a36ae36SMatt Jacob.Xr sa 4 63b5e7e999SRuslan Ermilovfor more information. 64*43518607SKenneth D. MerryTwo filemarks mark the end of a tape, and 65*43518607SKenneth D. Merryone filemark marks the end of a tape file. 66c2466934SMike PritchardIf the tape is not to be rewound it is positioned with the 67c2466934SMike Pritchardhead in between the two tape marks, where the next write 68c2466934SMike Pritchardwill over write the second end-of-file marker. 69c2466934SMike Pritchard.Pp 70c2466934SMike PritchardAll of the magtape devices may be manipulated with the 71c2466934SMike Pritchard.Xr mt 1 72c2466934SMike Pritchardcommand. 73c2466934SMike Pritchard.Pp 74c2466934SMike PritchardA number of 75c2466934SMike Pritchard.Xr ioctl 2 76c2466934SMike Pritchardoperations are available 77c2466934SMike Pritchardon raw magnetic tape. 78c2466934SMike PritchardThe following definitions are from 79fe08efe6SRuslan Ermilov.In sys/mtio.h : 80c2466934SMike Pritchard.Bd -literal 81f5ead386SBruce Evans#ifndef _SYS_MTIO_H_ 82f5ead386SBruce Evans#define _SYS_MTIO_H_ 83f5ead386SBruce Evans 84f5ead386SBruce Evans#ifndef _KERNEL 85f5ead386SBruce Evans#include <sys/types.h> 86f5ead386SBruce Evans#endif 87f5ead386SBruce Evans#include <sys/ioccom.h> 88f5ead386SBruce Evans 89c2466934SMike Pritchard/* 90c2466934SMike Pritchard * Structures and definitions for mag tape io control commands 91c2466934SMike Pritchard */ 92c2466934SMike Pritchard 93c2466934SMike Pritchard/* structure for MTIOCTOP - mag tape op command */ 94c2466934SMike Pritchardstruct mtop { 95c2466934SMike Pritchard short mt_op; /* operations defined below */ 96871c940bSSergey Kandaurov int32_t mt_count; /* how many of them */ 97c2466934SMike Pritchard}; 98c2466934SMike Pritchard 99c2466934SMike Pritchard/* operations */ 100c2466934SMike Pritchard#define MTWEOF 0 /* write an end-of-file record */ 101c2466934SMike Pritchard#define MTFSF 1 /* forward space file */ 102c2466934SMike Pritchard#define MTBSF 2 /* backward space file */ 103c2466934SMike Pritchard#define MTFSR 3 /* forward space record */ 104c2466934SMike Pritchard#define MTBSR 4 /* backward space record */ 105c2466934SMike Pritchard#define MTREW 5 /* rewind */ 106c2466934SMike Pritchard#define MTOFFL 6 /* rewind and put the drive offline */ 107c2466934SMike Pritchard#define MTNOP 7 /* no operation, sets status only */ 108c2466934SMike Pritchard#define MTCACHE 8 /* enable controller cache */ 109c2466934SMike Pritchard#define MTNOCACHE 9 /* disable controller cache */ 110c2466934SMike Pritchard 111c2466934SMike Pritchard#if defined(__FreeBSD__) 112c2466934SMike Pritchard/* Set block size for device. If device is a variable size dev */ 113c2466934SMike Pritchard/* a non zero parameter will change the device to a fixed block size */ 114c2466934SMike Pritchard/* device with block size set to that of the parameter passed in. */ 115c2466934SMike Pritchard/* Resetting the block size to 0 will restore the device to a variable */ 116c2466934SMike Pritchard/* block size device. */ 117c2466934SMike Pritchard 118c2466934SMike Pritchard#define MTSETBSIZ 10 119c2466934SMike Pritchard 120f5ead386SBruce Evans/* Set density values for device. Sets the value for the opened mode only. */ 121c2466934SMike Pritchard 122c2466934SMike Pritchard#define MTSETDNSTY 11 123c2466934SMike Pritchard 124c2466934SMike Pritchard#define MTERASE 12 /* erase to EOM */ 125c2466934SMike Pritchard#define MTEOD 13 /* Space to EOM */ 126c2466934SMike Pritchard#define MTCOMP 14 /* select compression mode 0=off, 1=def */ 127c2466934SMike Pritchard#define MTRETENS 15 /* re-tension tape */ 1280a36ae36SMatt Jacob#define MTWSS 16 /* write setmark(s) */ 1290a36ae36SMatt Jacob#define MTFSS 17 /* forward space setmark */ 1300a36ae36SMatt Jacob#define MTBSS 18 /* backward space setmark */ 131*43518607SKenneth D. Merry#define MTLOAD 19 /* load tape in drive */ 132*43518607SKenneth D. Merry#define MTWEOFI 20 /* write an end-of-file record without waiting*/ 1330a36ae36SMatt Jacob 1340a36ae36SMatt Jacob#define MT_COMP_ENABLE 0xffffffff 1350a36ae36SMatt Jacob#define MT_COMP_DISABLED 0xfffffffe 1360a36ae36SMatt Jacob#define MT_COMP_UNSUPP 0xfffffffd 1370a36ae36SMatt Jacob 1380a36ae36SMatt Jacob/* 1390a36ae36SMatt Jacob * Values in mt_dsreg that say what the device is doing 1400a36ae36SMatt Jacob */ 1410a36ae36SMatt Jacob#define MTIO_DSREG_NIL 0 /* Unknown */ 1420a36ae36SMatt Jacob#define MTIO_DSREG_REST 1 /* Doing Nothing */ 1430a36ae36SMatt Jacob#define MTIO_DSREG_RBSY 2 /* Communicating with tape (but no motion) */ 1440a36ae36SMatt Jacob#define MTIO_DSREG_WR 20 /* Writing */ 1450a36ae36SMatt Jacob#define MTIO_DSREG_FMK 21 /* Writing Filemarks */ 1460a36ae36SMatt Jacob#define MTIO_DSREG_ZER 22 /* Erasing */ 1470a36ae36SMatt Jacob#define MTIO_DSREG_RD 30 /* Reading */ 1480a36ae36SMatt Jacob#define MTIO_DSREG_FWD 40 /* Spacing Forward */ 1490a36ae36SMatt Jacob#define MTIO_DSREG_REV 41 /* Spacing Reverse */ 1500a36ae36SMatt Jacob#define MTIO_DSREG_POS 42 /* Hardware Positioning (direction unknown) */ 1510a36ae36SMatt Jacob#define MTIO_DSREG_REW 43 /* Rewinding */ 1520a36ae36SMatt Jacob#define MTIO_DSREG_TEN 44 /* Retensioning */ 1530a36ae36SMatt Jacob#define MTIO_DSREG_UNL 45 /* Unloading */ 154f5ead386SBruce Evans#define MTIO_DSREG_LD 46 /* Loading */ 155c2466934SMike Pritchard 156f5ead386SBruce Evans#endif /* __FreeBSD__ */ 157c2466934SMike Pritchard 158c2466934SMike Pritchard/* structure for MTIOCGET - mag tape get status command */ 159c2466934SMike Pritchard 160c2466934SMike Pritchardstruct mtget { 161c2466934SMike Pritchard short mt_type; /* type of magtape device */ 162c2466934SMike Pritchard/* the following two registers are grossly device dependent */ 163c2466934SMike Pritchard short mt_dsreg; /* ``drive status'' register */ 164c2466934SMike Pritchard short mt_erreg; /* ``error'' register */ 165c2466934SMike Pritchard/* end device-dependent registers */ 166871c940bSSergey Kandaurov /* 167871c940bSSergey Kandaurov * Note that the residual count, while maintained, may be 168871c940bSSergey Kandaurov * be nonsense because the size of the residual may (greatly) 169871c940bSSergey Kandaurov * exceed 32 K-bytes. Use the MTIOCERRSTAT ioctl to get a 170871c940bSSergey Kandaurov * more accurate count. 171871c940bSSergey Kandaurov */ 172c2466934SMike Pritchard short mt_resid; /* residual count */ 173c2466934SMike Pritchard#if defined (__FreeBSD__) 174871c940bSSergey Kandaurov int32_t mt_blksiz; /* presently operating blocksize */ 175871c940bSSergey Kandaurov int32_t mt_density; /* presently operating density */ 1766b99842aSEd Schouten uint32_t mt_comp; /* presently operating compression */ 177871c940bSSergey Kandaurov int32_t mt_blksiz0; /* blocksize for mode 0 */ 178871c940bSSergey Kandaurov int32_t mt_blksiz1; /* blocksize for mode 1 */ 179871c940bSSergey Kandaurov int32_t mt_blksiz2; /* blocksize for mode 2 */ 180871c940bSSergey Kandaurov int32_t mt_blksiz3; /* blocksize for mode 3 */ 181871c940bSSergey Kandaurov int32_t mt_density0; /* density for mode 0 */ 182871c940bSSergey Kandaurov int32_t mt_density1; /* density for mode 1 */ 183871c940bSSergey Kandaurov int32_t mt_density2; /* density for mode 2 */ 184871c940bSSergey Kandaurov int32_t mt_density3; /* density for mode 3 */ 185c2466934SMike Pritchard/* the following are not yet implemented */ 1866b99842aSEd Schouten uint32_t mt_comp0; /* compression type for mode 0 */ 1876b99842aSEd Schouten uint32_t mt_comp1; /* compression type for mode 1 */ 1886b99842aSEd Schouten uint32_t mt_comp2; /* compression type for mode 2 */ 1896b99842aSEd Schouten uint32_t mt_comp3; /* compression type for mode 3 */ 1900a36ae36SMatt Jacob/* end not yet implemented */ 191c2466934SMike Pritchard#endif 192871c940bSSergey Kandaurov int32_t mt_fileno; /* relative file number of current position */ 193871c940bSSergey Kandaurov int32_t mt_blkno; /* relative block number of current position */ 194c2466934SMike Pritchard}; 195c2466934SMike Pritchard 1960a36ae36SMatt Jacob/* structure for MTIOCERRSTAT - tape get error status command */ 1970a36ae36SMatt Jacob/* really only supported for SCSI tapes right now */ 1980a36ae36SMatt Jacobstruct scsi_tape_errors { 1990a36ae36SMatt Jacob /* 2000a36ae36SMatt Jacob * These are latched from the last command that had a SCSI 2010a36ae36SMatt Jacob * Check Condition noted for these operations. The act 2020a36ae36SMatt Jacob * of issuing an MTIOCERRSTAT unlatches and clears them. 2030a36ae36SMatt Jacob */ 2046b99842aSEd Schouten uint8_t io_sense[32]; /* Last Sense Data For Data I/O */ 205871c940bSSergey Kandaurov int32_t io_resid; /* residual count from last Data I/O */ 2066b99842aSEd Schouten uint8_t io_cdb[16]; /* Command that Caused the Last Data Sense */ 2076b99842aSEd Schouten uint8_t ctl_sense[32]; /* Last Sense Data For Control I/O */ 208871c940bSSergey Kandaurov int32_t ctl_resid; /* residual count from last Control I/O */ 2096b99842aSEd Schouten uint8_t ctl_cdb[16]; /* Command that Caused the Last Control Sense */ 2100a36ae36SMatt Jacob /* 2110a36ae36SMatt Jacob * These are the read and write cumulative error counters. 2120a36ae36SMatt Jacob * (how to reset cumulative error counters is not yet defined). 2130a36ae36SMatt Jacob * (not implemented as yet but space is being reserved for them) 2140a36ae36SMatt Jacob */ 2150a36ae36SMatt Jacob struct { 2166b99842aSEd Schouten uint32_t retries; /* total # retries performed */ 2176b99842aSEd Schouten uint32_t corrected; /* total # corrections performed */ 2186b99842aSEd Schouten uint32_t processed; /* total # corrections successful */ 2196b99842aSEd Schouten uint32_t failures; /* total # corrections/retries failed */ 2206b99842aSEd Schouten uint64_t nbytes; /* total # bytes processed */ 2210a36ae36SMatt Jacob } wterr, rderr; 2220a36ae36SMatt Jacob}; 2230a36ae36SMatt Jacob 2240a36ae36SMatt Jacobunion mterrstat { 2250a36ae36SMatt Jacob struct scsi_tape_errors scsi_errstat; 2260a36ae36SMatt Jacob char _reserved_padding[256]; 2270a36ae36SMatt Jacob}; 228f5ead386SBruce Evans 229*43518607SKenneth D. Merrystruct mtrblim { 230*43518607SKenneth D. Merry uint32_t granularity; 231*43518607SKenneth D. Merry uint32_t min_block_length; 232*43518607SKenneth D. Merry uint32_t max_block_length; 233*43518607SKenneth D. Merry}; 234*43518607SKenneth D. Merry 235*43518607SKenneth D. Merrytypedef enum { 236*43518607SKenneth D. Merry MT_LOCATE_DEST_OBJECT = 0x00, 237*43518607SKenneth D. Merry MT_LOCATE_DEST_FILE = 0x01, 238*43518607SKenneth D. Merry MT_LOCATE_DEST_SET = 0x02, 239*43518607SKenneth D. Merry MT_LOCATE_DEST_EOD = 0x03 240*43518607SKenneth D. Merry} mt_locate_dest_type; 241*43518607SKenneth D. Merry 242*43518607SKenneth D. Merrytypedef enum { 243*43518607SKenneth D. Merry MT_LOCATE_BAM_IMPLICIT = 0x00, 244*43518607SKenneth D. Merry MT_LOCATE_BAM_EXPLICIT = 0x01 245*43518607SKenneth D. Merry} mt_locate_bam; 246*43518607SKenneth D. Merry 247*43518607SKenneth D. Merrytypedef enum { 248*43518607SKenneth D. Merry MT_LOCATE_FLAG_IMMED = 0x01, 249*43518607SKenneth D. Merry MT_LOCATE_FLAG_CHANGE_PART = 0x02 250*43518607SKenneth D. Merry} mt_locate_flags; 251*43518607SKenneth D. Merry 252*43518607SKenneth D. Merrystruct mtlocate { 253*43518607SKenneth D. Merry mt_locate_flags flags; 254*43518607SKenneth D. Merry mt_locate_dest_type dest_type; 255*43518607SKenneth D. Merry mt_locate_bam block_address_mode; 256*43518607SKenneth D. Merry int64_t partition; 257*43518607SKenneth D. Merry uint64_t logical_id; 258*43518607SKenneth D. Merry uint8_t reserved[64]; 259*43518607SKenneth D. Merry}; 260*43518607SKenneth D. Merry 261*43518607SKenneth D. Merrytypedef enum { 262*43518607SKenneth D. Merry MT_EXT_GET_NONE, 263*43518607SKenneth D. Merry MT_EXT_GET_OK, 264*43518607SKenneth D. Merry MT_EXT_GET_NEED_MORE_SPACE, 265*43518607SKenneth D. Merry MT_EXT_GET_ERROR 266*43518607SKenneth D. Merry} mt_ext_get_status; 267*43518607SKenneth D. Merry 268*43518607SKenneth D. Merrystruct mtextget { 269*43518607SKenneth D. Merry uint32_t alloc_len; 270*43518607SKenneth D. Merry char *status_xml; 271*43518607SKenneth D. Merry uint32_t fill_len; 272*43518607SKenneth D. Merry mt_ext_get_status status; 273*43518607SKenneth D. Merry char error_str[128]; 274*43518607SKenneth D. Merry uint8_t reserved[64]; 275*43518607SKenneth D. Merry}; 276*43518607SKenneth D. Merry 277*43518607SKenneth D. Merry#define MT_EXT_GET_ROOT_NAME "mtextget" 278*43518607SKenneth D. Merry#define MT_DENSITY_ROOT_NAME "mtdensity" 279*43518607SKenneth D. Merry#define MT_MEDIA_DENSITY_NAME "media_density" 280*43518607SKenneth D. Merry#define MT_DENSITY_REPORT_NAME "density_report" 281*43518607SKenneth D. Merry#define MT_MEDIUM_TYPE_REPORT_NAME "medium_type_report" 282*43518607SKenneth D. Merry#define MT_MEDIA_REPORT_NAME "media_report" 283*43518607SKenneth D. Merry#define MT_DENSITY_ENTRY_NAME "density_entry" 284*43518607SKenneth D. Merry 285*43518607SKenneth D. Merry#define MT_DENS_WRITE_OK 0x80 286*43518607SKenneth D. Merry#define MT_DENS_DUP 0x40 287*43518607SKenneth D. Merry#define MT_DENS_DEFLT 0x20 288*43518607SKenneth D. Merry 289*43518607SKenneth D. Merry 290*43518607SKenneth D. Merry#define MT_PARAM_FIXED_STR_LEN 32 291*43518607SKenneth D. Merryunion mt_param_value { 292*43518607SKenneth D. Merry int64_t value_signed; 293*43518607SKenneth D. Merry uint64_t value_unsigned; 294*43518607SKenneth D. Merry char *value_var_str; 295*43518607SKenneth D. Merry char value_fixed_str[MT_PARAM_FIXED_STR_LEN]; 296*43518607SKenneth D. Merry uint8_t reserved[64]; 297*43518607SKenneth D. Merry}; 298*43518607SKenneth D. Merry 299*43518607SKenneth D. Merrytypedef enum { 300*43518607SKenneth D. Merry MT_PARAM_SET_NONE, 301*43518607SKenneth D. Merry MT_PARAM_SET_SIGNED, 302*43518607SKenneth D. Merry MT_PARAM_SET_UNSIGNED, 303*43518607SKenneth D. Merry MT_PARAM_SET_VAR_STR, 304*43518607SKenneth D. Merry MT_PARAM_SET_FIXED_STR 305*43518607SKenneth D. Merry} mt_param_set_type; 306*43518607SKenneth D. Merry 307*43518607SKenneth D. Merrytypedef enum { 308*43518607SKenneth D. Merry MT_PARAM_STATUS_NONE, 309*43518607SKenneth D. Merry MT_PARAM_STATUS_OK, 310*43518607SKenneth D. Merry MT_PARAM_STATUS_ERROR 311*43518607SKenneth D. Merry} mt_param_set_status; 312*43518607SKenneth D. Merry 313*43518607SKenneth D. Merry#define MT_PARAM_VALUE_NAME_LEN 64 314*43518607SKenneth D. Merrystruct mtparamset { 315*43518607SKenneth D. Merry char value_name[MT_PARAM_VALUE_NAME_LEN]; 316*43518607SKenneth D. Merry mt_param_set_type value_type; 317*43518607SKenneth D. Merry int value_len; 318*43518607SKenneth D. Merry union mt_param_value value; 319*43518607SKenneth D. Merry mt_param_set_status status; 320*43518607SKenneth D. Merry char error_str[128]; 321*43518607SKenneth D. Merry}; 322*43518607SKenneth D. Merry 323*43518607SKenneth D. Merry#define MT_PARAM_ROOT_NAME "mtparamget" 324*43518607SKenneth D. Merry#define MT_PROTECTION_NAME "protection" 325*43518607SKenneth D. Merry 326*43518607SKenneth D. Merry/* 327*43518607SKenneth D. Merry * Set a list of parameters. 328*43518607SKenneth D. Merry */ 329*43518607SKenneth D. Merrystruct mtsetlist { 330*43518607SKenneth D. Merry int num_params; 331*43518607SKenneth D. Merry int param_len; 332*43518607SKenneth D. Merry struct mtparamset *params; 333*43518607SKenneth D. Merry}; 334*43518607SKenneth D. Merry 335c2466934SMike Pritchard/* 336c2466934SMike Pritchard * Constants for mt_type byte. These are the same 337c2466934SMike Pritchard * for controllers compatible with the types listed. 338c2466934SMike Pritchard */ 339c2466934SMike Pritchard#define MT_ISTS 0x01 /* TS-11 */ 340c2466934SMike Pritchard#define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */ 341c2466934SMike Pritchard#define MT_ISTM 0x03 /* TM11/TE10 Unibus */ 342c2466934SMike Pritchard#define MT_ISMT 0x04 /* TM78/TU78 Massbus */ 343c2466934SMike Pritchard#define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */ 344c2466934SMike Pritchard#define MT_ISCPC 0x06 /* SUN */ 345c2466934SMike Pritchard#define MT_ISAR 0x07 /* SUN */ 346c2466934SMike Pritchard#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */ 347c2466934SMike Pritchard#define MT_ISCY 0x09 /* CCI Cipher */ 348c2466934SMike Pritchard#define MT_ISCT 0x0a /* HP 1/4 tape */ 349c2466934SMike Pritchard#define MT_ISFHP 0x0b /* HP 7980 1/2 tape */ 350c2466934SMike Pritchard#define MT_ISEXABYTE 0x0c /* Exabyte */ 351c2466934SMike Pritchard#define MT_ISEXA8200 0x0c /* Exabyte EXB-8200 */ 352c2466934SMike Pritchard#define MT_ISEXA8500 0x0d /* Exabyte EXB-8500 */ 353c2466934SMike Pritchard#define MT_ISVIPER1 0x0e /* Archive Viper-150 */ 354c2466934SMike Pritchard#define MT_ISPYTHON 0x0f /* Archive Python (DAT) */ 355c2466934SMike Pritchard#define MT_ISHPDAT 0x10 /* HP 35450A DAT drive */ 356c2466934SMike Pritchard#define MT_ISMFOUR 0x11 /* M4 Data 1/2 9track drive */ 357c2466934SMike Pritchard#define MT_ISTK50 0x12 /* DEC SCSI TK50 */ 358c2466934SMike Pritchard#define MT_ISMT02 0x13 /* Emulex MT02 SCSI tape controller */ 359c2466934SMike Pritchard 360c2466934SMike Pritchard/* mag tape io control commands */ 361c2466934SMike Pritchard#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ 362c2466934SMike Pritchard#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ 3630a36ae36SMatt Jacob/* these two do not appear to be used anywhere */ 364c2466934SMike Pritchard#define MTIOCIEOT _IO('m', 3) /* ignore EOT error */ 365c2466934SMike Pritchard#define MTIOCEEOT _IO('m', 4) /* enable EOT error */ 3660a36ae36SMatt Jacob/* 3670a36ae36SMatt Jacob * When more SCSI-3 SSC (streaming device) devices are out there 3680a36ae36SMatt Jacob * that support the full 32 byte type 2 structure, we'll have to 3690a36ae36SMatt Jacob * rethink these ioctls to support all the entities they haul into 3700a36ae36SMatt Jacob * the picture (64 bit blocks, logical file record numbers, etc..). 3710a36ae36SMatt Jacob */ 3726b99842aSEd Schouten#define MTIOCRDSPOS _IOR('m', 5, uint32_t) /* get logical blk addr */ 3736b99842aSEd Schouten#define MTIOCRDHPOS _IOR('m', 6, uint32_t) /* get hardware blk addr */ 3746b99842aSEd Schouten#define MTIOCSLOCATE _IOW('m', 5, uint32_t) /* seek to logical blk addr */ 3756b99842aSEd Schouten#define MTIOCHLOCATE _IOW('m', 6, uint32_t) /* seek to hardware blk addr */ 3760a36ae36SMatt Jacob#define MTIOCERRSTAT _IOR('m', 7, union mterrstat) /* get tape errors */ 377f5ead386SBruce Evans/* 378f5ead386SBruce Evans * Set EOT model- argument is number of filemarks to end a tape with. 379f5ead386SBruce Evans * Note that not all possible values will be accepted. 380f5ead386SBruce Evans */ 3816b99842aSEd Schouten#define MTIOCSETEOTMODEL _IOW('m', 8, uint32_t) 382f5ead386SBruce Evans/* Get current EOT model */ 3836b99842aSEd Schouten#define MTIOCGETEOTMODEL _IOR('m', 8, uint32_t) 384*43518607SKenneth D. Merry#define MTIOCRBLIM _IOR('m', 9, struct mtrblim) /* get block limits */ 385*43518607SKenneth D. Merry#define MTIOCEXTLOCATE _IOW('m', 10, struct mtlocate) /* seek to position */ 386*43518607SKenneth D. Merry#define MTIOCEXTGET _IOWR('m', 11, struct mtextget) /* get tape status */ 387*43518607SKenneth D. Merry#define MTIOCPARAMGET _IOWR('m', 12, struct mtextget) /* get tape params */ 388*43518607SKenneth D. Merry#define MTIOCPARAMSET _IOWR('m', 13, struct mtparamset) /* set tape params */ 389*43518607SKenneth D. Merry#define MTIOCSETLIST _IOWR('m', 14, struct mtsetlist) /* set N params */ 390c2466934SMike Pritchard 391f5ead386SBruce Evans#ifndef _KERNEL 392095a0a15SPeter Pentchev#define DEFTAPE "/dev/nsa0" 393c2466934SMike Pritchard#endif 394c2466934SMike Pritchard 395f5ead386SBruce Evans#endif /* !_SYS_MTIO_H_ */ 396c2466934SMike Pritchard.Ed 397c2466934SMike Pritchard.Sh FILES 398*43518607SKenneth D. Merry.Bl -tag -width /dev/[en]sa* -compact 399*43518607SKenneth D. Merry.It Pa /dev/[en]sa* 400c2466934SMike Pritchard.El 401c2466934SMike Pritchard.Sh SEE ALSO 402c2466934SMike Pritchard.Xr mt 1 , 403c2466934SMike Pritchard.Xr tar 1 , 404d08c353bSNeil Blakey-Milner.Xr sa 4 405c2466934SMike Pritchard.Sh HISTORY 406c2466934SMike PritchardThe 4074b66483fSRuslan Ermilov.Nm 408c2466934SMike Pritchardmanual appeared in 409c2466934SMike Pritchard.Bx 4.2 . 410400d45a3SMike PritchardAn i386 version first appeared in 411400d45a3SMike Pritchard.Fx 2.2 . 412