The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/mtio.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1982, 1986, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. All advertising materials mentioning features or use of this software
   14  *    must display the following acknowledgement:
   15  *      This product includes software developed by the University of
   16  *      California, Berkeley and its contributors.
   17  * 4. Neither the name of the University nor the names of its contributors
   18  *    may be used to endorse or promote products derived from this software
   19  *    without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  *
   33  *      @(#)mtio.h      8.1 (Berkeley) 6/2/93
   34  * $FreeBSD: src/sys/sys/mtio.h,v 1.20.2.2 2001/01/22 18:02:47 mjacob Exp $
   35  * $DragonFly: src/sys/sys/mtio.h,v 1.4 2006/05/20 02:42:13 dillon Exp $
   36  */
   37 
   38 #ifndef _SYS_MTIO_H_
   39 #define _SYS_MTIO_H_
   40 
   41 #ifndef _SYS_TYPES_H_
   42 #include <sys/types.h>
   43 #endif
   44 #ifndef _SYS_IOCCOM_H_
   45 #include <sys/ioccom.h>
   46 #endif
   47 
   48 /*
   49  * Structures and definitions for mag tape io control commands
   50  */
   51 
   52 /* structure for MTIOCTOP - mag tape op command */
   53 struct mtop {
   54         short   mt_op;          /* operations defined below */
   55         daddr_t mt_count;       /* how many of them */
   56 };
   57 
   58 /* operations */
   59 #define MTWEOF          0       /* write an end-of-file record */
   60 #define MTFSF           1       /* forward space file */
   61 #define MTBSF           2       /* backward space file */
   62 #define MTFSR           3       /* forward space record */
   63 #define MTBSR           4       /* backward space record */
   64 #define MTREW           5       /* rewind */
   65 #define MTOFFL          6       /* rewind and put the drive offline */
   66 #define MTNOP           7       /* no operation, sets status only */
   67 #define MTCACHE         8       /* enable controller cache */
   68 #define MTNOCACHE       9       /* disable controller cache */
   69 
   70 #if defined(__DragonFly__)
   71 /* Set block size for device. If device is a variable size dev          */
   72 /* a non zero parameter will change the device to a fixed block size    */
   73 /* device with block size set to that of the parameter passed in.       */
   74 /* Resetting the block size to 0 will restore the device to a variable  */
   75 /* block size device. */
   76 
   77 #define MTSETBSIZ       10
   78 
   79 /* Set density values for device. Sets the value for the opened mode only. */
   80 
   81 #define MTSETDNSTY      11
   82 
   83 #define MTERASE         12      /* erase to EOM */
   84 #define MTEOD           13      /* Space to EOM */
   85 #define MTCOMP          14      /* select compression mode 0=off, 1=def */
   86 #define MTRETENS        15      /* re-tension tape */
   87 #define MTWSS           16      /* write setmark(s) */
   88 #define MTFSS           17      /* forward space setmark */
   89 #define MTBSS           18      /* backward space setmark */
   90 
   91 #define MT_COMP_ENABLE          0xffffffff
   92 #define MT_COMP_DISABLED        0xfffffffe
   93 #define MT_COMP_UNSUPP          0xfffffffd
   94 
   95 /*
   96  * Values in mt_dsreg that say what the device is doing
   97  */
   98 #define MTIO_DSREG_NIL  0       /* Unknown */
   99 #define MTIO_DSREG_REST 1       /* Doing Nothing */
  100 #define MTIO_DSREG_RBSY 2       /* Communicating with tape (but no motion) */
  101 #define MTIO_DSREG_WR   20      /* Writing */
  102 #define MTIO_DSREG_FMK  21      /* Writing Filemarks */
  103 #define MTIO_DSREG_ZER  22      /* Erasing */
  104 #define MTIO_DSREG_RD   30      /* Reading */
  105 #define MTIO_DSREG_FWD  40      /* Spacing Forward */
  106 #define MTIO_DSREG_REV  41      /* Spacing Reverse */
  107 #define MTIO_DSREG_POS  42      /* Hardware Positioning (direction unknown) */
  108 #define MTIO_DSREG_REW  43      /* Rewinding */
  109 #define MTIO_DSREG_TEN  44      /* Retensioning */
  110 #define MTIO_DSREG_UNL  45      /* Unloading */
  111 #define MTIO_DSREG_LD   46      /* Loading */
  112 
  113 #endif  /* __DragonFly__ */
  114 
  115 /* structure for MTIOCGET - mag tape get status command */
  116 
  117 struct mtget {
  118         short   mt_type;        /* type of magtape device */
  119 /* the following two registers are grossly device dependent */
  120         short   mt_dsreg;       /* ``drive status'' register */
  121         short   mt_erreg;       /* ``error'' register */
  122 /* end device-dependent registers */
  123         /*
  124          * Note that the residual count, while maintained, may be
  125          * be nonsense because the size of the residual may (greatly)
  126          * exceed 32 K-bytes. Use the MTIOCERRSTAT ioctl to get a
  127          * more accurate count.
  128          */
  129         short   mt_resid;       /* residual count */
  130 #if defined (__DragonFly__)
  131         daddr_t mt_blksiz;      /* presently operating blocksize */
  132         daddr_t mt_density;     /* presently operating density */
  133         u_int32_t mt_comp;      /* presently operating compression */
  134         daddr_t mt_blksiz0;     /* blocksize for mode 0 */
  135         daddr_t mt_blksiz1;     /* blocksize for mode 1 */
  136         daddr_t mt_blksiz2;     /* blocksize for mode 2 */
  137         daddr_t mt_blksiz3;     /* blocksize for mode 3 */
  138         daddr_t mt_density0;    /* density for mode 0 */
  139         daddr_t mt_density1;    /* density for mode 1 */
  140         daddr_t mt_density2;    /* density for mode 2 */
  141         daddr_t mt_density3;    /* density for mode 3 */
  142 /* the following are not yet implemented */
  143         u_int32_t mt_comp0;     /* compression type for mode 0 */
  144         u_int32_t mt_comp1;     /* compression type for mode 1 */
  145         u_int32_t mt_comp2;     /* compression type for mode 2 */
  146         u_int32_t mt_comp3;     /* compression type for mode 3 */
  147 /* end not yet implemented */
  148 #endif
  149         daddr_t mt_fileno;      /* relative file number of current position */
  150         daddr_t mt_blkno;       /* relative block number of current position */
  151 };
  152 
  153 /* structure for MTIOCERRSTAT - tape get error status command */
  154 /* really only supported for SCSI tapes right now */
  155 struct scsi_tape_errors {
  156         /*
  157          * These are latched from the last command that had a SCSI
  158          * Check Condition noted for these operations. The act
  159          * of issuing an MTIOCERRSTAT unlatches and clears them.
  160          */
  161         u_int8_t io_sense[32];  /* Last Sense Data For Data I/O */
  162         int32_t io_resid;       /* residual count from last Data I/O */
  163         u_int8_t io_cdb[16];    /* Command that Caused the Last Data Sense */
  164         u_int8_t ctl_sense[32]; /* Last Sense Data For Control I/O */
  165         int32_t ctl_resid;      /* residual count from last Control I/O */
  166         u_int8_t ctl_cdb[16];   /* Command that Caused the Last Control Sense */
  167         /*
  168          * These are the read and write cumulative error counters.
  169          * (how to reset cumulative error counters is not yet defined).
  170          * (not implemented as yet but space is being reserved for them)
  171          */
  172         struct {
  173                 u_int32_t retries;      /* total # retries performed */
  174                 u_int32_t corrected;    /* total # corrections performed */
  175                 u_int32_t processed;    /* total # corrections succssful */
  176                 u_int32_t failures;     /* total # corrections/retries failed */
  177                 u_int64_t nbytes;       /* total # bytes processed */
  178         } wterr, rderr;
  179 };
  180         
  181 union mterrstat {
  182         struct scsi_tape_errors scsi_errstat;
  183         char _reserved_padding[256];
  184 };
  185 
  186 /*
  187  * Constants for mt_type byte.  These are the same
  188  * for controllers compatible with the types listed.
  189  */
  190 #define MT_ISTS         0x01            /* TS-11 */
  191 #define MT_ISHT         0x02            /* TM03 Massbus: TE16, TU45, TU77 */
  192 #define MT_ISTM         0x03            /* TM11/TE10 Unibus */
  193 #define MT_ISMT         0x04            /* TM78/TU78 Massbus */
  194 #define MT_ISUT         0x05            /* SI TU-45 emulation on Unibus */
  195 #define MT_ISCPC        0x06            /* SUN */
  196 #define MT_ISAR         0x07            /* SUN */
  197 #define MT_ISTMSCP      0x08            /* DEC TMSCP protocol (TU81, TK50) */
  198 #define MT_ISCY         0x09            /* CCI Cipher */
  199 #define MT_ISCT         0x0a            /* HP 1/4 tape */
  200 #define MT_ISFHP        0x0b            /* HP 7980 1/2 tape */
  201 #define MT_ISEXABYTE    0x0c            /* Exabyte */
  202 #define MT_ISEXA8200    0x0c            /* Exabyte EXB-8200 */
  203 #define MT_ISEXA8500    0x0d            /* Exabyte EXB-8500 */
  204 #define MT_ISVIPER1     0x0e            /* Archive Viper-150 */
  205 #define MT_ISPYTHON     0x0f            /* Archive Python (DAT) */
  206 #define MT_ISHPDAT      0x10            /* HP 35450A DAT drive */
  207 #define MT_ISMFOUR      0x11            /* M4 Data 1/2 9track drive */
  208 #define MT_ISTK50       0x12            /* DEC SCSI TK50 */
  209 #define MT_ISMT02       0x13            /* Emulex MT02 SCSI tape controller */
  210 
  211 /* mag tape io control commands */
  212 #define MTIOCTOP        _IOW('m', 1, struct mtop)       /* do a mag tape op */
  213 #define MTIOCGET        _IOR('m', 2, struct mtget)      /* get tape status */
  214 /* these two do not appear to be used anywhere */
  215 #define MTIOCIEOT       _IO('m', 3)                     /* ignore EOT error */
  216 #define MTIOCEEOT       _IO('m', 4)                     /* enable EOT error */
  217 /*
  218  * When more SCSI-3 SSC (streaming device) devices are out there
  219  * that support the full 32 byte type 2 structure, we'll have to
  220  * rethink these ioctls to support all the entities they haul into
  221  * the picture (64 bit blocks, logical file record numbers, etc..).
  222  */
  223 #define MTIOCRDSPOS     _IOR('m', 5, u_int32_t) /* get logical blk addr */
  224 #define MTIOCRDHPOS     _IOR('m', 6, u_int32_t) /* get hardware blk addr */
  225 #define MTIOCSLOCATE    _IOW('m', 5, u_int32_t) /* seek to logical blk addr */
  226 #define MTIOCHLOCATE    _IOW('m', 6, u_int32_t) /* seek to hardware blk addr */
  227 #define MTIOCERRSTAT    _IOR('m', 7, union mterrstat)   /* get tape errors */
  228 /*
  229  * Set EOT model- argument is number of filemarks to end a tape with.
  230  * Note that not all possible values will be accepted.
  231  */
  232 #define MTIOCSETEOTMODEL        _IOW('m', 8, u_int32_t)
  233 /* Get current EOT model */
  234 #define MTIOCGETEOTMODEL        _IOR('m', 8, u_int32_t)
  235 
  236 #ifndef _KERNEL
  237 #define DEFTAPE "/dev/nsa0"
  238 #endif
  239 
  240 #ifdef  _KERNEL
  241 /*
  242  * minor device number
  243  */
  244 
  245 #define T_UNIT          003             /* unit selection */
  246 #define T_NOREWIND      004             /* no rewind on close */
  247 #define T_DENSEL        030             /* density select */
  248 #define T_800BPI        000             /* select  800 bpi */
  249 #define T_1600BPI       010             /* select 1600 bpi */
  250 #define T_6250BPI       020             /* select 6250 bpi */
  251 #define T_BADBPI        030             /* undefined selection */
  252 #endif
  253 
  254 #endif /* !_SYS_MTIO_H_ */

Cache object: 75fa3e9e072a0d1ddd0a456a1fbeeeda


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.