1 | #ifndef EIO_H_ |
1 | #ifndef EIO_H_ |
2 | #define EIO_H_ |
2 | #define EIO_H_ |
3 | |
3 | |
4 | #include <stddef.h> |
4 | #include <stddef.h> |
5 | #include <stdlib.h> |
5 | #include <sys/types.h> |
6 | |
6 | |
7 | typedef struct eio_req eio_req; |
7 | typedef struct eio_req eio_req; |
8 | |
8 | |
9 | typedef int (*eio_cb)(eio_req *req); |
9 | typedef int (*eio_cb)(eio_req *req); |
10 | |
10 | |
… | |
… | |
44 | ssize_t result; /* result of syscall, e.g. result = read (... */ |
44 | ssize_t result; /* result of syscall, e.g. result = read (... */ |
45 | off_t offs; /* read, write, truncate, readahead: file offset; mknod: dev_t */ |
45 | off_t offs; /* read, write, truncate, readahead: file offset; mknod: dev_t */ |
46 | size_t size; /* read, write, readahead, sendfile: length */ |
46 | size_t size; /* read, write, readahead, sendfile: length */ |
47 | void *ptr1; /* all applicable requests: pathname, old name */ |
47 | void *ptr1; /* all applicable requests: pathname, old name */ |
48 | void *ptr2; /* all applicable requests: new name or memory buffer */ |
48 | void *ptr2; /* all applicable requests: new name or memory buffer */ |
49 | eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */ |
49 | eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */ |
50 | eio_tstamp nv2; /* utime, futime: mtime */ |
50 | eio_tstamp nv2; /* utime, futime: mtime */ |
51 | |
51 | |
52 | int type; /* EIO_xxx constant */ |
52 | int type; /* EIO_xxx constant */ |
53 | int int1; /* all applicable requests: file descriptor; sendfile: output fd; open: flags */ |
53 | int int1; /* all applicable requests: file descriptor; sendfile: output fd; open: flags */ |
54 | long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode */ |
54 | long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode */ |
55 | long int3; /* chown, fchown: gid */ |
55 | long int3; /* chown, fchown: gid */ |
… | |
… | |
92 | |
92 | |
93 | /* stop polling if poll took longer than duration seconds */ |
93 | /* stop polling if poll took longer than duration seconds */ |
94 | void eio_set_max_poll_time (eio_tstamp nseconds); |
94 | void eio_set_max_poll_time (eio_tstamp nseconds); |
95 | /* do not handle more then count requests in one call to eio_poll_cb */ |
95 | /* do not handle more then count requests in one call to eio_poll_cb */ |
96 | void eio_set_max_poll_reqs (unsigned int nreqs); |
96 | void eio_set_max_poll_reqs (unsigned int nreqs); |
97 | /* when != 0, then eio_submit blocks as long as nready > count */ |
|
|
98 | void eio_set_max_outstanding (unsigned int maxreqs); |
|
|
99 | /* set maxinum number of idle threads */ |
|
|
100 | void eio_set_max_idle (unsigned int nthreads); |
|
|
101 | |
97 | |
102 | /* set minimum required number |
98 | /* set minimum required number |
103 | * maximum wanted number |
99 | * maximum wanted number |
104 | * or maximum idle number of threads */ |
100 | * or maximum idle number of threads */ |
105 | void eio_set_min_parallel (unsigned int nthreads); |
101 | void eio_set_min_parallel (unsigned int nthreads); |
… | |
… | |
143 | eio_req *eio_busy (eio_tstamp delay, eio_cb cb); /* ties a thread for this long, simulating busyness */ |
139 | eio_req *eio_busy (eio_tstamp delay, eio_cb cb); /* ties a thread for this long, simulating busyness */ |
144 | eio_req *eio_nop (eio_cb cb); /* does nothing except go through the whole process */ |
140 | eio_req *eio_nop (eio_cb cb); /* does nothing except go through the whole process */ |
145 | |
141 | |
146 | /* for groups */ |
142 | /* for groups */ |
147 | eio_req *eio_grp (eio_cb cb); |
143 | eio_req *eio_grp (eio_cb cb); |
148 | void eio_grp_feed (eio_req *grp, int limit, void (*feed)(eio_req *req)); |
144 | void eio_grp_feed (eio_req *grp, void (*feed)(eio_req *req), int limit); |
|
|
145 | void eio_grp_limit (eio_req *grp, int limit); |
149 | void eio_grp_add (eio_req *grp, eio_req *req); |
146 | void eio_grp_add (eio_req *grp, eio_req *req); |
150 | void eio_grp_cancel (eio_req *grp); /* cancels all sub requests but not the group */ |
147 | void eio_grp_cancel (eio_req *grp); /* cancels all sub requests but not the group */ |
151 | |
148 | |
152 | /*****************************************************************************/ |
149 | /*****************************************************************************/ |
153 | /* low-level request API */ |
150 | /* low-level request API */ |