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

Comparing libeio/eio.h (file contents):
Revision 1.27 by root, Sun Sep 12 03:36:28 2010 UTC vs.
Revision 1.33 by root, Tue Jul 5 09:24:12 2011 UTC

1/* 1/*
2 * libeio API header 2 * libeio API header
3 * 3 *
4 * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libeio@schmorp.de> 4 * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libeio@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
152 EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC, 152 EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC,
153 EIO_MSYNC, EIO_MTOUCH, EIO_SYNC_FILE_RANGE, 153 EIO_MSYNC, EIO_MTOUCH, EIO_SYNC_FILE_RANGE,
154 EIO_MLOCK, EIO_MLOCKALL, 154 EIO_MLOCK, EIO_MLOCKALL,
155 EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME, 155 EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME,
156 EIO_MKNOD, EIO_READDIR, 156 EIO_MKNOD, EIO_READDIR,
157 EIO_LINK, EIO_SYMLINK, EIO_READLINK, 157 EIO_LINK, EIO_SYMLINK, EIO_READLINK, EIO_REALPATH,
158 EIO_GROUP, EIO_NOP, 158 EIO_GROUP, EIO_NOP,
159 EIO_BUSY 159 EIO_BUSY
160}; 160};
161 161
162/* mlockall constants */ 162/* mlockall constants */
180struct eio_req 180struct eio_req
181{ 181{
182 eio_req volatile *next; /* private ETP */ 182 eio_req volatile *next; /* private ETP */
183 183
184 ssize_t result; /* result of syscall, e.g. result = read (... */ 184 ssize_t result; /* result of syscall, e.g. result = read (... */
185 off_t offs; /* read, write, truncate, readahead, sync_file_range: file offset */ 185 off_t offs; /* read, write, truncate, readahead, sync_file_range: file offset, mknod: dev_t */
186 size_t size; /* read, write, readahead, sendfile, msync, mlock, sync_file_range: length */ 186 size_t size; /* read, write, readahead, sendfile, msync, mlock, sync_file_range: length */
187 void *ptr1; /* all applicable requests: pathname, old name; readdir: optional eio_dirents */ 187 void *ptr1; /* all applicable requests: pathname, old name; readdir: optional eio_dirents */
188 void *ptr2; /* all applicable requests: new name or memory buffer; readdir: name strings */ 188 void *ptr2; /* all applicable requests: new name or memory buffer; readdir: name strings */
189 eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */ 189 eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */
190 eio_tstamp nv2; /* utime, futime: mtime */ 190 eio_tstamp nv2; /* utime, futime: mtime */
191 191
192 int type; /* EIO_xxx constant ETP */ 192 int type; /* EIO_xxx constant ETP */
193 int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, mlockall, readdir: flags */ 193 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 */ 194 long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode, sync_file_range: flags */
195 long int3; /* chown, fchown: gid; mknod: dev_t */ 195 long int3; /* chown, fchown: gid */
196 int errorno; /* errno value on syscall return */ 196 int errorno; /* errno value on syscall return */
197 197
198 unsigned char flags; /* private */ 198 unsigned char flags; /* private */
199 signed char pri; /* the priority */ 199 signed char pri; /* the priority */
200 200
201 void *data; 201 void *data;
202 eio_cb finish; 202 eio_cb finish;
203 void (*destroy)(eio_req *req); /* called when requets no longer needed */ 203 void (*destroy)(eio_req *req); /* called when request no longer needed */
204 void (*feed)(eio_req *req); /* only used for group requests */ 204 void (*feed)(eio_req *req); /* only used for group requests */
205 205
206 EIO_REQ_MEMBERS 206 EIO_REQ_MEMBERS
207 207
208 eio_req *grp, *grp_prev, *grp_next, *grp_first; /* private */ 208 eio_req *grp, *grp_prev, *grp_next, *grp_first; /* private */
239 * maximum wanted number 239 * maximum wanted number
240 * or maximum idle number of threads */ 240 * or maximum idle number of threads */
241void eio_set_min_parallel (unsigned int nthreads); 241void eio_set_min_parallel (unsigned int nthreads);
242void eio_set_max_parallel (unsigned int nthreads); 242void eio_set_max_parallel (unsigned int nthreads);
243void eio_set_max_idle (unsigned int nthreads); 243void eio_set_max_idle (unsigned int nthreads);
244void eio_set_idle_timeout (unsigned int seconds);
244 245
245unsigned int eio_nreqs (void); /* number of requests in-flight */ 246unsigned int eio_nreqs (void); /* number of requests in-flight */
246unsigned int eio_nready (void); /* number of not-yet handled requests */ 247unsigned int eio_nready (void); /* number of not-yet handled requests */
247unsigned int eio_npending (void); /* numbe rof finished but unhandled requests */ 248unsigned int eio_npending (void); /* numbe rof finished but unhandled requests */
248unsigned int eio_nthreads (void); /* number of worker threads in use currently */ 249unsigned int eio_nthreads (void); /* number of worker threads in use currently */
249 250
250/*****************************************************************************/ 251/*****************************************************************************/
251/* convinience wrappers */ 252/* convenience wrappers */
252 253
253#ifndef EIO_NO_WRAPPERS 254#ifndef EIO_NO_WRAPPERS
254eio_req *eio_nop (int pri, eio_cb cb, void *data); /* does nothing except go through the whole process */ 255eio_req *eio_nop (int pri, eio_cb cb, void *data); /* does nothing except go through the whole process */
255eio_req *eio_busy (eio_tstamp delay, int pri, eio_cb cb, void *data); /* ties a thread for this long, simulating busyness */ 256eio_req *eio_busy (eio_tstamp delay, int pri, eio_cb cb, void *data); /* ties a thread for this long, simulating busyness */
256eio_req *eio_sync (int pri, eio_cb cb, void *data); 257eio_req *eio_sync (int pri, eio_cb cb, void *data);
281eio_req *eio_mkdir (const char *path, mode_t mode, int pri, eio_cb cb, void *data); 282eio_req *eio_mkdir (const char *path, mode_t mode, int pri, eio_cb cb, void *data);
282eio_req *eio_readdir (const char *path, int flags, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */ 283eio_req *eio_readdir (const char *path, int flags, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
283eio_req *eio_rmdir (const char *path, int pri, eio_cb cb, void *data); 284eio_req *eio_rmdir (const char *path, int pri, eio_cb cb, void *data);
284eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data); 285eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data);
285eio_req *eio_readlink (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */ 286eio_req *eio_readlink (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
287eio_req *eio_realpath (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
286eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ 288eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
287eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ 289eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
288eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ 290eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
289eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data); 291eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data);
290eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 292eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
291eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 293eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
292eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data); 294eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
293eio_req *eio_custom (eio_cb execute, int pri, eio_cb cb, void *data); 295eio_req *eio_custom (void (*execute)(eio_req *), int pri, eio_cb cb, void *data);
294#endif 296#endif
295 297
296/*****************************************************************************/ 298/*****************************************************************************/
297/* groups */ 299/* groups */
298 300

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines