2 * Copyright (c) 2000 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Define io syscalls supported by doio
29 #define LREAD 10 /* listio - single stride, single entry */
33 #define LSREAD 14 /* listio - multi-stride, single entry */
37 #define LEREAD 18 /* listio - single stride, multiple entry */
55 #define RESVSP 122 /* xfsctl(XFS_IOC_RESVSP) */
56 #define UNRESVSP 123 /* xfsctl(XFS_IOC_UNRESVSP) */
57 #define FSYNC2 125 /* fsync(2) */
58 #define FDATASYNC 126 /* fdatasync(2) */
61 /* used: <<doio>> 1.? <<DOIO>> 1.5 <-DOIO-> 1.7*/
62 #define DOIO_MAGIC '<[DOIO]>'
64 #define DOIO_MAGIC 07116601
68 * Define various user flags (r_uflag field) that io requests can have
72 #define F_WORD_ALIGNED 0001 /* force request to be word aligned */
75 * define various doio exit status's
78 #define E_NORMAL 000 /* normal completion */
79 #define E_USAGE 001 /* cmdline usage error */
80 #define E_SETUP 002 /* any of a million setup conditions */
81 #define E_COMPARE 004 /* data compare error from doio child */
82 #define E_INTERNAL 010 /* various internal errors */
83 #define E_LOCKD 020 /* lockd startup/timeout errors */
84 #define E_SIGNAL 040 /* killed by signal */
87 * Define async io completion strategies supported by doio.
90 #define A_POLL 1 /* poll iosw for completion */
91 #define A_SIGNAL 2 /* get signal for completion */
92 #define A_RECALL 3 /* use recall(2) to wait */
93 #define A_RECALLA 4 /* use recalla(2) to wait */
94 #define A_RECALLS 5 /* use recalls(2) to wait */
95 #define A_SUSPEND 6 /* use aio_suspend(2) to wait */
96 #define A_CALLBACK 7 /* use a callback signal op. */
99 * Define individual structures for each syscall type. These will all be
100 * unionized into a single io_req structure which io generators fill in and
103 * Note: It is VERY important that the r_file, r_oflags, r_offset, and
104 * r_nbytes fields occupy the same record positions in the
105 * read_req, reada_req, write_req, and writea_req structures and
106 * that they have the same type. It is also that r_pattern
107 * has the same type/offset in the write_req and writea_req
110 * Since doio.c accesses all information through the r_data
111 * union in io_req, if the above assumptions hold, the above
112 * fields can be accessed without regard to structure type.
113 * This is an allowed assumption in C.
116 #define MAX_FNAME_LENGTH 128
119 char r_file[MAX_FNAME_LENGTH];
120 int r_oflags; /* open flags */
123 int r_uflags; /* user flags: mem alignment */
124 int r_aio_strat; /* asynch read completion strategy */
125 int r_nstrides; /* listio: multiple strides */
126 int r_nent; /* listio: multiple list entries */
130 char r_file[MAX_FNAME_LENGTH];
135 int r_uflags; /* user flags: mem alignment */
136 int r_aio_strat; /* asynch write completion strategy */
137 int r_nstrides; /* listio: multiple strides */
138 int r_nent; /* listio: multiple list entries */
151 char r_file[MAX_FNAME_LENGTH];
152 int r_cmd; /* LC_START or LC_WAIT */
153 int r_offset; /* file offset */
154 int r_opcode; /* LO_READ, or LO_WRITE */
155 int r_nbytes; /* bytes per stride */
156 int r_nstrides; /* how many strides to make */
157 int r_nent; /* how many listreq entries to make */
158 int r_filestride; /* always 0 for now */
159 int r_memstride; /* always 0 for now */
160 char r_pattern; /* for LO_WRITE operations */
161 int r_oflags; /* open(2) flags */
162 int r_aio_strat; /* async I/O completion strategy */
163 int r_uflags; /* user flags: memory alignment */
166 #define rw_req listio_req /* listio is superset of everything */
169 * Main structure for sending a request to doio. Any tools which form IO
170 * for doio must present it using one of these structures.
174 int r_type; /* must be one of the #defines above */
175 int r_magic; /* must be set to DOIO_MAGIC by requestor */
177 struct read_req read;
178 struct write_req write;
179 struct ssread_req ssread;
180 struct sswrite_req sswrite;
181 struct listio_req listio;