Whamcloud - gitweb
5f9050ddb41ec0f4be62959d0cf92004bc9a1007
[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 struct iovec;
90
91 /*
92  * Get status of previously posted async file IO operation.
93  */
94 extern int SYSIO_INTERFACE_NAME(iodone)(ioid_t ioid);
95
96 /*
97  * Wait for completion of a previously posted asynch file IO request.
98  */
99 extern ssize_t SYSIO_INTERFACE_NAME(iowait)(ioid_t ioid);
100
101 /*
102  * Post asynch read into buffers mapped by an iovec from file at given offset.
103  */
104 extern ioid_t SYSIO_INTERFACE_NAME(ipreadv)(int fd,
105                                             const struct iovec *iov,
106                                             size_t count,
107                                             off_t offset);
108
109 #if _LARGEFILE64_SOURCE
110 /*
111  * Post asynch read into buffers mapped by an iovec from file at given offset.
112  */
113 extern ioid_t SYSIO_INTERFACE_NAME(ipread64v)(int fd,
114                                               const struct iovec *iov, 
115                                               size_t count,
116                                               off64_t offset);
117 #endif
118
119 /*
120  * Post asynch read into buffer from file at given offset.
121  */
122 extern ioid_t SYSIO_INTERFACE_NAME(ipread)(int fd,
123                                            void *buf,
124                                            size_t count, 
125                                            off_t offset);
126
127 #if _LARGEFILE64_SOURCE
128 /*
129  * Post asynch read into buffer from file at given offset.
130  */
131 extern ioid_t SYSIO_INTERFACE_NAME(ipread64)(int fd,
132                                              void *buf,
133                                              size_t count, 
134                                              off64_t offset);
135 #endif
136
137 /*
138  * Read into buffers mapped by an iovec from file at given offset.
139  */
140 extern ssize_t SYSIO_INTERFACE_NAME(preadv)(int fd,
141                                             const struct iovec *iov,
142                                             size_t count,
143                                             off_t offset);
144
145 #if _LARGEFILE64_SOURCE
146 /*
147  * Read into buffers mapped by an iovec from file at given offset.
148  */
149 extern ssize_t SYSIO_INTERFACE_NAME(pread64v)(int fd,
150                                               const struct iovec *iov, 
151                                               size_t count,
152                                               off64_t offset);
153 #endif
154
155 /*
156  * Post asynch read into buffers mapped by an iovec.
157  */
158 extern ioid_t SYSIO_INTERFACE_NAME(ireadv)(int fd,
159                                            const struct iovec *iov, 
160                                            int count);
161
162 /*
163  * Read into buffer.
164  */
165 extern ioid_t SYSIO_INTERFACE_NAME(iread)(int fd,
166                                           void *buf,
167                                           size_t count);
168
169 /*
170  * Post async read into buffers mapped by iovec from regions mapped
171  * by xtvec.
172  *
173  * NB: An adaptation of "listio" from Argonne's PVFS.
174  */
175 extern ioid_t SYSIO_INTERFACE_NAME(ireadx)(int fd,
176                                            const struct iovec *iov, 
177                                            size_t iov_count,
178                                            const struct xtvec *xtv,
179                                            size_t xtv_count);
180
181 #ifdef __USE_LARGEFILE64
182 /*
183  * Post async read into buffers mapped by iovec from regions mapped
184  * by xtvec.
185  *
186  * NB: An adaptation of "listio" from Argonne's PVFS.
187  */
188 extern ioid_t SYSIO_INTERFACE_NAME(iread64x)(int fd,
189                                              const struct iovec *iov, 
190                                              size_t iov_count,
191                                              const struct xtvec64 *xtv,
192                                              size_t xtv_count);
193 #endif
194
195 /*
196  * Read into buffers mapped by iovec from regions mapped
197  * by xtvec.
198  *
199  * NB: An adaptation of "listio" from Argonne's PVFS.
200  */
201 extern ssize_t SYSIO_INTERFACE_NAME(readx)(int fd,
202                                            const struct iovec *iov,
203                                            size_t iov_count,
204                                            const struct xtvec *xtv,
205                                            size_t xtv_count);
206
207 #ifdef __USE_LARGEFILE64
208 /*
209  * Read into buffers mapped by iovec from regions mapped
210  * by xtvec.
211  *
212  * NB: An adaptation of "listio" from Argonne's PVFS.
213  */
214 extern ssize_t SYSIO_INTERFACE_NAME(read64x)(int fd,
215                                              const struct iovec *iov,
216                                              size_t iov_count,
217                                              const struct xtvec64 *xtv,
218                                              size_t xtv_count);
219 #endif
220
221 /*
222  * Post asynch write from buffers mapped by an iovec to file at given offset.
223  */
224 extern ioid_t SYSIO_INTERFACE_NAME(ipwritev)(int fd,
225                                              const struct iovec *iov,
226                                              size_t count,
227                                              off_t offset);
228 #if _LARGEFILE64_SOURCE
229 /*
230  * Post asynch write from buffers mapped by an iovec to file at given offset.
231  */
232 extern ioid_t SYSIO_INTERFACE_NAME(ipwrite64v)(int fd,
233                                                const struct iovec *iov,
234                                                size_t count,
235                                                off64_t offset);
236 #endif
237
238 /*
239  * Post asynch write from buffer to file at given offset.
240  */
241 extern ioid_t SYSIO_INTERFACE_NAME(ipwrite)(int fd,
242                                             const void *buf,
243                                             size_t count,
244                                             off_t offset);
245
246 #if _LARGEFILE64_SOURCE
247 /*
248  * Post asynch write from buffer to file at given offset.
249  */
250 extern ioid_t SYSIO_INTERFACE_NAME(ipwrite64)(int fd,
251                                               const void *buf,
252                                               size_t count,
253                                               off64_t offset);
254 #endif
255
256 /*
257  * Write from buffers mapped by an iovec to file at given offset.
258  */
259 extern ssize_t SYSIO_INTERFACE_NAME(pwritev)(int fd,
260                                              const struct iovec *iov,
261                                              size_t count,
262                                              off_t offset);
263
264 #if _LARGEFILE64_SOURCE
265 /*
266  * Write from buffers mapped by an iovec to file at given offset.
267  */
268 extern ssize_t SYSIO_INTERFACE_NAME(pwrite64v)(int fd,
269                                                const struct iovec *iov,
270                                                size_t count,
271                                                off64_t offset);
272 #endif
273
274 /*
275  * Post asynch write from buffer to file at given offset.
276  */
277 extern ioid_t SYSIO_INTERFACE_NAME(iwritev)(int fd,
278                                             const struct iovec *iov,
279                                             int count);
280
281 /*
282  * Write from buffer to file at given offset.
283  */
284 extern ioid_t SYSIO_INTERFACE_NAME(iwrite)(int fd,
285                                            const void *buf,
286                                            size_t count);
287
288 /*
289  * Post async write from buffers mapped by iovec to regions mapped
290  * by xtvec.
291  *
292  * NB: An adaptation of "listio" from Argonne's PVFS.
293  */
294 extern ioid_t SYSIO_INTERFACE_NAME(iwritex)(int fd,
295                                             const struct iovec *iov,
296                                             size_t iov_count,
297                                             const struct xtvec *xtv,
298                                             size_t xtv_count);
299
300 #ifdef __USE_LARGEFILE64
301 /*
302  * Post async write from buffers mapped by iovec to regions mapped
303  * by xtvec.
304  *
305  * NB: An adaptation of "listio" from Argonne's PVFS.
306  */
307 extern ioid_t SYSIO_INTERFACE_NAME(iwrite64x)(int fd,
308                                               const struct iovec *iov,
309                                               size_t iov_count,
310                                               const struct xtvec64 *xtv,
311                                               size_t xtv_count);
312 #endif
313
314 /*
315  * Write from buffers mapped by iovec to regions mapped
316  * by xtvec.
317  *
318  * NB: An adaptation of "listio" from Argonne's PVFS.
319  */
320 extern ssize_t SYSIO_INTERFACE_NAME(writex)(int fd,
321                                             const struct iovec *iov,
322                                             size_t iov_count,
323                                             const struct xtvec *xtv,
324                                             size_t xtv_count);
325
326 #ifdef __USE_LARGEFILE64
327 /*
328  * Write from buffers mapped by iovec to regions mapped
329  * by xtvec.
330  *
331  * NB: An adaptation of "listio" from Argonne's PVFS.
332  */
333 extern ssize_t SYSIO_INTERFACE_NAME(write64x)(int fd,
334                                               const struct iovec *iov, 
335                                               size_t iov_count,
336                                               const struct xtvec64 *xtv,
337                                               size_t xtv_count);
338 #endif
339 #endif /* ! _XTIO_H_ */