ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/eio.h
(Generate patch)

Comparing libeio/eio.h (file contents):
Revision 1.12 by root, Sat May 17 12:17:25 2008 UTC vs.
Revision 1.15 by root, Tue Jun 17 23:58:48 2008 UTC

38 */ 38 */
39 39
40#ifndef EIO_H_ 40#ifndef EIO_H_
41#define EIO_H_ 41#define EIO_H_
42 42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
43#include <stddef.h> 47#include <stddef.h>
44#include <sys/types.h> 48#include <sys/types.h>
45 49
46typedef struct eio_req eio_req; 50typedef struct eio_req eio_req;
47 51
67 EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC, 71 EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC,
68 EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME, 72 EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME,
69 EIO_MKNOD, EIO_READDIR, 73 EIO_MKNOD, EIO_READDIR,
70 EIO_LINK, EIO_SYMLINK, EIO_READLINK, 74 EIO_LINK, EIO_SYMLINK, EIO_READLINK,
71 EIO_GROUP, EIO_NOP, 75 EIO_GROUP, EIO_NOP,
72 EIO_BUSY, 76 EIO_BUSY, EIO_CUSTOM
73}; 77};
74 78
75typedef double eio_tstamp; /* feel free to use double in your code directly */ 79typedef double eio_tstamp; /* feel free to use double in your code directly */
76 80
77/* eio request structure */ 81/* eio request structure */
79struct eio_req 83struct eio_req
80{ 84{
81 eio_req volatile *next; /* private ETP */ 85 eio_req volatile *next; /* private ETP */
82 86
83 ssize_t result; /* result of syscall, e.g. result = read (... */ 87 ssize_t result; /* result of syscall, e.g. result = read (... */
84 off_t offs; /* read, write, truncate, readahead: file offset; mknod: dev_t */ 88 off_t offs; /* read, write, truncate, readahead: file offset */
85 size_t size; /* read, write, readahead, sendfile: length */ 89 size_t size; /* read, write, readahead, sendfile: length */
86 void *ptr1; /* all applicable requests: pathname, old name */ 90 void *ptr1; /* all applicable requests: pathname, old name */
87 void *ptr2; /* all applicable requests: new name or memory buffer */ 91 void *ptr2; /* all applicable requests: new name or memory buffer */
88 eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */ 92 eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */
89 eio_tstamp nv2; /* utime, futime: mtime */ 93 eio_tstamp nv2; /* utime, futime: mtime */
90 94
91 int type; /* EIO_xxx constant ETP */ 95 int type; /* EIO_xxx constant ETP */
92 int int1; /* all applicable requests: file descriptor; sendfile: output fd; open: flags */ 96 int int1; /* all applicable requests: file descriptor; sendfile: output fd; open: flags */
93 long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode */ 97 long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode */
94 long int3; /* chown, fchown: gid */ 98 long int3; /* chown, fchown: gid; mknod: dev_t */
95 int errorno; /* errno value on syscall return */ 99 int errorno; /* errno value on syscall return */
96 100
97 unsigned char flags; /* private */ 101 unsigned char flags; /* private */
98 signed char pri; /* the priority */ 102 signed char pri; /* the priority */
99 103
114}; 118};
115 119
116enum { 120enum {
117 EIO_PRI_MIN = -4, 121 EIO_PRI_MIN = -4,
118 EIO_PRI_MAX = 4, 122 EIO_PRI_MAX = 4,
119
120 EIO_PRI_DEFAULT = 0, 123 EIO_PRI_DEFAULT = 0,
121}; 124};
122 125
123/* returns < 0 on error, errno set 126/* returns < 0 on error, errno set
124 * need_poll, if non-zero, will be called when results are available 127 * need_poll, if non-zero, will be called when results are available
125 * and eio_poll_cb needs to be invoked (it MUST NOT call eio_poll_cb itself). 128 * and eio_poll_cb needs to be invoked (it MUST NOT call eio_poll_cb itself).
182eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ 185eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
183eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data); 186eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data);
184eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 187eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
185eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 188eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
186eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 189eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
190eio_req *eio_custom (eio_cb execute, int pri, eio_cb cb, void *data);
187#endif 191#endif
188 192
189/*****************************************************************************/ 193/*****************************************************************************/
190/* groups */ 194/* groups */
191 195
217/*****************************************************************************/ 221/*****************************************************************************/
218/* convinience functions */ 222/* convinience functions */
219 223
220ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count); 224ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count);
221 225
226#ifdef __cplusplus
227}
222#endif 228#endif
223 229
230#endif
231

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines