--- libeio/eio.h 2008/05/13 18:50:27 1.8 +++ libeio/eio.h 2008/05/13 19:34:11 1.11 @@ -8,8 +8,8 @@ typedef int (*eio_cb)(eio_req *req); -#ifndef EIO_COMMON -# define EIO_COMMON +#ifndef EIO_REQ_MEMBERS +# define EIO_REQ_MEMBERS #endif #ifndef EIO_STRUCT_STAT @@ -113,8 +113,9 @@ unsigned int eio_nthreads (void); /* number of worker threads in use currently */ /*****************************************************************************/ -/* high-level request API */ +/* convinience wrappers */ +#ifndef EIO_NO_WRAPPERS eio_req *eio_nop (int pri, eio_cb cb, void *data); /* does nothing except go through the whole process */ eio_req *eio_busy (eio_tstamp delay, int pri, eio_cb cb, void *data); /* ties a thread for this long, simulating busyness */ eio_req *eio_sync (int pri, eio_cb cb, void *data); @@ -147,18 +148,19 @@ 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); +#endif + +/*****************************************************************************/ +/* groups */ -/* for groups */ eio_req *eio_grp (eio_cb cb, void *data); void eio_grp_feed (eio_req *grp, void (*feed)(eio_req *req), int limit); void eio_grp_limit (eio_req *grp, int limit); void eio_grp_add (eio_req *grp, eio_req *req); void eio_grp_cancel (eio_req *grp); /* cancels all sub requests but not the group */ -/* cancel a request as soon fast as possible */ -void eio_cancel (eio_req *req); -/* destroy a request that has never been submitted */ -void eio_destroy (eio_req *req); +/*****************************************************************************/ +/* request api */ /* true if the request was cancelled, useful in the invoke callback */ #define EIO_CANCELLED(req) ((req)->flags & EIO_FLAG_CANCELLED) @@ -169,18 +171,12 @@ #define EIO_STAT_BUF(req) ((EIO_STRUCT_STAT *)EIO_BUF(req)) #define EIO_PATH(req) ((char *)(req)->ptr1) -/*****************************************************************************/ -/* low-level request API */ - -/* must be used to initialise eio_req's */ -#define EIO_INIT(req,prio,finish_cb, destroy_cb) \ - memset ((req), 0, sizeof (eio_req)); \ - (req)->pri = (prio) + EIO_PRI_BIAS; \ - (req)->finish = (finish_cb); \ - (req)->destroy = (destroy_cb) - /* submit a request for execution */ 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 */