Whamcloud - gitweb
LU-1934 ofd: implement precreate batching
[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 /*
53  * When compiled for use with libsysio, this allows one to move all the
54  * externals to a distinct namespace. When not, we want it to do nothing.
55  *
56  * NB: The choice of macro name here is dangerous. It's in the global
57  * namespace! We should fix that one of these days.
58  */
59 #if !defined(SYSIO_INTERFACE_NAME)
60 #define SYSIO_INTERFACE_NAME(_n)        _n
61 #endif
62
63 #ifndef _IOID_T_DEFINED
64 #define _IOID_T_DEFINED
65 typedef void *ioid_t;
66
67 #define IOID_FAIL                       0
68 #endif
69
70 /*
71  * Structure for strided I/O.
72  */
73 struct xtvec {
74 #ifndef __USE_FILE_OFFSET64
75         __off_t xtv_off;                        /* Stride/Extent offset. */
76 #else
77         __off64_t xtv_off;                      /* Stride/Extent offset. */
78 #endif
79         size_t  xtv_len;                        /* Stride/Extent length. */
80 };
81
82 #ifdef __USE_LARGEFILE64
83 struct xtvec64 {
84         __off64_t xtv_off;                      /* Stride/Extent offset. */
85         size_t  xtv_len;                        /* Stride/Extent length. */
86 };
87 #endif
88
89 #ifdef HAVE_POSIX2008_PREADV
90 #define _SYSIO_PREADV_T int
91 #else
92 #define _SYSIO_PREADV_T size_t
93 #endif
94
95 struct iovec;
96
97 /*
98  * Get status of previously posted async file IO operation.
99  */
100 extern int SYSIO_INTERFACE_NAME(iodone)(ioid_t ioid);
101
102 /*
103  * Wait for completion of a previously posted asynch file IO request.
104  */
105 extern ssize_t SYSIO_INTERFACE_NAME(iowait)(ioid_t ioid);
106
107 /*
108  * Post asynch read into buffers mapped by an iovec from file at given offset.
109  */
110 extern ioid_t SYSIO_INTERFACE_NAME(ipreadv)(int fd,
111                                             const struct iovec *iov,
112                                             size_t count,
113                                             off_t offset);
114
115 #ifdef _LARGEFILE64_SOURCE
116 /*
117  * Post asynch read into buffers mapped by an iovec from file at given offset.
118  */
119 extern ioid_t SYSIO_INTERFACE_NAME(ipread64v)(int fd,
120                                               const struct iovec *iov, 
121                                               size_t count,
122                                               off64_t offset);
123 #endif
124
125 /*
126  * Post asynch read into buffer from file at given offset.
127  */
128 extern ioid_t SYSIO_INTERFACE_NAME(ipread)(int fd,
129                                            void *buf,
130                                            size_t count, 
131                                            off_t offset);
132
133 #ifdef _LARGEFILE64_SOURCE
134 /*
135  * Post asynch read into buffer from file at given offset.
136  */
137 extern ioid_t SYSIO_INTERFACE_NAME(ipread64)(int fd,
138                                              void *buf,
139                                              size_t count, 
140                                              off64_t offset);
141 #endif
142
143 /*
144  * Read into buffers mapped by an iovec from file at given offset.
145  */
146 extern ssize_t SYSIO_INTERFACE_NAME(preadv)(int fd,
147                                             const struct iovec *iov,
148                                             _SYSIO_PREADV_T count,
149                                             off_t offset);
150
151 #ifdef _LARGEFILE64_SOURCE
152 /*
153  * Read into buffers mapped by an iovec from file at given offset.
154  */
155 extern ssize_t SYSIO_INTERFACE_NAME(pread64v)(int fd,
156                                               const struct iovec *iov, 
157                                               _SYSIO_PREADV_T count,
158                                               off64_t offset);
159 #endif
160
161 /*
162  * Post asynch read into buffers mapped by an iovec.
163  */
164 extern ioid_t SYSIO_INTERFACE_NAME(ireadv)(int fd,
165                                            const struct iovec *iov, 
166                                            int count);
167
168 /*
169  * Read into buffer.
170  */
171 extern ioid_t SYSIO_INTERFACE_NAME(iread)(int fd,
172                                           void *buf,
173                                           size_t count);
174
175 /*
176  * Post async read into buffers mapped by iovec from regions mapped
177  * by xtvec.
178  *
179  * NB: An adaptation of "listio" from Argonne's PVFS.
180  */
181 extern ioid_t SYSIO_INTERFACE_NAME(ireadx)(int fd,
182                                            const struct iovec *iov, 
183                                            size_t iov_count,
184                                            const struct xtvec *xtv,
185                                            size_t xtv_count);
186
187 #ifdef __USE_LARGEFILE64
188 /*
189  * Post async read into buffers mapped by iovec from regions mapped
190  * by xtvec.
191  *
192  * NB: An adaptation of "listio" from Argonne's PVFS.
193  */
194 extern ioid_t SYSIO_INTERFACE_NAME(iread64x)(int fd,
195                                              const struct iovec *iov, 
196                                              size_t iov_count,
197                                              const struct xtvec64 *xtv,
198                                              size_t xtv_count);
199 #endif
200
201 /*
202  * Read into buffers mapped by iovec from regions mapped
203  * by xtvec.
204  *
205  * NB: An adaptation of "listio" from Argonne's PVFS.
206  */
207 extern ssize_t SYSIO_INTERFACE_NAME(readx)(int fd,
208                                            const struct iovec *iov,
209                                            size_t iov_count,
210                                            const struct xtvec *xtv,
211                                            size_t xtv_count);
212
213 #ifdef __USE_LARGEFILE64
214 /*
215  * Read into buffers mapped by iovec from regions mapped
216  * by xtvec.
217  *
218  * NB: An adaptation of "listio" from Argonne's PVFS.
219  */
220 extern ssize_t SYSIO_INTERFACE_NAME(read64x)(int fd,
221                                              const struct iovec *iov,
222                                              size_t iov_count,
223                                              const struct xtvec64 *xtv,
224                                              size_t xtv_count);
225 #endif
226
227 /*
228  * Post asynch write from buffers mapped by an iovec to file at given offset.
229  */
230 extern ioid_t SYSIO_INTERFACE_NAME(ipwritev)(int fd,
231                                              const struct iovec *iov,
232                                              size_t count,
233                                              off_t offset);
234 #ifdef _LARGEFILE64_SOURCE
235 /*
236  * Post asynch write from buffers mapped by an iovec to file at given offset.
237  */
238 extern ioid_t SYSIO_INTERFACE_NAME(ipwrite64v)(int fd,
239                                                const struct iovec *iov,
240                                                size_t count,
241                                                off64_t offset);
242 #endif
243
244 /*
245  * Post asynch write from buffer to file at given offset.
246  */
247 extern ioid_t SYSIO_INTERFACE_NAME(ipwrite)(int fd,
248                                             const void *buf,
249                                             size_t count,
250                                             off_t offset);
251
252 #ifdef _LARGEFILE64_SOURCE
253 /*
254  * Post asynch write from buffer to file at given offset.
255  */
256 extern ioid_t SYSIO_INTERFACE_NAME(ipwrite64)(int fd,
257                                               const void *buf,
258                                               size_t count,
259                                               off64_t offset);
260 #endif
261
262 /*
263  * Write from buffers mapped by an iovec to file at given offset.
264  */
265 extern ssize_t SYSIO_INTERFACE_NAME(pwritev)(int fd,
266                                              const struct iovec *iov,
267                                              _SYSIO_PREADV_T count,
268                                              off_t offset);
269
270 #ifdef _LARGEFILE64_SOURCE
271 /*
272  * Write from buffers mapped by an iovec to file at given offset.
273  */
274 extern ssize_t SYSIO_INTERFACE_NAME(pwrite64v)(int fd,
275                                                const struct iovec *iov,
276                                                _SYSIO_PREADV_T count,
277                                                off64_t offset);
278 #endif
279
280 /*
281  * Post asynch write from buffer to file at given offset.
282  */
283 extern ioid_t SYSIO_INTERFACE_NAME(iwritev)(int fd,
284                                             const struct iovec *iov,
285                                             int count);
286
287 /*
288  * Write from buffer to file at given offset.
289  */
290 extern ioid_t SYSIO_INTERFACE_NAME(iwrite)(int fd,
291                                            const void *buf,
292                                            size_t count);
293
294 /*
295  * Post async write from buffers mapped by iovec to regions mapped
296  * by xtvec.
297  *
298  * NB: An adaptation of "listio" from Argonne's PVFS.
299  */
300 extern ioid_t SYSIO_INTERFACE_NAME(iwritex)(int fd,
301                                             const struct iovec *iov,
302                                             size_t iov_count,
303                                             const struct xtvec *xtv,
304                                             size_t xtv_count);
305
306 #ifdef __USE_LARGEFILE64
307 /*
308  * Post async write from buffers mapped by iovec to regions mapped
309  * by xtvec.
310  *
311  * NB: An adaptation of "listio" from Argonne's PVFS.
312  */
313 extern ioid_t SYSIO_INTERFACE_NAME(iwrite64x)(int fd,
314                                               const struct iovec *iov,
315                                               size_t iov_count,
316                                               const struct xtvec64 *xtv,
317                                               size_t xtv_count);
318 #endif
319
320 /*
321  * Write from buffers mapped by iovec to regions mapped
322  * by xtvec.
323  *
324  * NB: An adaptation of "listio" from Argonne's PVFS.
325  */
326 extern ssize_t SYSIO_INTERFACE_NAME(writex)(int fd,
327                                             const struct iovec *iov,
328                                             size_t iov_count,
329                                             const struct xtvec *xtv,
330                                             size_t xtv_count);
331
332 #ifdef __USE_LARGEFILE64
333 /*
334  * Write from buffers mapped by iovec to regions mapped
335  * by xtvec.
336  *
337  * NB: An adaptation of "listio" from Argonne's PVFS.
338  */
339 extern ssize_t SYSIO_INTERFACE_NAME(write64x)(int fd,
340                                               const struct iovec *iov, 
341                                               size_t iov_count,
342                                               const struct xtvec64 *xtv,
343                                               size_t xtv_count);
344 #endif
345 #endif /* ! _XTIO_H_ */