1*49cdfc7eSAndroid Build Coastguard Worker /* 2*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 3*49cdfc7eSAndroid Build Coastguard Worker * 4*49cdfc7eSAndroid Build Coastguard Worker * This program is free software; you can redistribute it and/or modify it 5*49cdfc7eSAndroid Build Coastguard Worker * under the terms of version 2 of the GNU General Public License as 6*49cdfc7eSAndroid Build Coastguard Worker * published by the Free Software Foundation. 7*49cdfc7eSAndroid Build Coastguard Worker * 8*49cdfc7eSAndroid Build Coastguard Worker * This program is distributed in the hope that it would be useful, but 9*49cdfc7eSAndroid Build Coastguard Worker * WITHOUT ANY WARRANTY; without even the implied warranty of 10*49cdfc7eSAndroid Build Coastguard Worker * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11*49cdfc7eSAndroid Build Coastguard Worker * 12*49cdfc7eSAndroid Build Coastguard Worker * Further, this software is distributed without any warranty that it is 13*49cdfc7eSAndroid Build Coastguard Worker * free of the rightful claim of any third person regarding infringement 14*49cdfc7eSAndroid Build Coastguard Worker * or the like. Any license provided herein, whether implied or 15*49cdfc7eSAndroid Build Coastguard Worker * otherwise, applies only to this software file. Patent licenses, if 16*49cdfc7eSAndroid Build Coastguard Worker * any, provided herein do not apply to combinations of this program with 17*49cdfc7eSAndroid Build Coastguard Worker * other software, or any other product whatsoever. 18*49cdfc7eSAndroid Build Coastguard Worker * 19*49cdfc7eSAndroid Build Coastguard Worker * You should have received a copy of the GNU General Public License along 20*49cdfc7eSAndroid Build Coastguard Worker * with this program; if not, write the Free Software Foundation, Inc., 21*49cdfc7eSAndroid Build Coastguard Worker * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22*49cdfc7eSAndroid Build Coastguard Worker * 23*49cdfc7eSAndroid Build Coastguard Worker * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 24*49cdfc7eSAndroid Build Coastguard Worker * Mountain View, CA 94043, or: 25*49cdfc7eSAndroid Build Coastguard Worker * 26*49cdfc7eSAndroid Build Coastguard Worker * http://www.sgi.com 27*49cdfc7eSAndroid Build Coastguard Worker * 28*49cdfc7eSAndroid Build Coastguard Worker * For further information regarding this notice, see: 29*49cdfc7eSAndroid Build Coastguard Worker * 30*49cdfc7eSAndroid Build Coastguard Worker * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ 31*49cdfc7eSAndroid Build Coastguard Worker */ 32*49cdfc7eSAndroid Build Coastguard Worker /* 33*49cdfc7eSAndroid Build Coastguard Worker * Define io syscalls supported by doio 34*49cdfc7eSAndroid Build Coastguard Worker */ 35*49cdfc7eSAndroid Build Coastguard Worker 36*49cdfc7eSAndroid Build Coastguard Worker #define READ 1 37*49cdfc7eSAndroid Build Coastguard Worker #define WRITE 2 38*49cdfc7eSAndroid Build Coastguard Worker #define READA 3 39*49cdfc7eSAndroid Build Coastguard Worker #define WRITEA 4 40*49cdfc7eSAndroid Build Coastguard Worker #define SSREAD 5 41*49cdfc7eSAndroid Build Coastguard Worker #define SSWRITE 6 42*49cdfc7eSAndroid Build Coastguard Worker #define LISTIO 7 43*49cdfc7eSAndroid Build Coastguard Worker #define LREAD 10 /* listio - single stride, single entry */ 44*49cdfc7eSAndroid Build Coastguard Worker #define LREADA 11 45*49cdfc7eSAndroid Build Coastguard Worker #define LWRITE 12 46*49cdfc7eSAndroid Build Coastguard Worker #define LWRITEA 13 47*49cdfc7eSAndroid Build Coastguard Worker #define LSREAD 14 /* listio - multi-stride, single entry */ 48*49cdfc7eSAndroid Build Coastguard Worker #define LSREADA 15 49*49cdfc7eSAndroid Build Coastguard Worker #define LSWRITE 16 50*49cdfc7eSAndroid Build Coastguard Worker #define LSWRITEA 17 51*49cdfc7eSAndroid Build Coastguard Worker #define LEREAD 18 /* listio - single stride, multiple entry */ 52*49cdfc7eSAndroid Build Coastguard Worker #define LEREADA 19 53*49cdfc7eSAndroid Build Coastguard Worker #define LEWRITE 20 54*49cdfc7eSAndroid Build Coastguard Worker #define LEWRITEA 21 55*49cdfc7eSAndroid Build Coastguard Worker 56*49cdfc7eSAndroid Build Coastguard Worker /* Irix System Calls */ 57*49cdfc7eSAndroid Build Coastguard Worker #define PREAD 100 58*49cdfc7eSAndroid Build Coastguard Worker #define PWRITE 101 59*49cdfc7eSAndroid Build Coastguard Worker #define READV 102 60*49cdfc7eSAndroid Build Coastguard Worker #define WRITEV 103 61*49cdfc7eSAndroid Build Coastguard Worker #define AREAD 104 62*49cdfc7eSAndroid Build Coastguard Worker #define AWRITE 105 63*49cdfc7eSAndroid Build Coastguard Worker #define LLREAD 110 64*49cdfc7eSAndroid Build Coastguard Worker #define LLAREAD 111 65*49cdfc7eSAndroid Build Coastguard Worker #define LLWRITE 112 66*49cdfc7eSAndroid Build Coastguard Worker #define LLAWRITE 113 67*49cdfc7eSAndroid Build Coastguard Worker #define MMAPR 120 68*49cdfc7eSAndroid Build Coastguard Worker #define MMAPW 121 69*49cdfc7eSAndroid Build Coastguard Worker #define RESVSP 122 /* fcntl(F_RESVSP) */ 70*49cdfc7eSAndroid Build Coastguard Worker #define UNRESVSP 123 /* fcntl(F_UNRESVSP) */ 71*49cdfc7eSAndroid Build Coastguard Worker #define DFFSYNC 124 /* fcntl(F_FSYNC) */ 72*49cdfc7eSAndroid Build Coastguard Worker #define FSYNC2 125 /* fsync(2) */ 73*49cdfc7eSAndroid Build Coastguard Worker #define FDATASYNC 126 /* fdatasync(2) */ 74*49cdfc7eSAndroid Build Coastguard Worker #define BIOSIZE 127 /* fcntl(F_SETBIOSIZE) */ 75*49cdfc7eSAndroid Build Coastguard Worker 76*49cdfc7eSAndroid Build Coastguard Worker #ifdef CRAY 77*49cdfc7eSAndroid Build Coastguard Worker /* used: <<doio>> 1.? <<DOIO>> 1.5 <-DOIO-> 1.7*/ 78*49cdfc7eSAndroid Build Coastguard Worker #define DOIO_MAGIC '<[DOIO]>' 79*49cdfc7eSAndroid Build Coastguard Worker #else 80*49cdfc7eSAndroid Build Coastguard Worker #define DOIO_MAGIC 07116601 81*49cdfc7eSAndroid Build Coastguard Worker #endif 82*49cdfc7eSAndroid Build Coastguard Worker 83*49cdfc7eSAndroid Build Coastguard Worker /* 84*49cdfc7eSAndroid Build Coastguard Worker * Define various user flags (r_uflag field) that io requests can have 85*49cdfc7eSAndroid Build Coastguard Worker * specified. 86*49cdfc7eSAndroid Build Coastguard Worker */ 87*49cdfc7eSAndroid Build Coastguard Worker 88*49cdfc7eSAndroid Build Coastguard Worker #define F_WORD_ALIGNED 0001 /* force request to be word aligned */ 89*49cdfc7eSAndroid Build Coastguard Worker 90*49cdfc7eSAndroid Build Coastguard Worker /* 91*49cdfc7eSAndroid Build Coastguard Worker * define various doio exit status's 92*49cdfc7eSAndroid Build Coastguard Worker */ 93*49cdfc7eSAndroid Build Coastguard Worker 94*49cdfc7eSAndroid Build Coastguard Worker #define E_NORMAL 000 /* normal completion */ 95*49cdfc7eSAndroid Build Coastguard Worker #define E_USAGE 001 /* cmdline usage error */ 96*49cdfc7eSAndroid Build Coastguard Worker #define E_SETUP 002 /* any of a million setup conditions */ 97*49cdfc7eSAndroid Build Coastguard Worker #define E_COMPARE 004 /* data compare error from doio child */ 98*49cdfc7eSAndroid Build Coastguard Worker #define E_INTERNAL 010 /* various internal errors */ 99*49cdfc7eSAndroid Build Coastguard Worker #define E_LOCKD 020 /* lockd startup/timeout errors */ 100*49cdfc7eSAndroid Build Coastguard Worker #define E_SIGNAL 040 /* killed by signal */ 101*49cdfc7eSAndroid Build Coastguard Worker 102*49cdfc7eSAndroid Build Coastguard Worker /* 103*49cdfc7eSAndroid Build Coastguard Worker * Define async io completion strategies supported by doio. 104*49cdfc7eSAndroid Build Coastguard Worker */ 105*49cdfc7eSAndroid Build Coastguard Worker 106*49cdfc7eSAndroid Build Coastguard Worker #define A_POLL 1 /* poll iosw for completion */ 107*49cdfc7eSAndroid Build Coastguard Worker #define A_SIGNAL 2 /* get signal for completion */ 108*49cdfc7eSAndroid Build Coastguard Worker #define A_RECALL 3 /* use recall(2) to wait */ 109*49cdfc7eSAndroid Build Coastguard Worker #define A_RECALLA 4 /* use recalla(2) to wait */ 110*49cdfc7eSAndroid Build Coastguard Worker #define A_RECALLS 5 /* use recalls(2) to wait */ 111*49cdfc7eSAndroid Build Coastguard Worker #define A_SUSPEND 6 /* use aio_suspend(2) to wait */ 112*49cdfc7eSAndroid Build Coastguard Worker #define A_CALLBACK 7 /* use a callback signal op. */ 113*49cdfc7eSAndroid Build Coastguard Worker 114*49cdfc7eSAndroid Build Coastguard Worker /* 115*49cdfc7eSAndroid Build Coastguard Worker * Define individual structures for each syscall type. These will all be 116*49cdfc7eSAndroid Build Coastguard Worker * unionized into a single io_req structure which io generators fill in and 117*49cdfc7eSAndroid Build Coastguard Worker * pass to doio. 118*49cdfc7eSAndroid Build Coastguard Worker * 119*49cdfc7eSAndroid Build Coastguard Worker * Note: It is VERY important that the r_file, r_oflags, r_offset, and 120*49cdfc7eSAndroid Build Coastguard Worker * r_nbytes fields occupy the same record positions in the 121*49cdfc7eSAndroid Build Coastguard Worker * read_req, reada_req, write_req, and writea_req structures and 122*49cdfc7eSAndroid Build Coastguard Worker * that they have the same type. It is also that r_pattern 123*49cdfc7eSAndroid Build Coastguard Worker * has the same type/offset in the write_req and writea_req 124*49cdfc7eSAndroid Build Coastguard Worker * structures. 125*49cdfc7eSAndroid Build Coastguard Worker * 126*49cdfc7eSAndroid Build Coastguard Worker * Since doio.c accesses all information through the r_data 127*49cdfc7eSAndroid Build Coastguard Worker * union in io_req, if the above assumptions hold, the above 128*49cdfc7eSAndroid Build Coastguard Worker * fields can be accessed without regard to structure type. 129*49cdfc7eSAndroid Build Coastguard Worker * This is an allowed assumption in C. 130*49cdfc7eSAndroid Build Coastguard Worker */ 131*49cdfc7eSAndroid Build Coastguard Worker 132*49cdfc7eSAndroid Build Coastguard Worker #define MAX_FNAME_LENGTH 128 133*49cdfc7eSAndroid Build Coastguard Worker 134*49cdfc7eSAndroid Build Coastguard Worker struct read_req { 135*49cdfc7eSAndroid Build Coastguard Worker char r_file[MAX_FNAME_LENGTH]; 136*49cdfc7eSAndroid Build Coastguard Worker int r_oflags; /* open flags */ 137*49cdfc7eSAndroid Build Coastguard Worker int r_offset; 138*49cdfc7eSAndroid Build Coastguard Worker int r_nbytes; 139*49cdfc7eSAndroid Build Coastguard Worker int r_uflags; /* user flags: mem alignment */ 140*49cdfc7eSAndroid Build Coastguard Worker int r_aio_strat; /* asynch read completion strategy */ 141*49cdfc7eSAndroid Build Coastguard Worker int r_nstrides; /* listio: multiple strides */ 142*49cdfc7eSAndroid Build Coastguard Worker int r_nent; /* listio: multiple list entries */ 143*49cdfc7eSAndroid Build Coastguard Worker }; 144*49cdfc7eSAndroid Build Coastguard Worker 145*49cdfc7eSAndroid Build Coastguard Worker struct write_req { 146*49cdfc7eSAndroid Build Coastguard Worker char r_file[MAX_FNAME_LENGTH]; 147*49cdfc7eSAndroid Build Coastguard Worker int r_oflags; 148*49cdfc7eSAndroid Build Coastguard Worker int r_offset; 149*49cdfc7eSAndroid Build Coastguard Worker int r_nbytes; 150*49cdfc7eSAndroid Build Coastguard Worker char r_pattern; 151*49cdfc7eSAndroid Build Coastguard Worker int r_uflags; /* user flags: mem alignment */ 152*49cdfc7eSAndroid Build Coastguard Worker int r_aio_strat; /* asynch write completion strategy */ 153*49cdfc7eSAndroid Build Coastguard Worker int r_nstrides; /* listio: multiple strides */ 154*49cdfc7eSAndroid Build Coastguard Worker int r_nent; /* listio: multiple list entries */ 155*49cdfc7eSAndroid Build Coastguard Worker }; 156*49cdfc7eSAndroid Build Coastguard Worker 157*49cdfc7eSAndroid Build Coastguard Worker struct ssread_req { 158*49cdfc7eSAndroid Build Coastguard Worker int r_nbytes; 159*49cdfc7eSAndroid Build Coastguard Worker }; 160*49cdfc7eSAndroid Build Coastguard Worker 161*49cdfc7eSAndroid Build Coastguard Worker struct sswrite_req { 162*49cdfc7eSAndroid Build Coastguard Worker int r_nbytes; 163*49cdfc7eSAndroid Build Coastguard Worker char r_pattern; 164*49cdfc7eSAndroid Build Coastguard Worker }; 165*49cdfc7eSAndroid Build Coastguard Worker 166*49cdfc7eSAndroid Build Coastguard Worker struct listio_req { 167*49cdfc7eSAndroid Build Coastguard Worker char r_file[MAX_FNAME_LENGTH]; 168*49cdfc7eSAndroid Build Coastguard Worker int r_cmd; /* LC_START or LC_WAIT */ 169*49cdfc7eSAndroid Build Coastguard Worker int r_offset; /* file offset */ 170*49cdfc7eSAndroid Build Coastguard Worker int r_opcode; /* LO_READ, or LO_WRITE */ 171*49cdfc7eSAndroid Build Coastguard Worker int r_nbytes; /* bytes per stride */ 172*49cdfc7eSAndroid Build Coastguard Worker int r_nstrides; /* how many strides to make */ 173*49cdfc7eSAndroid Build Coastguard Worker int r_nent; /* how many listreq entries to make */ 174*49cdfc7eSAndroid Build Coastguard Worker int r_filestride; /* always 0 for now */ 175*49cdfc7eSAndroid Build Coastguard Worker int r_memstride; /* always 0 for now */ 176*49cdfc7eSAndroid Build Coastguard Worker char r_pattern; /* for LO_WRITE operations */ 177*49cdfc7eSAndroid Build Coastguard Worker int r_oflags; /* open(2) flags */ 178*49cdfc7eSAndroid Build Coastguard Worker int r_aio_strat; /* async I/O completion strategy */ 179*49cdfc7eSAndroid Build Coastguard Worker int r_uflags; /* user flags: memory alignment */ 180*49cdfc7eSAndroid Build Coastguard Worker }; 181*49cdfc7eSAndroid Build Coastguard Worker 182*49cdfc7eSAndroid Build Coastguard Worker #define rw_req listio_req /* listio is superset of everything */ 183*49cdfc7eSAndroid Build Coastguard Worker 184*49cdfc7eSAndroid Build Coastguard Worker /* 185*49cdfc7eSAndroid Build Coastguard Worker * Main structure for sending a request to doio. Any tools which form IO 186*49cdfc7eSAndroid Build Coastguard Worker * for doio must present it using one of these structures. 187*49cdfc7eSAndroid Build Coastguard Worker */ 188*49cdfc7eSAndroid Build Coastguard Worker 189*49cdfc7eSAndroid Build Coastguard Worker struct io_req { 190*49cdfc7eSAndroid Build Coastguard Worker int r_type; /* must be one of the #defines above */ 191*49cdfc7eSAndroid Build Coastguard Worker int r_magic; /* must be set to DOIO_MAGIC by requestor */ 192*49cdfc7eSAndroid Build Coastguard Worker union { 193*49cdfc7eSAndroid Build Coastguard Worker struct read_req read; 194*49cdfc7eSAndroid Build Coastguard Worker struct write_req write; 195*49cdfc7eSAndroid Build Coastguard Worker struct ssread_req ssread; 196*49cdfc7eSAndroid Build Coastguard Worker struct sswrite_req sswrite; 197*49cdfc7eSAndroid Build Coastguard Worker struct listio_req listio; 198*49cdfc7eSAndroid Build Coastguard Worker struct rw_req io; 199*49cdfc7eSAndroid Build Coastguard Worker } r_data; 200*49cdfc7eSAndroid Build Coastguard Worker }; 201