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

Comparing libeio/eio.h (file contents):
Revision 1.31 by root, Sun Jun 5 22:44:30 2011 UTC vs.
Revision 1.35 by root, Tue Jul 5 20:34:42 2011 UTC

43#ifdef __cplusplus 43#ifdef __cplusplus
44extern "C" { 44extern "C" {
45#endif 45#endif
46 46
47#include <stddef.h> 47#include <stddef.h>
48#include <signal.h>
48#include <sys/types.h> 49#include <sys/types.h>
49 50
50typedef struct eio_req eio_req; 51typedef struct eio_req eio_req;
51typedef struct eio_dirent eio_dirent; 52typedef struct eio_dirent eio_dirent;
52 53
152 EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC, 153 EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC,
153 EIO_MSYNC, EIO_MTOUCH, EIO_SYNC_FILE_RANGE, 154 EIO_MSYNC, EIO_MTOUCH, EIO_SYNC_FILE_RANGE,
154 EIO_MLOCK, EIO_MLOCKALL, 155 EIO_MLOCK, EIO_MLOCKALL,
155 EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME, 156 EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME,
156 EIO_MKNOD, EIO_READDIR, 157 EIO_MKNOD, EIO_READDIR,
157 EIO_LINK, EIO_SYMLINK, EIO_READLINK, 158 EIO_LINK, EIO_SYMLINK, EIO_READLINK, EIO_REALPATH,
158 EIO_GROUP, EIO_NOP, 159 EIO_GROUP, EIO_NOP,
159 EIO_BUSY 160 EIO_BUSY
160}; 161};
161 162
162/* mlockall constants */ 163/* mlockall constants */
193 int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, mlockall, readdir: flags */ 194 int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, mlockall, readdir: flags */
194 long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode, sync_file_range: flags */ 195 long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode, sync_file_range: flags */
195 long int3; /* chown, fchown: gid */ 196 long int3; /* chown, fchown: gid */
196 int errorno; /* errno value on syscall return */ 197 int errorno; /* errno value on syscall return */
197 198
199#if __i386 || __amd64
200 unsigned char cancelled;
201#else
202 sig_atomic_t cancelled;
203#endif
204
198 unsigned char flags; /* private */ 205 unsigned char flags; /* private */
199 signed char pri; /* the priority */ 206 signed char pri; /* the priority */
200 207
201 void *data; 208 void *data;
202 eio_cb finish; 209 eio_cb finish;
208 eio_req *grp, *grp_prev, *grp_next, *grp_first; /* private */ 215 eio_req *grp, *grp_prev, *grp_next, *grp_first; /* private */
209}; 216};
210 217
211/* _private_ request flags */ 218/* _private_ request flags */
212enum { 219enum {
213 EIO_FLAG_CANCELLED = 0x01, /* request was cancelled */
214 EIO_FLAG_PTR1_FREE = 0x02, /* need to free(ptr1) */ 220 EIO_FLAG_PTR1_FREE = 0x01, /* need to free(ptr1) */
215 EIO_FLAG_PTR2_FREE = 0x04, /* need to free(ptr2) */ 221 EIO_FLAG_PTR2_FREE = 0x02, /* need to free(ptr2) */
216 EIO_FLAG_GROUPADD = 0x08 /* some request was added to the group */ 222 EIO_FLAG_GROUPADD = 0x04 /* some request was added to the group */
217}; 223};
218 224
219/* undocumented/unsupported/private helper */ 225/* undocumented/unsupported/private helper */
220/*void eio_page_align (void **addr, size_t *length);*/ 226/*void eio_page_align (void **addr, size_t *length);*/
221 227
282eio_req *eio_mkdir (const char *path, mode_t mode, int pri, eio_cb cb, void *data); 288eio_req *eio_mkdir (const char *path, mode_t mode, int pri, eio_cb cb, void *data);
283eio_req *eio_readdir (const char *path, int flags, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */ 289eio_req *eio_readdir (const char *path, int flags, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
284eio_req *eio_rmdir (const char *path, int pri, eio_cb cb, void *data); 290eio_req *eio_rmdir (const char *path, int pri, eio_cb cb, void *data);
285eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data); 291eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data);
286eio_req *eio_readlink (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */ 292eio_req *eio_readlink (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
293eio_req *eio_realpath (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
287eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ 294eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
288eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ 295eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
289eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ 296eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
290eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data); 297eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data);
291eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 298eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
292eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 299eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
293eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 300eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
294eio_req *eio_custom (void (*)(eio_req *) execute, int pri, eio_cb cb, void *data); 301eio_req *eio_custom (void (*execute)(eio_req *), int pri, eio_cb cb, void *data);
295#endif 302#endif
296 303
297/*****************************************************************************/ 304/*****************************************************************************/
298/* groups */ 305/* groups */
299 306
305 312
306/*****************************************************************************/ 313/*****************************************************************************/
307/* request api */ 314/* request api */
308 315
309/* true if the request was cancelled, useful in the invoke callback */ 316/* true if the request was cancelled, useful in the invoke callback */
310#define EIO_CANCELLED(req) ((req)->flags & EIO_FLAG_CANCELLED) 317#define EIO_CANCELLED(req) ((req)->cancelled)
311 318
312#define EIO_RESULT(req) ((req)->result) 319#define EIO_RESULT(req) ((req)->result)
313/* returns a pointer to the result buffer allocated by eio */ 320/* returns a pointer to the result buffer allocated by eio */
314#define EIO_BUF(req) ((req)->ptr2) 321#define EIO_BUF(req) ((req)->ptr2)
315#define EIO_STAT_BUF(req) ((EIO_STRUCT_STAT *)EIO_BUF(req)) 322#define EIO_STAT_BUF(req) ((EIO_STRUCT_STAT *)EIO_BUF(req))
318 325
319/* submit a request for execution */ 326/* submit a request for execution */
320void eio_submit (eio_req *req); 327void eio_submit (eio_req *req);
321/* cancel a request as soon fast as possible, if possible */ 328/* cancel a request as soon fast as possible, if possible */
322void eio_cancel (eio_req *req); 329void eio_cancel (eio_req *req);
323/* destroy a request that has never been submitted */
324void eio_destroy (eio_req *req);
325 330
326/*****************************************************************************/ 331/*****************************************************************************/
327/* convinience functions */ 332/* convenience functions */
328 333
329ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count); 334ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count);
330 335
331#ifdef __cplusplus 336#ifdef __cplusplus
332} 337}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines