00001 /* USMID @(#)10/kern/sys/tmfctl.h 10.3 04/24/98 06:35:04 */ 00002 00003 00004 /* 00005 00006 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00007 00008 This program is free software; you can redistribute it and/or modify it 00009 under the terms of version 2.1 of the GNU Lesser General Public License 00010 as published by the Free Software Foundation. 00011 00012 This program is distributed in the hope that it would be useful, but 00013 WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 00016 Further, this software is distributed without any warranty that it is 00017 free of the rightful claim of any third person regarding infringement 00018 or the like. Any license provided herein, whether implied or 00019 otherwise, applies only to this software file. Patent licenses, if 00020 any, provided herein do not apply to combinations of this program with 00021 other software, or any other product whatsoever. 00022 00023 You should have received a copy of the GNU Lesser General Public 00024 License along with this program; if not, write the Free Software 00025 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00026 USA. 00027 00028 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00029 Mountain View, CA 94043, or: 00030 00031 http://www.sgi.com 00032 00033 For further information regarding this notice, see: 00034 00035 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00036 00037 */ 00038 00039 00040 /* 00041 * tmfctl 00042 * 00043 * Define structures and request codes for the TMF driver ioctls. 00044 * 00045 */ 00046 00047 00048 #ifndef __SYS_TMFCTL_H_ 00049 #define __SYS_TMFCTL_H_ 00050 00051 #include "tmfdefs.h" 00052 00053 /* 00054 * Define the TMF ioctl codes. 00055 */ 00056 #define TMFC_ACK_TMFERR 1 00057 #define TMFC_CLEAR 2 00058 #define TMFC_DAEMON 3 00059 #define TMFC_DMNREP 4 00060 #define TMFC_DMNREQ 5 00061 #define TMFC_EOD 6 00062 #define TMFC_FREE 7 00063 #define TMFC_IDENT 8 00064 #define TMFC_OPEN 9 00065 #define TMFC_RESUME 10 00066 #define TMFC_RSTCLR 11 00067 #define TMFC_SETIO 12 00068 #define TMFC_SETSID 13 00069 #define TMFC_UERR 14 00070 #define TMFC_VSN 15 00071 #define TMFC_PRIV 16 00072 00073 00074 /* 00075 * Generic TMF ioctl request structure. 00076 */ 00077 typedef struct tmfctl { 00078 int tmfc_dev; /* Device number */ 00079 int tmfc_owner; /* Stream owner */ 00080 int tmfc_count; /* Function count */ 00081 int tmfc_mbs; /* Maximum block size */ 00082 int tmfc_flag; 00083 char tmfc_vsn[L_MAXVSN]; /* Volume name */ 00084 } tmfctl_t; 00085 00086 #define TMF_IOC_VARBLK 0x00000001 00087 #define TMF_IOC_CSP 0x00000002 /* CSP access privilege */ 00088 00089 00090 /* 00091 * Define the TMF request codes issued to the TMF daemon using ioctl 00092 * TMF_DMNREQ. 00093 */ 00094 #define TR_CLV 0001 /* User close volume */ 00095 #define TR_EOV 0002 /* EOV select and deselect */ 00096 #define TR_INFO 0003 /* Obtain TMF stream information */ 00097 #define TR_PABS 0004 /* Position to an absolute track */ 00098 /* address */ 00099 #define TR_PBLKS 0005 /* Position block forward/backward */ 00100 #define TR_PFMS 0006 /* Position tape mark forward or */ 00101 /* backward */ 00102 #define TR_PVOL 0007 /* Position to the beginning */ 00103 /* of volume with the given */ 00104 /* offset in the VSN list */ 00105 #define TR_PVSN 0010 /* Position to beginning of */ 00106 /* volume with given VSN */ 00107 #define TR_RWD 0011 /* Rewind tape file */ 00108 #define TR_WFM 0012 /* Write a file mark */ 00109 00110 /* 00111 * Define the TMF_DMNREQ request structure. A TMF request consists of 00112 * a header and, for those requests which require additional information, 00113 * a request body. Structures for requests which require additional 00114 * information are listed below. 00115 * 00116 * The following must be set in the request: 00117 * request TMF request type 00118 * length Size of the request excluding the header 00119 * async Set for asynchronous processing. The request status 00120 * can then be obtained with the TMF_DMNREP ioctl. 00121 * 00122 * The following is returned by TMF for synchronous requests: 00123 * reply Reply status returned by TMF 00124 * residual The portion of the request which did not complete 00125 * 00126 */ 00127 00128 typedef struct tmfreqhdr { 00129 int request; 00130 int length; 00131 int reply; 00132 int residual; 00133 int async; 00134 } tmfreqhdr_t; 00135 00136 00137 /* 00138 * TR_EOV 00139 * 00140 * Select or deselect user end-of-volume special processing. Select 00141 * user end-of-volume special processing by setting `select' to a non-zero 00142 * value. Deselect user end-of-volume special processing by setting 00143 * `select' to zero. 00144 */ 00145 typedef struct tmfeov { 00146 tmfreqhdr_t rh; 00147 short select; 00148 } tmfeov_t; 00149 00150 00151 /* 00152 * TR_INFO 00153 * 00154 * Obtain information relating to a tape stream. The stream information 00155 * is returned in structure 'tsdata'. `databuf' is a pointer to memory 00156 * which must be at least as large as the `tsdata' structure. `datalen' 00157 * specifies the size of the buffer. 00158 */ 00159 typedef struct tmfinfo { 00160 tmfreqhdr_t rh; 00161 int datalen; 00162 void *databuf; 00163 } tmfinfo_t; 00164 00165 #if _KERNEL 00166 typedef struct irix5_tmfinfo { 00167 tmfreqhdr_t rh; 00168 int datalen; 00169 app32_ptr_t databuf; 00170 } irix5_tmfinfo_t; 00171 #endif /* _KERNEL */ 00172 00173 00174 /* 00175 * TR_PABS 00176 * 00177 * Position to a specified location using a block address obtained 00178 * with the MTIOCGET ioctl request. 00179 */ 00180 typedef struct tmfpabs { 00181 tmfreqhdr_t rh; 00182 int blkaddr; 00183 } tmfpabs_t; 00184 00185 00186 /* 00187 * TR_PBLKS 00188 * 00189 * Position by blocks. `count' is the number of blocks to position. 00190 */ 00191 typedef struct tmfpblk { 00192 tmfreqhdr_t rh; 00193 int count; 00194 } tmfpblk_t; 00195 00196 00197 /* 00198 * TR_PFMS 00199 * 00200 * Position by filemarks (tapemarks). `count' is the number of filemarks 00201 * to position. 00202 */ 00203 typedef struct tmfpfm { 00204 tmfreqhdr_t rh; 00205 int count; 00206 } tmfpfm_t; 00207 00208 00209 /* 00210 * TR_PVSN 00211 * 00212 * Position to the beginning of the specified volume. `evsn' is the 00213 * external volume identifier. `fvsn' is the format identifier and 00214 * is valid only for D2 volumes. 00215 */ 00216 typedef struct tmfpvsn { 00217 tmfreqhdr_t rh; 00218 char evsn[L_MAXVSN]; 00219 char fvsn[L_MAXVSN]; 00220 } tmfpvsn_t; 00221 00222 00223 /* 00224 * TR_PVOL 00225 * 00226 * Position to the beginning of the volume with the given offset 00227 * in the volume identifier list (from the tmmnt command). `index' 00228 * specifies the offset. '1' specifies the first volume in the volume 00229 * list, '2' the second volume, etc. 00230 */ 00231 typedef struct tmfpvol { 00232 tmfreqhdr_t rh; 00233 int index; 00234 } tmfpvol_t; 00235 00236 00237 /* 00238 * TR_WFM 00239 * 00240 * Write a filemark (tapemark). `count' specifies the number of filemarks 00241 * to write. 00242 */ 00243 typedef struct tmfwfm { 00244 tmfreqhdr_t rh; 00245 int count; 00246 } tmfwfm_t; 00247 00248 typedef union { 00249 tmfpblk_t tmfpblk; 00250 tmfpfm_t tmfpfm; 00251 tmfpvsn_t tmfpvsn; 00252 tmfpvol_t tmfpvol; 00253 tmfpabs_t tmfpabs; 00254 tmfeov_t tmfeov; 00255 tmfinfo_t tmfinfo; 00256 tmfwfm_t tmfwfm; 00257 } tmfreq_t; 00258 00259 #define tmfreq_header tmfpblk.rh 00260 #define tmfreq_request tmfpblk.rh.request 00261 #define tmfreq_length tmfpblk.rh.length 00262 #define tmfreq_reply tmfpblk.rh.reply 00263 #define tmfreq_residual tmfpblk.rh.residual 00264 #define tmfreq_async tmfpblk.rh.async 00265 #define tmfreq_data tmfpblk.count 00266 00267 00268 /* 00269 * TMFC_DMNREP 00270 * 00271 * The following must be set in the request for those requests which 00272 * return data: 00273 * databuf Pointer to a data buffer in which information gathered 00274 * by TMF will be copied 00275 * datalen Length of the data buffer 00276 * 00277 * Returned by TMF: 00278 * reply Reply status returned by TMF 00279 * residual The portion of the request which did not complete 00280 * 00281 */ 00282 typedef struct tmfrep { 00283 int reply; 00284 int residual; 00285 int datalen; 00286 void *databuf; 00287 } tmfrep_t; 00288 00289 #if _KERNEL 00290 typedef struct irix5_tmfrep { 00291 int reply; 00292 int residual; 00293 int datalen; 00294 app32_ptr_t databuf; 00295 } irix5_tmfrep_t; 00296 #endif /* _KERNEL */ 00297 00298 00299 #endif
1.5.6