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-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) 1996 Jason R. Thorpe <thorpej@and.com>
    3  * 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 acknowledgements:
   15  *      This product includes software developed by Jason R. Thorpe
   16  *      for And Communications, http://www.and.com/
   17  * 4. The name of the author may not be used to endorse or promote products
   18  *    derived from this software without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   28  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  *
   32  * $FreeBSD: src/sys/sys/chio.h,v 1.15 1999/12/29 04:24:38 peter Exp $
   33  * $DragonFly: src/sys/sys/chio.h,v 1.4 2007/11/25 17:59:22 pavalos Exp $
   34  */
   35 
   36 #ifndef _SYS_CHIO_H_
   37 #define _SYS_CHIO_H_
   38 
   39 #ifndef _SYS_TYPES_H_
   40 #include <sys/types.h>
   41 #endif
   42 #ifndef _SYS_IOCCOM_H_
   43 #include <sys/ioccom.h>
   44 #endif
   45 
   46 /*
   47  * Element types.  Used as "to" and "from" type indicators in move
   48  * and exchange operations.
   49  *
   50  * Note that code in sys/scsi/ch.c relies on these values (uses them
   51  * as offsets in an array, and other evil), so don't muck with them
   52  * unless you know what you're doing.
   53  */
   54 #define CHET_MT         0       /* medium transport (picker) */
   55 #define CHET_ST         1       /* storage transport (slot) */
   56 #define CHET_IE         2       /* import/export (portal) */
   57 #define CHET_DT         3       /* data transfer (drive) */
   58 #define CHET_MAX        CHET_DT
   59 
   60 /*
   61  * Maximum length of a volume identification string
   62  */
   63 #define CH_VOLTAG_MAXLEN        32
   64 
   65 /*
   66  * Structure used to execute a MOVE MEDIUM command.
   67  */
   68 struct changer_move {
   69         u_int16_t       cm_fromtype;    /* element type to move from */
   70         u_int16_t       cm_fromunit;    /* logical unit of from element */
   71         u_int16_t       cm_totype;      /* element type to move to */
   72         u_int16_t       cm_tounit;      /* logical unit of to element */
   73         u_int16_t       cm_flags;       /* misc. flags */
   74 };
   75 
   76 /* cm_flags */
   77 #define CM_INVERT       0x01    /* invert media */
   78 
   79 /*
   80  * Structure used to execute an EXCHANGE MEDIUM command.  In an
   81  * exchange operation, the following steps occur:
   82  *
   83  *      - media from source is moved to first destination.
   84  *
   85  *      - media previously occupying first destination is moved
   86  *        to the second destination.
   87  *
   88  * The second destination may or may not be the same as the source.
   89  * In the case of a simple exchange, the source and second destination
   90  * are the same.
   91  */
   92 struct changer_exchange {
   93         u_int16_t       ce_srctype;     /* element type of source */
   94         u_int16_t       ce_srcunit;     /* logical unit of source */
   95         u_int16_t       ce_fdsttype;    /* element type of first destination */
   96         u_int16_t       ce_fdstunit;    /* logical unit of first destination */
   97         u_int16_t       ce_sdsttype;    /* element type of second destination */
   98         u_int16_t       ce_sdstunit;    /* logical unit of second destination */
   99         u_int16_t       ce_flags;       /* misc. flags */
  100 };
  101 
  102 /* ce_flags */
  103 #define CE_INVERT1      0x01    /* invert media 1 */
  104 #define CE_INVERT2      0x02    /* invert media 2 */
  105 
  106 /*
  107  * Structure used to execute a POSITION TO ELEMENT command.  This
  108  * moves the current picker in front of the specified element.
  109  */
  110 struct changer_position {
  111         u_int16_t       cp_type;        /* element type */
  112         u_int16_t       cp_unit;        /* logical unit of element */
  113         u_int16_t       cp_flags;       /* misc. flags */
  114 };
  115 
  116 /* cp_flags */
  117 #define CP_INVERT       0x01    /* invert picker */
  118 
  119 /*
  120  * Data returned by CHIOGPARAMS.
  121  */
  122 struct changer_params {
  123         u_int16_t       cp_npickers;    /* number of pickers */
  124         u_int16_t       cp_nslots;      /* number of slots */
  125         u_int16_t       cp_nportals;    /* number of import/export portals */
  126         u_int16_t       cp_ndrives;     /* number of drives */
  127 };
  128 
  129 /*
  130  * Command used to get element status.
  131  */
  132 
  133 struct changer_voltag {
  134         u_char          cv_volid[CH_VOLTAG_MAXLEN+1];
  135         u_int16_t       cv_serial;
  136 };
  137 
  138 typedef struct changer_voltag changer_voltag_t;
  139 
  140 /*
  141  * Flags definitions for ces_status
  142  * Not all flags have meaning for all element types.
  143  */
  144 typedef enum {
  145         CES_STATUS_FULL   = 0x001,      /* element is full */
  146         CES_STATUS_IMPEXP = 0x002,      /* media deposited by operator */
  147         CES_STATUS_EXCEPT = 0x004,      /* element in abnormal state */
  148         CES_PICKER_MASK   = 0x005,      /* flags valid for pickers */
  149         CES_STATUS_ACCESS = 0x008,      /* media accessible by picker */
  150         CES_SLOT_MASK     = 0x00c,      /* flags valid for slots */
  151         CES_DRIVE_MASK    = 0x00c,      /* flags valid for drives */
  152         CES_STATUS_EXENAB = 0x010,      /* element supports exporting */
  153         CES_STATUS_INENAB = 0x020,      /* element supports importing */
  154         CES_PORTAL_MASK   = 0x03f,      /* flags valid for portals */
  155         CES_INVERT        = 0x040,      /* invert bit */
  156         CES_SOURCE_VALID  = 0x080,      /* source address (ces_source) valid */
  157         CES_SCSIID_VALID  = 0x100,      /* ces_scsi_id is valid */
  158         CES_LUN_VALID     = 0x200       /* ces_scsi_lun is valid */
  159 } ces_status_flags;
  160 
  161 struct changer_element_status {
  162         u_int8_t                ces_type;         /* element type */
  163         u_int16_t               ces_addr;         /* logical element address */
  164         u_int16_t               ces_int_addr;     /* changer element address */
  165         ces_status_flags        ces_flags;        /* 
  166                                                    * see CESTATUS definitions
  167                                                    * below 
  168                                                    */ 
  169         u_int8_t                ces_sensecode;    /* 
  170                                                    * additional sense
  171                                                    * code for element */
  172         u_int8_t                ces_sensequal;    /*
  173                                                    * additional sense
  174                                                    * code qualifier 
  175                                                    */
  176         u_int8_t                ces_source_type;  /* 
  177                                                    * element type of
  178                                                    * source address 
  179                                                    */
  180         u_int16_t               ces_source_addr;  /* 
  181                                                    * source address of medium
  182                                                    */
  183         changer_voltag_t        ces_pvoltag;      /* primary volume tag */
  184         changer_voltag_t        ces_avoltag;      /* alternate volume tag */
  185         u_int8_t                ces_scsi_id;      /* SCSI id of element */
  186         u_int8_t                ces_scsi_lun;     /* SCSI lun of element */
  187 };
  188 
  189 struct changer_element_status_request {
  190         u_int16_t                       cesr_element_type;
  191         u_int16_t                       cesr_element_base;
  192         u_int16_t                       cesr_element_count;
  193 
  194         u_int16_t                       cesr_flags;
  195 #define CESR_VOLTAGS    0x01
  196 
  197         struct changer_element_status   *cesr_element_status;
  198 };
  199 
  200 
  201 struct changer_set_voltag_request {
  202         u_int16_t               csvr_type;
  203         u_int16_t               csvr_addr;
  204 
  205         u_int16_t               csvr_flags;
  206 #define CSVR_MODE_MASK          0x0f    /* mode mask, acceptable modes below: */
  207 #define CSVR_MODE_SET           0x00    /* set volume tag if not set */
  208 #define CSVR_MODE_REPLACE       0x01    /* unconditionally replace volume tag */
  209 #define CSVR_MODE_CLEAR         0x02    /* clear volume tag */
  210 
  211 #define CSVR_ALTERNATE          0x10    /* set to work with alternate voltag */
  212 
  213         changer_voltag_t        csvr_voltag;
  214 };
  215 
  216 
  217 #define CESTATUS_BITS   \
  218         "\2\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
  219 
  220 #define CHIOMOVE        _IOW('c', 0x01, struct changer_move)
  221 #define CHIOEXCHANGE    _IOW('c', 0x02, struct changer_exchange)
  222 #define CHIOPOSITION    _IOW('c', 0x03, struct changer_position)
  223 #define CHIOGPICKER     _IOR('c', 0x04, int)
  224 #define CHIOSPICKER     _IOW('c', 0x05, int)
  225 #define CHIOGPARAMS     _IOR('c', 0x06, struct changer_params)
  226 #define CHIOIELEM       _IOW('c', 0x07, u_int32_t)
  227 #define CHIOGSTATUS     _IOW('c', 0x08, struct changer_element_status_request)
  228 #define CHIOSETVOLTAG   _IOW('c', 0x09, struct changer_set_voltag_request)
  229 
  230 #endif /* !_SYS_CHIO_H_ */

Cache object: 24b958d108931f57694e6c44a8384f8d


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