Annotation of sys/sys/chio.h, Revision 1.1
1.1 ! nbrk 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: "\20\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_ */
CVSweb