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/chio.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: chio.h,v 1.7 2006/05/31 03:01:44 beck Exp $   */
    2 /*      $NetBSD: chio.h,v 1.8 1996/04/03 00:25:21 thorpej Exp $ */
    3 
    4 /*
    5  * Copyright (c) 1996 Jason R. Thorpe <thorpej@and.com>
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgements:
   18  *      This product includes software developed by Jason R. Thorpe
   19  *      for And Communications, http://www.and.com/
   20  * 4. The name of the author may not be used to endorse or promote products
   21  *    derived from this software without specific prior written permission.
   22  *
   23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   26  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   30  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   31  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   33  * SUCH DAMAGE.
   34  */
   35 
   36 #ifndef _SYS_CHIO_H_
   37 #define _SYS_CHIO_H_
   38 
   39 /*
   40  * Element types.  Used as "to" and "from" type indicators in move
   41  * and exchange operations.
   42  *
   43  * Note that code in sys/scsi/ch.c relies on these values (uses them
   44  * as offsets in an array, and other evil), so don't muck with them
   45  * unless you know what you're doing.
   46  */
   47 #define CHET_MT         0       /* medium transport (picker) */
   48 #define CHET_ST         1       /* storage transport (slot) */
   49 #define CHET_IE         2       /* import/export (portal) */
   50 #define CHET_DT         3       /* data transfer (drive) */
   51 
   52 /*
   53  * Maximum length of a volume identification string
   54  */                                               
   55 #define CH_VOLTAG_MAXLEN 32
   56 
   57 /*
   58  * Structure used to execute a MOVE MEDIUM command.
   59  */
   60 struct changer_move {
   61         int     cm_fromtype;    /* element type to move from */
   62         int     cm_fromunit;    /* logical unit of from element */
   63         int     cm_totype;      /* element type to move to */
   64         int     cm_tounit;      /* logical unit of to element */
   65         int     cm_flags;       /* misc. flags */
   66 };
   67 
   68 /* cm_flags */
   69 #define CM_INVERT       0x01    /* invert media */
   70 
   71 /*
   72  * Structure used to execute an EXCHANGE MEDIUM command.  In an
   73  * exchange operation, the following steps occur:
   74  *
   75  *      - media from source is moved to first destination.
   76  *
   77  *      - media previously occupying first destination is moved
   78  *        to the second destination.
   79  *
   80  * The second destination may or may not be the same as the source.
   81  * In the case of a simple exchange, the source and second destination
   82  * are the same.
   83  */
   84 struct changer_exchange {
   85         int     ce_srctype;     /* element type of source */
   86         int     ce_srcunit;     /* logical unit of source */
   87         int     ce_fdsttype;    /* element type of first destination */
   88         int     ce_fdstunit;    /* logical unit of first destination */
   89         int     ce_sdsttype;    /* element type of second destination */
   90         int     ce_sdstunit;    /* logical unit of second destination */
   91         int     ce_flags;       /* misc. flags */
   92 };
   93 
   94 /* ce_flags */
   95 #define CE_INVERT1      0x01    /* invert media 1 */
   96 #define CE_INVERT2      0x02    /* invert media 2 */
   97 
   98 /*
   99  * Structure used to execute a POSITION TO ELEMENT command.  This
  100  * moves the current picker in front of the specified element.
  101  */
  102 struct changer_position {
  103         int     cp_type;        /* element type */
  104         int     cp_unit;        /* logical unit of element */
  105         int     cp_flags;       /* misc. flags */
  106 };
  107 
  108 /* cp_flags */
  109 #define CP_INVERT       0x01    /* invert picker */
  110 
  111 /*
  112  * Data returned by CHIOGPARAMS.
  113  */
  114 struct changer_params {
  115         int     cp_curpicker;   /* current picker */
  116         int     cp_npickers;    /* number of pickers */
  117         int     cp_nslots;      /* number of slots */
  118         int     cp_nportals;    /* number of import/export portals */
  119         int     cp_ndrives;     /* number of drives */
  120 };
  121 
  122 struct changer_voltag {
  123         u_char          cv_volid[CH_VOLTAG_MAXLEN + 1];
  124         u_int16_t       cv_serial;
  125 };
  126 
  127 struct changer_element_status {
  128         int                     ces_type;               /* element type */
  129         u_int8_t                ces_flags;              /* flags */
  130         struct changer_voltag   ces_pvoltag;            /* primary voltag */
  131         struct changer_voltag   ces_avoltag;            /* alternate voltag */
  132 };
  133 
  134 /*
  135  * Command used to get element status.
  136  */
  137 struct changer_element_status_request {
  138         int                             cesr_type;  /* element type */
  139         int                             cesr_flags;
  140 #define CESR_VOLTAGS 0x01       
  141 
  142         struct changer_element_status   *cesr_data; /* pre-allocated data storage */
  143 };
  144 
  145 /*
  146  * Data returned by CHIOGSTATUS is an array of flags bytes.
  147  * Not all flags have meaning for all element types.
  148  */
  149 #define CESTATUS_FULL           0x01    /* element is full */
  150 #define CESTATUS_IMPEXP         0x02    /* media deposited by operator */
  151 #define CESTATUS_EXCEPT         0x04    /* element in abnormal state */
  152 #define CESTATUS_ACCESS         0x08    /* media accessible by picker */
  153 #define CESTATUS_EXENAB         0x10    /* element supports exporting */
  154 #define CESTATUS_INENAB         0x20    /* element supports importing */
  155 
  156 #define CESTATUS_PICKER_MASK    0x05    /* flags valid for pickers */
  157 #define CESTATUS_SLOT_MASK      0x0c    /* flags valid for slots */
  158 #define CESTATUS_PORTAL_MASK    0x3f    /* flags valid for portals */
  159 #define CESTATUS_DRIVE_MASK     0x0c    /* flags valid for drives */
  160 
  161 #define CESTATUS_BITS   \
  162         "\2\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
  163 
  164 /*
  165  * XXX we have to renumber this since it chashes w/ the
  166  * cdio ioctls, O* interface goes away right after 3.3
  167  */
  168 #define CHIOMOVE        _IOW('c', 0x41, struct changer_move)
  169 #define CHIOEXCHANGE    _IOW('c', 0x42, struct changer_exchange)
  170 #define CHIOPOSITION    _IOW('c', 0x43, struct changer_position)
  171 #define CHIOGPICKER     _IOR('c', 0x44, int)
  172 #define CHIOSPICKER     _IOW('c', 0x45, int)
  173 #define CHIOGPARAMS     _IOR('c', 0x46, struct changer_params)
  174 #define CHIOGSTATUS     _IOW('c', 0x48, struct changer_element_status_request)
  175 
  176 #endif /* _SYS_CHIO_H_ */

Cache object: f2b5fcd0fdd8e5926a84701645a960b5


[ 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.