--- libeio/eio.h 2011/06/05 22:44:30 1.31 +++ libeio/eio.h 2011/07/07 17:35:52 1.36 @@ -45,6 +45,7 @@ #endif #include +#include #include typedef struct eio_req eio_req; @@ -154,7 +155,7 @@ EIO_MLOCK, EIO_MLOCKALL, EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME, EIO_MKNOD, EIO_READDIR, - EIO_LINK, EIO_SYMLINK, EIO_READLINK, + EIO_LINK, EIO_SYMLINK, EIO_READLINK, EIO_REALPATH, EIO_GROUP, EIO_NOP, EIO_BUSY }; @@ -195,6 +196,12 @@ long int3; /* chown, fchown: gid */ int errorno; /* errno value on syscall return */ +#if __i386 || __amd64 + unsigned char cancelled; +#else + sig_atomic_t cancelled; +#endif + unsigned char flags; /* private */ signed char pri; /* the priority */ @@ -210,10 +217,9 @@ /* _private_ request flags */ enum { - EIO_FLAG_CANCELLED = 0x01, /* request was cancelled */ - EIO_FLAG_PTR1_FREE = 0x02, /* need to free(ptr1) */ - EIO_FLAG_PTR2_FREE = 0x04, /* need to free(ptr2) */ - EIO_FLAG_GROUPADD = 0x08 /* some request was added to the group */ + EIO_FLAG_PTR1_FREE = 0x01, /* need to free(ptr1) */ + EIO_FLAG_PTR2_FREE = 0x02, /* need to free(ptr2) */ + EIO_FLAG_GROUPADD = 0x04 /* some request was added to the group */ }; /* undocumented/unsupported/private helper */ @@ -245,7 +251,7 @@ unsigned int eio_nreqs (void); /* number of requests in-flight */ unsigned int eio_nready (void); /* number of not-yet handled requests */ -unsigned int eio_npending (void); /* numbe rof finished but unhandled requests */ +unsigned int eio_npending (void); /* number of finished but unhandled requests */ unsigned int eio_nthreads (void); /* number of worker threads in use currently */ /*****************************************************************************/ @@ -284,6 +290,7 @@ eio_req *eio_rmdir (const char *path, int pri, eio_cb cb, void *data); eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data); eio_req *eio_readlink (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */ +eio_req *eio_realpath (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */ eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ @@ -291,7 +298,7 @@ eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data); eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data); eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data); -eio_req *eio_custom (void (*)(eio_req *) execute, int pri, eio_cb cb, void *data); +eio_req *eio_custom (void (*execute)(eio_req *), int pri, eio_cb cb, void *data); #endif /*****************************************************************************/ @@ -307,7 +314,7 @@ /* request api */ /* true if the request was cancelled, useful in the invoke callback */ -#define EIO_CANCELLED(req) ((req)->flags & EIO_FLAG_CANCELLED) +#define EIO_CANCELLED(req) ((req)->cancelled) #define EIO_RESULT(req) ((req)->result) /* returns a pointer to the result buffer allocated by eio */ @@ -320,11 +327,9 @@ void eio_submit (eio_req *req); /* cancel a request as soon fast as possible, if possible */ void eio_cancel (eio_req *req); -/* destroy a request that has never been submitted */ -void eio_destroy (eio_req *req); /*****************************************************************************/ -/* convinience functions */ +/* convenience functions */ ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count);