"Fossies" - the Fresh Open Source Software Archive

Member "usr/include/cygwin/mtio.h" (19 Aug 2019, 12643 Bytes) of package /windows/misc/cygwin-20190819-x86_64.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* cygwin/mtio.h
    2 
    3    Written by Corinna Vinschen <corinna@vinschen.de>
    4 
    5 This file is part of Cygwin.
    6 
    7 This software is a copyrighted work licensed under the terms of the
    8 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
    9 details. */
   10 
   11 /* cygwin/mtio.h header file for Cygwin.
   12 
   13    by C. Vinschen.  */
   14 
   15 #ifndef _CYGWIN_MTIO_H
   16 #define _CYGWIN_MTIO_H
   17 
   18 #include <sys/ioctl.h>
   19 #include <asm/socket.h>
   20 
   21 #ifndef DEFTAPE
   22 #define DEFTAPE "/dev/tape"
   23 #endif
   24 
   25 /*
   26  * Structures and definitions for mag tape io control commands
   27  */
   28 
   29 /* structure for MTIOCTOP - mag tape op command */
   30 struct  mtop {
   31     short   mt_op;      /* operations defined below */
   32     int mt_count;   /* how many of them */
   33 };
   34 
   35 /* Magnetic Tape operations [Not all operations supported by all drivers]: */
   36 #define MTRESET 0   /* reset drive in case of problems */
   37 #define MTFSF   1   /* forward space over FileMark,
   38              * position at first record of next file
   39              */
   40 #define MTBSF   2   /* backward space FileMark (position before FM) */
   41 #define MTFSR   3   /* forward space record */
   42 #define MTBSR   4   /* backward space record */
   43 #define MTWEOF  5   /* write an end-of-file record (mark) */
   44 #define MTREW   6   /* rewind */
   45 #define MTOFFL  7   /* rewind and put the drive offline (eject?) */
   46 #define MTNOP   8   /* no op, set status only (read with MTIOCGET) */
   47 #define MTRETEN 9   /* retension tape */
   48 #define MTBSFM  10  /* +backward space FileMark, position at FM */
   49 #define MTFSFM  11  /* +forward space FileMark, position at FM */
   50 #define MTEOM   12  /* goto end of recorded media (for appending files).
   51              * MTEOM positions after the last FM, ready for
   52              * appending another file.
   53              */
   54 #define MTERASE 13  /* erase tape -- be careful! */
   55 
   56 #define MTRAS1  14  /* run self test 1 (nondestructive) */
   57 #define MTRAS2  15  /* run self test 2 (destructive) */
   58 #define MTRAS3  16  /* reserved for self test 3 */
   59 
   60 #define MTSETBLK 20 /* set block length (SCSI) */
   61 #define MTSETDENSITY 21 /* set tape density (SCSI) */
   62 #define MTSEEK  22  /* seek to block (Tandberg, etc.) */
   63 #define MTTELL  23  /* tell block (Tandberg, etc.) */
   64 #define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */
   65             /* ordinary buffered operation with code 1 */
   66 #define MTFSS   25  /* space forward over setmarks */
   67 #define MTBSS   26  /* space backward over setmarks */
   68 #define MTWSM   27  /* write setmarks */
   69 
   70 #define MTLOCK  28  /* lock the drive door */
   71 #define MTUNLOCK 29 /* unlock the drive door */
   72 #define MTLOAD  30  /* execute the SCSI load command */
   73 #define MTUNLOAD 31 /* execute the SCSI unload command */
   74 #define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */
   75 #define MTSETPART 33    /* Change the active tape partition */
   76 #define MTMKPART  34    /* Format the tape with one or two partitions */
   77 
   78 /* structure for MTIOCGET - mag tape get status command */
   79 
   80 struct  mtget {
   81     long    mt_type;    /* type of magtape device */
   82     long    mt_resid;   /* residual count: (not sure)
   83                  *  number of bytes ignored, or
   84                  *  number of files not skipped, or
   85                  *  number of records not skipped.
   86                  *  Cygwin:
   87                  *      remaining KB until 1.5.7.
   88                  *      active partition until 1.7.24.
   89                  *      active partition in low 16 bits,
   90                  *      number of partitions on this tape
   91                  *      in next 16 bits, since 1.7.25.
   92                  */
   93     /* the following registers are device dependent */
   94     long    mt_dsreg;   /* status register, Contains blocksize and
   95                    density code.  See MT_ST_xxx macros below */
   96     long    mt_gstat;   /* generic (device independent) status */
   97     long    mt_erreg;   /* error register */
   98     /* The next two fields are not always used */
   99     long    mt_fileno;  /* number of current file on tape */
  100     long    mt_blkno;   /* current block number */
  101     /* The next are Windows NT specific */
  102     long long   mt_capacity;    /* Tape capacity in bytes */
  103     long long   mt_remaining;   /* Remaining bytes */
  104     int     mt_minblksize;
  105     int     mt_maxblksize;
  106     int     mt_defblksize;
  107     unsigned long   mt_featureslow;
  108     unsigned long   mt_featureshigh;
  109     unsigned long   mt_eotwarningzonesize;
  110 };
  111 
  112 /* structure for MTIOCPOS - mag tape get position command */
  113 
  114 struct  mtpos {
  115     long    mt_blkno;   /* current block number */
  116 };
  117 
  118 
  119 /* mag tape io control commands */
  120 #define MTIOCTOP    _IOW('m', 1, struct mtop)   /* do a mag tape op */
  121 #define MTIOCGET    _IOR('m', 2, struct mtget)  /* get tape status */
  122 #define MTIOCPOS    _IOR('m', 3, struct mtpos)  /* get tape position */
  123 
  124 /* Generic Mag Tape (device independent) status macros for examining
  125  * mt_gstat -- HP-UX compatible.
  126  * There is room for more generic status bits here, but I don't
  127  * know which of them are reserved. At least three or so should
  128  * be added to make this really useful.
  129  */
  130 #define GMT_EOF(x)              ((x) & 0x80000000)
  131 #define GMT_BOT(x)              ((x) & 0x40000000)
  132 #define GMT_EOT(x)              ((x) & 0x20000000)
  133 #define GMT_SM(x)               ((x) & 0x10000000)  /* DDS setmark */
  134 #define GMT_EOD(x)              ((x) & 0x08000000)  /* DDS EOD */
  135 #define GMT_WR_PROT(x)          ((x) & 0x04000000)
  136 #define GMT_REP_SM(x)           ((x) & 0x02000000)  /* Cygwin: rep. setmarks */
  137 #define GMT_ONLINE(x)           ((x) & 0x01000000)
  138 #define GMT_D_6250(x)           ((x) & 0x00800000)
  139 #define GMT_D_1600(x)           ((x) & 0x00400000)
  140 #define GMT_D_800(x)            ((x) & 0x00200000)
  141 #define GMT_PADDING(x)          ((x) & 0x00100000)  /* Cygwin: data padding */
  142 #define GMT_HW_ECC(x)           ((x) & 0x00080000)  /* Cygwin: HW error corr. */
  143 #define GMT_DR_OPEN(x)          ((x) & 0x00040000)  /* door open (no tape) */
  144 #define GMT_HW_COMP(x)          ((x) & 0x00020000)  /* Cygwin: HW compression */
  145 #define GMT_IM_REP_EN(x)        ((x) & 0x00010000)  /* immediate report mode */
  146 #define GMT_CLN(x)              ((x) & 0x00008000)  /* cleaning requested */
  147 /* 15 generic status bits unused */
  148 /* Cygwin only: The below settings are also used by the GNU-Linux SCSI tape
  149    driver but they aren't usually reported here.  Unfortunately, there's no
  150    other official method to retrieve the values of these settings and
  151    reporting them here apparently doesn't hurt. */
  152 #define GMT_TWO_FM(x)           ((x) & 0x00000080)  /* two fm after write */
  153 #define GMT_FAST_MTEOM(x)       ((x) & 0x00000040)  /* fast seek to eom */
  154 #define GMT_AUTO_LOCK(x)        ((x) & 0x00000020)  /* auto door lock on r/w */
  155 #define GMT_SYSV(x)     ((x) & 0x00000010)  /* SYSV read semantics */
  156 #define GMT_NOWAIT(x)       ((x) & 0x00000008)  /* don't wait for positioning commands */
  157 #define GMT_ASYNC(x)        ((x) & 0x00000004)  /* asynchronous writes */
  158 
  159 
  160 /* SCSI-tape specific definitions */
  161 /* Bitfield shifts in the status mt_dsreg */
  162 #define MT_ST_BLKSIZE_SHIFT 0
  163 #define MT_ST_BLKSIZE_MASK  0xffffff
  164 #define MT_ST_DENSITY_SHIFT 24
  165 #define MT_ST_DENSITY_MASK  0xff000000
  166 
  167 #define MT_ST_SOFTERR_SHIFT 0
  168 #define MT_ST_SOFTERR_MASK  0xffff
  169 
  170 /* Bitfields for the MTSETDRVBUFFER ioctl.  */
  171 #define MT_ST_OPTIONS           0xf0000000
  172 #define MT_ST_BOOLEANS          0x10000000
  173 #define MT_ST_SETBOOLEANS       0x30000000
  174 #define MT_ST_CLEARBOOLEANS     0x40000000
  175 #define MT_ST_WRITE_THRESHOLD   0x20000000  /* Not supported */
  176 #define MT_ST_DEF_OPTIONS       0x60000000  /* Not supported */
  177 #define MT_ST_EOT_WZ_SIZE   0xf0000000  /* Cygwin only */
  178 
  179 #define MT_ST_BUFFER_WRITES     0x00000001
  180 #define MT_ST_ASYNC_WRITES  0x00000002
  181 #define MT_ST_READ_AHEAD        0x00000004  /* Not supported */
  182 #define MT_ST_DEBUGGING         0x00000008  /* Not supported */
  183 #define MT_ST_TWO_FM        0x00000010
  184 #define MT_ST_FAST_MTEOM        0x00000020
  185 #define MT_ST_AUTO_LOCK     0x00000040
  186 #define MT_ST_DEF_WRITES        0x00000080  /* Not supported */
  187 #define MT_ST_CAN_BSR           0x00000100  /* Not supported */
  188 #define MT_ST_NO_BLKLIMS        0x00000200  /* Not supported */
  189 #define MT_ST_CAN_PARTITIONS    0x00000400  /* Not supported */
  190 #define MT_ST_SCSI2LOGICAL      0x00000800  /* Not supported */
  191 #define MT_ST_SYSV              0x00001000
  192 #define MT_ST_NOWAIT            0x00002000
  193 #define MT_ST_ECC       0x00010000  /* Cygwin only */
  194 #define MT_ST_PADDING       0x00020000  /* Cygwin only */
  195 #define MT_ST_REPORT_SM     0x00040000  /* Cygwin only */
  196 
  197 /*
  198  * Constants for mt_type. Not all of these are supported,
  199  * and these are not all of the ones that are supported.
  200  *
  201  * Only used when not colliding with Windows codes (see below)
  202  */
  203 #define MT_ISUNKNOWN        0x01
  204 #define MT_ISQIC02      0x02    /* Generic QIC-02 tape streamer */
  205 #define MT_ISWT5150     0x03    /* Wangtek 5150EQ, QIC-150, QIC-02 */
  206 #define MT_ISARCHIVE_5945L2 0x04    /* Archive 5945L-2, QIC-24, QIC-02? */
  207 #define MT_ISCMSJ500        0x05    /* CMS Jumbo 500 (QIC-02?) */
  208 #define MT_ISTDC3610        0x06    /* Tandberg 6310, QIC-24 */
  209 #define MT_ISARCHIVE_VP60I  0x07    /* Archive VP60i, QIC-02 */
  210 #define MT_ISARCHIVE_2150L  0x08    /* Archive Viper 2150L */
  211 #define MT_ISARCHIVE_2060L  0x09    /* Archive Viper 2060L */
  212 #define MT_ISARCHIVESC499   0x0A    /* Archive SC-499 QIC-36 controller */
  213 #define MT_ISQIC02_ALL_FEATURES 0x0F    /* Generic QIC-02 with all features */
  214 #define MT_ISWT5099EEN24    0x11    /* Wangtek 5099-een24, 60MB, QIC-24 */
  215 #define MT_ISTEAC_MT2ST     0x12    /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */
  216 #define MT_ISEVEREX_FT40A   0x32    /* Everex FT40A (QIC-40) */
  217 #define MT_ISDDS1       0x51    /* DDS device without partitions */
  218 #define MT_ISDDS2       0x52    /* DDS device with partitions */
  219 #define MT_ISSCSI1      0x71    /* Generic ANSI SCSI-1 tape unit */
  220 #define MT_ISSCSI2      0x72    /* Generic ANSI SCSI-2 tape unit */
  221 
  222 /* More constants for mt_type.  These are the codes used by Windows >= 5.1 */
  223 #define MT_ISDDS_4mm        0x20
  224 #define MT_ISMiniQic        0x21
  225 #define MT_ISTravan         0x22
  226 #define MT_ISQIC        0x23
  227 #define MT_ISMP_8mm         0x24
  228 #define MT_ISAME_8mm        0x25
  229 #define MT_ISAIT1_8mm       0x26
  230 #define MT_ISDLT        0x27
  231 #define MT_ISNCTP       0x28
  232 #define MT_ISIBM_3480       0x29
  233 #define MT_ISIBM_3490E      0x2a
  234 #define MT_ISIBM_Magstar_3590   0x2b
  235 #define MT_ISIBM_Magstar_MP     0x2c
  236 #define MT_ISSTK_DATA_D3    0x2d
  237 #define MT_ISSONY_DTF       0x2e
  238 #define MT_ISDV_6mm         0x2f
  239 #define MT_ISDMI        0x30
  240 #define MT_ISSONY_D2        0x31
  241 #define MT_ISCLEANER_CARTRIDGE  0x32
  242 #define MT_ISAVATAR_F2      0x4f
  243 #define MT_ISMP2_8mm        0x50
  244 #define MT_ISDST_S      0x51
  245 #define MT_ISDST_M      0x52
  246 #define MT_ISDST_L      0x53
  247 #define MT_ISVXATape_1      0x54
  248 #define MT_ISVXATape_2      0x55
  249 #define MT_ISSTK_9840       0x56
  250 #define MT_ISLTO_Ultrium    0x57
  251 #define MT_ISLTO_Accelis    0x58
  252 #define MT_ISAIT_8mm        0x5a
  253 #define MT_ISADR_1      0x5b
  254 #define MT_ISADR_2      0x5c
  255 #define MT_ISSTK_9940       0x5d
  256 
  257 struct mt_tape_info {
  258     long t_type;        /* device type id (mt_type) */
  259     char *t_name;       /* descriptive name */
  260 };
  261 
  262 #define MT_TAPE_INFO    { \
  263     {MT_ISUNKNOWN,      "Unknown type of tape device"}, \
  264     {MT_ISQIC02,        "Generic QIC-02 tape streamer"}, \
  265     {MT_ISWT5150,       "Wangtek 5150, QIC-150"}, \
  266     {MT_ISARCHIVE_5945L2,   "Archive 5945L-2"}, \
  267     {MT_ISCMSJ500,      "CMS Jumbo 500"}, \
  268     {MT_ISTDC3610,      "Tandberg TDC 3610, QIC-24"}, \
  269     {MT_ISARCHIVE_VP60I,    "Archive VP60i, QIC-02"}, \
  270     {MT_ISARCHIVE_2150L,    "Archive Viper 2150L"}, \
  271     {MT_ISARCHIVE_2060L,    "Archive Viper 2060L"}, \
  272     {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \
  273     {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \
  274     {MT_ISWT5099EEN24,  "Wangtek 5099-een24, 60MB"}, \
  275     {MT_ISTEAC_MT2ST,   "Teac MT-2ST 155mb data cassette drive"}, \
  276     {MT_ISDDS_4mm,      "DDS"}, \
  277     {MT_ISMiniQic,      "MiniQic"}, \
  278     {MT_ISTravan,       "Travan tape"}, \
  279     {MT_ISQIC,      "QIC tape"}, \
  280     {MT_ISMP_8mm,       "8mm Exabyte metal particle tape"}, \
  281     {MT_ISAME_8mm,      "8mm Exabyte advanced metal evap tape"}, \
  282     {MT_ISAIT1_8mm,     "8mm Sony AIT1 tape"}, \
  283     {MT_ISDLT,      "DLT compact tape)"}, \
  284     {MT_ISNCTP,     "Philips NCTP tape"}, \
  285     {MT_ISIBM_3480,     "IBM 3480 tape"}, \
  286     {MT_ISIBM_3490E,    "IBM 3490E tape"}, \
  287     {MT_ISIBM_Magstar_3590, "IBM Magstar 3590 tape"}, \
  288     {MT_ISIBM_Magstar_MP,   "IBM Magstar MP tape"}, \
  289     {MT_ISSTK_DATA_D3,  "STK data D3 tape"}, \
  290     {MT_ISSONY_DTF,     "Sony DTF tape"}, \
  291     {MT_ISDV_6mm,       "6mm digital video tape"}, \
  292     {MT_ISDMI,      "Exabyte DMI tape"}, \
  293     {MT_ISSONY_D2,      "Sony D2S or D2L tape"}, \
  294     {MT_ISCLEANER_CARTRIDGE, "Cleaner (all drive types that support cleaners)"}, \
  295     {MT_ISAVATAR_F2,    "Avatar 2"}, \
  296     {MT_ISMP2_8mm,      "8mm Hitachi tape"}, \
  297     {MT_ISDST_S,        "Ampex DST small tape"}, \
  298     {MT_ISDST_M,        "Ampex DST medium tape"}, \
  299     {MT_ISDST_L,        "Ampex DST large tape"}, \
  300     {MT_ISVXATape_1,    "Ecrix 8mm tape"}, \
  301     {MT_ISVXATape_2,    "Ecrix 8mm tape"}, \
  302     {MT_ISSTK_9840,     "STK 9840"}, \
  303     {MT_ISLTO_Ultrium,  "LTO Ultrium (IBM, HP, Seagate)"}, \
  304     {MT_ISLTO_Accelis,  "LTO Accelis (IBM, HP, Seagate)"}, \
  305     {MT_ISAIT_8mm,      "AIT tape (AIT2 or higher)"}, \
  306     {MT_ISADR_1,        "OnStream ADR1"}, \
  307     {MT_ISADR_2,        "OnStream ADR2"}, \
  308     {MT_ISSTK_9940,     "STK 9940"}, \
  309     {MT_ISSCSI1,        "Generic SCSI-1 tape"}, \
  310     {MT_ISSCSI2,        "Generic SCSI-2 tape"}, \
  311     {0, NULL} \
  312 }
  313 
  314 #endif /* _CYGWIN_MTIO_H */