… | |
… | |
43 | #ifdef __cplusplus |
43 | #ifdef __cplusplus |
44 | extern "C" { |
44 | extern "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 | |
50 | typedef struct eio_req eio_req; |
51 | typedef struct eio_req eio_req; |
51 | typedef struct eio_dirent eio_dirent; |
52 | typedef struct eio_dirent eio_dirent; |
52 | |
53 | |
… | |
… | |
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 */ |
212 | enum { |
219 | enum { |
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 | |
… | |
… | |
306 | |
312 | |
307 | /*****************************************************************************/ |
313 | /*****************************************************************************/ |
308 | /* request api */ |
314 | /* request api */ |
309 | |
315 | |
310 | /* true if the request was cancelled, useful in the invoke callback */ |
316 | /* true if the request was cancelled, useful in the invoke callback */ |
311 | #define EIO_CANCELLED(req) ((req)->flags & EIO_FLAG_CANCELLED) |
317 | #define EIO_CANCELLED(req) ((req)->cancelled) |
312 | |
318 | |
313 | #define EIO_RESULT(req) ((req)->result) |
319 | #define EIO_RESULT(req) ((req)->result) |
314 | /* returns a pointer to the result buffer allocated by eio */ |
320 | /* returns a pointer to the result buffer allocated by eio */ |
315 | #define EIO_BUF(req) ((req)->ptr2) |
321 | #define EIO_BUF(req) ((req)->ptr2) |
316 | #define EIO_STAT_BUF(req) ((EIO_STRUCT_STAT *)EIO_BUF(req)) |
322 | #define EIO_STAT_BUF(req) ((EIO_STRUCT_STAT *)EIO_BUF(req)) |