2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
33 * Define io syscalls supported by doio
43 #define LREAD 10 /* listio - single stride, single entry */
47 #define LSREAD 14 /* listio - multi-stride, single entry */
51 #define LEREAD 18 /* listio - single stride, multiple entry */
69 #define RESVSP 122 /* xfsctl(XFS_IOC_RESVSP) */
70 #define UNRESVSP 123 /* xfsctl(XFS_IOC_UNRESVSP) */
71 #define FSYNC2 125 /* fsync(2) */
72 #define FDATASYNC 126 /* fdatasync(2) */
75 /* used: <<doio>> 1.? <<DOIO>> 1.5 <-DOIO-> 1.7*/
76 #define DOIO_MAGIC '<[DOIO]>'
78 #define DOIO_MAGIC 07116601
82 * Define various user flags (r_uflag field) that io requests can have
86 #define F_WORD_ALIGNED 0001 /* force request to be word aligned */
89 * define various doio exit status's
92 #define E_NORMAL 000 /* normal completion */
93 #define E_USAGE 001 /* cmdline usage error */
94 #define E_SETUP 002 /* any of a million setup conditions */
95 #define E_COMPARE 004 /* data compare error from doio child */
96 #define E_INTERNAL 010 /* various internal errors */
97 #define E_LOCKD 020 /* lockd startup/timeout errors */
98 #define E_SIGNAL 040 /* killed by signal */
101 * Define async io completion strategies supported by doio.
104 #define A_POLL 1 /* poll iosw for completion */
105 #define A_SIGNAL 2 /* get signal for completion */
106 #define A_RECALL 3 /* use recall(2) to wait */
107 #define A_RECALLA 4 /* use recalla(2) to wait */
108 #define A_RECALLS 5 /* use recalls(2) to wait */
109 #define A_SUSPEND 6 /* use aio_suspend(2) to wait */
110 #define A_CALLBACK 7 /* use a callback signal op. */
113 * Define individual structures for each syscall type. These will all be
114 * unionized into a single io_req structure which io generators fill in and
117 * Note: It is VERY important that the r_file, r_oflags, r_offset, and
118 * r_nbytes fields occupy the same record positions in the
119 * read_req, reada_req, write_req, and writea_req structures and
120 * that they have the same type. It is also that r_pattern
121 * has the same type/offset in the write_req and writea_req
124 * Since doio.c accesses all information through the r_data
125 * union in io_req, if the above assumptions hold, the above
126 * fields can be accessed without regard to structure type.
127 * This is an allowed assumption in C.
130 #define MAX_FNAME_LENGTH 128
133 char r_file[MAX_FNAME_LENGTH];
134 int r_oflags; /* open flags */
137 int r_uflags; /* user flags: mem alignment */
138 int r_aio_strat; /* asynch read completion strategy */
139 int r_nstrides; /* listio: multiple strides */
140 int r_nent; /* listio: multiple list entries */
144 char r_file[MAX_FNAME_LENGTH];
149 int r_uflags; /* user flags: mem alignment */
150 int r_aio_strat; /* asynch write completion strategy */
151 int r_nstrides; /* listio: multiple strides */
152 int r_nent; /* listio: multiple list entries */
165 char r_file[MAX_FNAME_LENGTH];
166 int r_cmd; /* LC_START or LC_WAIT */
167 int r_offset; /* file offset */
168 int r_opcode; /* LO_READ, or LO_WRITE */
169 int r_nbytes; /* bytes per stride */
170 int r_nstrides; /* how many strides to make */
171 int r_nent; /* how many listreq entries to make */
172 int r_filestride; /* always 0 for now */
173 int r_memstride; /* always 0 for now */
174 char r_pattern; /* for LO_WRITE operations */
175 int r_oflags; /* open(2) flags */
176 int r_aio_strat; /* async I/O completion strategy */
177 int r_uflags; /* user flags: memory alignment */
180 #define rw_req listio_req /* listio is superset of everything */
183 * Main structure for sending a request to doio. Any tools which form IO
184 * for doio must present it using one of these structures.
188 int r_type; /* must be one of the #defines above */
189 int r_magic; /* must be set to DOIO_MAGIC by requestor */
191 struct read_req read;
192 struct write_req write;
193 struct ssread_req ssread;
194 struct sswrite_req sswrite;
195 struct listio_req listio;