Whamcloud - gitweb
LU-2241 symlink: fix off-by-one error when reading symlinks
[fs/lustre-release.git] / libsysio / include / xtio.h
index 765aaf8..8e67d2e 100644 (file)
  */
 
 /*
+ * Extended application programmers interface for IO as found on Cray RedStorm
+ * and the other current SUNMos/Puma/Cougar/Catamount systems.
+ */
+
+#ifndef _XTIO_H_
+#define _XTIO_H_
+
+/*
+ * When compiled for use with libsysio, this allows one to move all the
+ * externals to a distinct namespace. When not, we want it to do nothing.
+ *
+ * NB: The choice of macro name here is dangerous. It's in the global
+ * namespace! We should fix that one of these days.
+ */
+#if !defined(SYSIO_INTERFACE_NAME)
+#define SYSIO_INTERFACE_NAME(_n)       _n
+#endif
+
+#ifndef _IOID_T_DEFINED
+#define _IOID_T_DEFINED
+typedef void *ioid_t;
+
+#define IOID_FAIL                      0
+#endif
+
+/*
  * Structure for strided I/O.
  */
 struct xtvec {
@@ -60,51 +86,260 @@ struct xtvec64 {
 };
 #endif
 
+#ifdef HAVE_POSIX2008_PREADV
+#define _SYSIO_PREADV_T int
+#else
+#define _SYSIO_PREADV_T size_t
+#endif
+
+struct iovec;
+
+/*
+ * Get status of previously posted async file IO operation.
+ */
+extern int SYSIO_INTERFACE_NAME(iodone)(ioid_t ioid);
+
+/*
+ * Wait for completion of a previously posted asynch file IO request.
+ */
+extern ssize_t SYSIO_INTERFACE_NAME(iowait)(ioid_t ioid);
+
+/*
+ * Post asynch read into buffers mapped by an iovec from file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ipreadv)(int fd,
+                                           const struct iovec *iov,
+                                           size_t count,
+                                           off_t offset);
+
+#ifdef _LARGEFILE64_SOURCE
+/*
+ * Post asynch read into buffers mapped by an iovec from file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ipread64v)(int fd,
+                                             const struct iovec *iov, 
+                                             size_t count,
+                                             off64_t offset);
+#endif
+
+/*
+ * Post asynch read into buffer from file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ipread)(int fd,
+                                          void *buf,
+                                          size_t count, 
+                                          off_t offset);
+
+#ifdef _LARGEFILE64_SOURCE
+/*
+ * Post asynch read into buffer from file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ipread64)(int fd,
+                                            void *buf,
+                                            size_t count, 
+                                            off64_t offset);
+#endif
+
+/*
+ * Read into buffers mapped by an iovec from file at given offset.
+ */
+extern ssize_t SYSIO_INTERFACE_NAME(preadv)(int fd,
+                                           const struct iovec *iov,
+                                           _SYSIO_PREADV_T count,
+                                           off_t offset);
+
+#ifdef _LARGEFILE64_SOURCE
+/*
+ * Read into buffers mapped by an iovec from file at given offset.
+ */
+extern ssize_t SYSIO_INTERFACE_NAME(pread64v)(int fd,
+                                             const struct iovec *iov, 
+                                             _SYSIO_PREADV_T count,
+                                             off64_t offset);
+#endif
+
+/*
+ * Post asynch read into buffers mapped by an iovec.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ireadv)(int fd,
+                                          const struct iovec *iov, 
+                                          int count);
+
+/*
+ * Read into buffer.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(iread)(int fd,
+                                         void *buf,
+                                         size_t count);
+
+/*
+ * Post async read into buffers mapped by iovec from regions mapped
+ * by xtvec.
+ *
+ * NB: An adaptation of "listio" from Argonne's PVFS.
+ */
 extern ioid_t SYSIO_INTERFACE_NAME(ireadx)(int fd,
                                           const struct iovec *iov, 
                                           size_t iov_count,
-                                          const struct xtvec *xtv, 
+                                          const struct xtvec *xtv,
                                           size_t xtv_count);
+
 #ifdef __USE_LARGEFILE64
+/*
+ * Post async read into buffers mapped by iovec from regions mapped
+ * by xtvec.
+ *
+ * NB: An adaptation of "listio" from Argonne's PVFS.
+ */
 extern ioid_t SYSIO_INTERFACE_NAME(iread64x)(int fd,
                                             const struct iovec *iov, 
                                             size_t iov_count,
-                                            const struct xtvec64 *xtv, 
+                                            const struct xtvec64 *xtv,
                                             size_t xtv_count);
 #endif
+
+/*
+ * Read into buffers mapped by iovec from regions mapped
+ * by xtvec.
+ *
+ * NB: An adaptation of "listio" from Argonne's PVFS.
+ */
 extern ssize_t SYSIO_INTERFACE_NAME(readx)(int fd,
-                                          const struct iovec *iov, 
+                                          const struct iovec *iov,
                                           size_t iov_count,
-                                          const struct xtvec *xtv, 
+                                          const struct xtvec *xtv,
                                           size_t xtv_count);
+
 #ifdef __USE_LARGEFILE64
+/*
+ * Read into buffers mapped by iovec from regions mapped
+ * by xtvec.
+ *
+ * NB: An adaptation of "listio" from Argonne's PVFS.
+ */
 extern ssize_t SYSIO_INTERFACE_NAME(read64x)(int fd,
-                                            const struct iovec *iov, 
+                                            const struct iovec *iov,
                                             size_t iov_count,
-                                            const struct xtvec64 *xtv, 
+                                            const struct xtvec64 *xtv,
                                             size_t xtv_count);
 #endif
+
+/*
+ * Post asynch write from buffers mapped by an iovec to file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ipwritev)(int fd,
+                                            const struct iovec *iov,
+                                            size_t count,
+                                            off_t offset);
+#ifdef _LARGEFILE64_SOURCE
+/*
+ * Post asynch write from buffers mapped by an iovec to file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ipwrite64v)(int fd,
+                                              const struct iovec *iov,
+                                              size_t count,
+                                              off64_t offset);
+#endif
+
+/*
+ * Post asynch write from buffer to file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ipwrite)(int fd,
+                                           const void *buf,
+                                           size_t count,
+                                           off_t offset);
+
+#ifdef _LARGEFILE64_SOURCE
+/*
+ * Post asynch write from buffer to file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(ipwrite64)(int fd,
+                                             const void *buf,
+                                             size_t count,
+                                             off64_t offset);
+#endif
+
+/*
+ * Write from buffers mapped by an iovec to file at given offset.
+ */
+extern ssize_t SYSIO_INTERFACE_NAME(pwritev)(int fd,
+                                            const struct iovec *iov,
+                                            _SYSIO_PREADV_T count,
+                                            off_t offset);
+
+#ifdef _LARGEFILE64_SOURCE
+/*
+ * Write from buffers mapped by an iovec to file at given offset.
+ */
+extern ssize_t SYSIO_INTERFACE_NAME(pwrite64v)(int fd,
+                                              const struct iovec *iov,
+                                              _SYSIO_PREADV_T count,
+                                              off64_t offset);
+#endif
+
+/*
+ * Post asynch write from buffer to file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(iwritev)(int fd,
+                                           const struct iovec *iov,
+                                           int count);
+
+/*
+ * Write from buffer to file at given offset.
+ */
+extern ioid_t SYSIO_INTERFACE_NAME(iwrite)(int fd,
+                                          const void *buf,
+                                          size_t count);
+
+/*
+ * Post async write from buffers mapped by iovec to regions mapped
+ * by xtvec.
+ *
+ * NB: An adaptation of "listio" from Argonne's PVFS.
+ */
 extern ioid_t SYSIO_INTERFACE_NAME(iwritex)(int fd,
-                                           const struct iovec *iov, 
+                                           const struct iovec *iov,
                                            size_t iov_count,
-                                           const struct xtvec *xtv, 
+                                           const struct xtvec *xtv,
                                            size_t xtv_count);
+
 #ifdef __USE_LARGEFILE64
+/*
+ * Post async write from buffers mapped by iovec to regions mapped
+ * by xtvec.
+ *
+ * NB: An adaptation of "listio" from Argonne's PVFS.
+ */
 extern ioid_t SYSIO_INTERFACE_NAME(iwrite64x)(int fd,
-                                             const struct iovec *iov, 
+                                             const struct iovec *iov,
                                              size_t iov_count,
-                                             const struct xtvec64 *xtv, 
+                                             const struct xtvec64 *xtv,
                                              size_t xtv_count);
 #endif
+
+/*
+ * Write from buffers mapped by iovec to regions mapped
+ * by xtvec.
+ *
+ * NB: An adaptation of "listio" from Argonne's PVFS.
+ */
 extern ssize_t SYSIO_INTERFACE_NAME(writex)(int fd,
-                                           const struct iovec *iov, 
+                                           const struct iovec *iov,
                                            size_t iov_count,
-                                           const struct xtvec *xtv, 
+                                           const struct xtvec *xtv,
                                            size_t xtv_count);
+
 #ifdef __USE_LARGEFILE64
+/*
+ * Write from buffers mapped by iovec to regions mapped
+ * by xtvec.
+ *
+ * NB: An adaptation of "listio" from Argonne's PVFS.
+ */
 extern ssize_t SYSIO_INTERFACE_NAME(write64x)(int fd,
                                              const struct iovec *iov, 
                                              size_t iov_count,
-                                             const struct xtvec64 *xtv, 
+                                             const struct xtvec64 *xtv,
                                              size_t xtv_count);
 #endif
+#endif /* ! _XTIO_H_ */