Whamcloud - gitweb
87cf9810d19a2ca4b980e7256af36bd93a13defd
[fs/lustre-release.git] / libsysio / include / xtio.h
1 /*
2  *    This Cplant(TM) source code is the property of Sandia National
3  *    Laboratories.
4  *
5  *    This Cplant(TM) source code is copyrighted by Sandia National
6  *    Laboratories.
7  *
8  *    The redistribution of this Cplant(TM) source code is subject to the
9  *    terms of the GNU Lesser General Public License
10  *    (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html)
11  *
12  *    Cplant(TM) Copyright 1998-2004 Sandia Corporation. 
13  *    Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
14  *    license for use of this work by or on behalf of the US Government.
15  *    Export of this program may require a license from the United States
16  *    Government.
17  */
18
19 /*
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  * 
25  * This library is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  * 
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33  *
34  * Questions or comments about this library should be sent to:
35  *
36  * Lee Ward
37  * Sandia National Laboratories, New Mexico
38  * P.O. Box 5800
39  * Albuquerque, NM 87185-1110
40  *
41  * lee@sandia.gov
42  */
43
44 /*
45  * Extended application programmers interface for IO as found on Cray RedStorm
46  * and the other current SUNMos/Puma/Cougar/Catamount systems.
47  */
48
49 #ifndef _XTIO_H_
50 #define _XTIO_H_
51
52 #ifndef _IOID_T_DEFINED
53 #define _IOID_T_DEFINED
54 typedef void *ioid_t;
55
56 #define IOID_FAIL                       0
57 #endif
58
59 /*
60  * Structure for strided I/O.
61  */
62 struct xtvec {
63 #ifndef __USE_FILE_OFFSET64
64         __off_t xtv_off;                        /* Stride/Extent offset. */
65 #else
66         __off64_t xtv_off;                      /* Stride/Extent offset. */
67 #endif
68         size_t  xtv_len;                        /* Stride/Extent length. */
69 };
70
71 #ifdef __USE_LARGEFILE64
72 struct xtvec64 {
73         __off64_t xtv_off;                      /* Stride/Extent offset. */
74         size_t  xtv_len;                        /* Stride/Extent length. */
75 };
76 #endif
77
78 struct iovec;
79
80 /*
81  * Get status of previously posted async file IO operation.
82  */
83 extern int iodone(ioid_t ioid);
84
85 /*
86  * Wait for completion of a previously posted asynch file IO request.
87  */
88 extern ssize_t iowait(ioid_t ioid);
89
90 /*
91  * Post asynch read into buffers mapped by an iovec from file at given offset.
92  */
93 extern ioid_t ipreadv(int fd,
94                       const struct iovec *iov,
95                       size_t count,
96                       off_t offset);
97
98 #if _LARGEFILE64_SOURCE
99 /*
100  * Post asynch read into buffers mapped by an iovec from file at given offset.
101  */
102 extern ioid_t ipread64v(int fd,
103                         const struct iovec *iov, 
104                         size_t count,
105                         off64_t offset);
106 #endif
107
108 /*
109  * Post asynch read into buffer from file at given offset.
110  */
111 extern ioid_t ipread(int fd,
112                      void *buf,
113                      size_t count, 
114                      off_t offset);
115
116 #if _LARGEFILE64_SOURCE
117 /*
118  * Post asynch read into buffer from file at given offset.
119  */
120 extern ioid_t ipread64(int fd,
121                        void *buf,
122                        size_t count, 
123                        off64_t offset);
124 #endif
125
126 /*
127  * Read into buffers mapped by an iovec from file at given offset.
128  */
129 extern ssize_t preadv(int fd,
130                       const struct iovec *iov,
131                       size_t count,
132                       off_t offset);
133
134 #if _LARGEFILE64_SOURCE
135 /*
136  * Read into buffers mapped by an iovec from file at given offset.
137  */
138 extern ssize_t pread64v(int fd,
139                         const struct iovec *iov, 
140                         size_t count,
141                         off64_t offset);
142 #endif
143
144 /*
145  * Post asynch read into buffers mapped by an iovec.
146  */
147 extern ioid_t ireadv(int fd,
148                      const struct iovec *iov, 
149                      int count);
150
151 /*
152  * Read into buffer.
153  */
154 extern ioid_t iread(int fd,
155                     void *buf,
156                     size_t count);
157
158 /*
159  * Post async read into buffers mapped by iovec from regions mapped
160  * by xtvec.
161  *
162  * NB: An adaptation of "listio" from Argonne's PVFS.
163  */
164 extern ioid_t ireadx(int fd,
165                      const struct iovec *iov, 
166                      size_t iov_count,
167                      const struct xtvec *xtv,
168                      size_t xtv_count);
169
170 #ifdef __USE_LARGEFILE64
171 /*
172  * Post async read into buffers mapped by iovec from regions mapped
173  * by xtvec.
174  *
175  * NB: An adaptation of "listio" from Argonne's PVFS.
176  */
177 extern ioid_t iread64x(int fd,
178                        const struct iovec *iov, 
179                        size_t iov_count,
180                        const struct xtvec64 *xtv, 
181                        size_t xtv_count);
182 #endif
183
184 /*
185  * Read into buffers mapped by iovec from regions mapped
186  * by xtvec.
187  *
188  * NB: An adaptation of "listio" from Argonne's PVFS.
189  */
190 extern ssize_t readx(int fd,
191                      const struct iovec *iov, 
192                      size_t iov_count,
193                      const struct xtvec *xtv, 
194                      size_t xtv_count);
195
196 #ifdef __USE_LARGEFILE64
197 /*
198  * Read into buffers mapped by iovec from regions mapped
199  * by xtvec.
200  *
201  * NB: An adaptation of "listio" from Argonne's PVFS.
202  */
203 extern ssize_t read64x(int fd,
204                        const struct iovec *iov, 
205                        size_t iov_count,
206                        const struct xtvec64 *xtv, 
207                        size_t xtv_count);
208 #endif
209
210 /*
211  * Post asynch write from buffers mapped by an iovec to file at given offset.
212  */
213 extern ioid_t ipwritev(int fd,
214                        const struct iovec *iov, 
215                        size_t count,
216                        off_t offset);
217 #if _LARGEFILE64_SOURCE
218 /*
219  * Post asynch write from buffers mapped by an iovec to file at given offset.
220  */
221 extern ioid_t ipwrite64v(int fd,
222                          const struct iovec *iov, 
223                          size_t count,
224                          off64_t offset);
225 #endif
226
227 /*
228  * Post asynch write from buffer to file at given offset.
229  */
230 extern ioid_t ipwrite(int fd,
231                       const void *buf, 
232                       size_t count,
233                       off_t offset);
234
235 #if _LARGEFILE64_SOURCE
236 /*
237  * Post asynch write from buffer to file at given offset.
238  */
239 extern ioid_t ipwrite64(int fd,
240                         const void *buf, 
241                         size_t count,
242                         off64_t offset);
243 #endif
244
245 /*
246  * Write from buffers mapped by an iovec to file at given offset.
247  */
248 extern ssize_t pwritev(int fd,
249                        const struct iovec *iov,
250                        size_t count,
251                        off_t offset);
252
253 #if _LARGEFILE64_SOURCE
254 /*
255  * Write from buffers mapped by an iovec to file at given offset.
256  */
257 extern ssize_t pwrite64v(int fd,
258                          const struct iovec *iov,
259                          size_t count,
260                          off64_t offset);
261 #endif
262
263 /*
264  * Post asynch write from buffer to file at given offset.
265  */
266 extern ioid_t iwritev(int fd,
267                       const struct iovec *iov,
268                       int count);
269
270 /*
271  * Write from buffer to file at given offset.
272  */
273 extern ioid_t iwrite(int fd,
274                      const void *buf,
275                      size_t count);
276
277 /*
278  * Post async write from buffers mapped by iovec to regions mapped
279  * by xtvec.
280  *
281  * NB: An adaptation of "listio" from Argonne's PVFS.
282  */
283 extern ioid_t iwritex(int fd,
284                       const struct iovec *iov, 
285                       size_t iov_count,
286                       const struct xtvec *xtv, 
287                       size_t xtv_count);
288
289 #ifdef __USE_LARGEFILE64
290 /*
291  * Post async write from buffers mapped by iovec to regions mapped
292  * by xtvec.
293  *
294  * NB: An adaptation of "listio" from Argonne's PVFS.
295  */
296 extern ioid_t iwrite64x(int fd,
297                         const struct iovec *iov, 
298                         size_t iov_count,
299                         const struct xtvec64 *xtv, 
300                         size_t xtv_count);
301 #endif
302
303 /*
304  * Write from buffers mapped by iovec to regions mapped
305  * by xtvec.
306  *
307  * NB: An adaptation of "listio" from Argonne's PVFS.
308  */
309 extern ssize_t writex(int fd,
310                       const struct iovec *iov, 
311                       size_t iov_count,
312                       const struct xtvec *xtv, 
313                       size_t xtv_count);
314
315 #ifdef __USE_LARGEFILE64
316 /*
317  * Write from buffers mapped by iovec to regions mapped
318  * by xtvec.
319  *
320  * NB: An adaptation of "listio" from Argonne's PVFS.
321  */
322 extern ssize_t write64x(int fd,
323                         const struct iovec *iov, 
324                         size_t iov_count,
325                         const struct xtvec64 *xtv,
326                         size_t xtv_count);
327 #endif
328 #endif /* ! _XTIO_H_ */