… | |
… | |
233 | |
233 | |
234 | The C<void *data> member simply stores the value of the C<data> argument. |
234 | The C<void *data> member simply stores the value of the C<data> argument. |
235 | |
235 | |
236 | =back |
236 | =back |
237 | |
237 | |
|
|
238 | Memmbers not explicitly described as accessible must not be |
|
|
239 | accessed. Specifically, there is no gurantee that any members will still |
|
|
240 | have the value they had when the request was submitted. |
|
|
241 | |
238 | The return value of the callback is normally C<0>, which tells libeio to |
242 | The return value of the callback is normally C<0>, which tells libeio to |
239 | continue normally. If a callback returns a nonzero value, libeio will |
243 | continue normally. If a callback returns a nonzero value, libeio will |
240 | stop processing results (in C<eio_poll>) and will return the value to its |
244 | stop processing results (in C<eio_poll>) and will return the value to its |
241 | caller. |
245 | caller. |
242 | |
246 | |
243 | Memory areas passed to libeio must stay valid as long as a request |
247 | Memory areas passed to libeio wrappers must stay valid as long as a |
244 | executes, with the exception of paths, which are being copied |
248 | request executes, with the exception of paths, which are being copied |
245 | internally. Any memory libeio itself allocates will be freed after the |
249 | internally. Any memory libeio itself allocates will be freed after the |
246 | finish callback has been called. If you want to manage all memory passed |
250 | finish callback has been called. If you want to manage all memory passed |
247 | to libeio yourself you can use the low-level API. |
251 | to libeio yourself you can use the low-level API. |
248 | |
252 | |
249 | For example, to open a file, you could do this: |
253 | For example, to open a file, you could do this: |
… | |
… | |
592 | =item eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb, void *data) |
596 | =item eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb, void *data) |
593 | |
597 | |
594 | Calls C<readahead(2)>. If the syscall is missing, then the call is |
598 | Calls C<readahead(2)>. If the syscall is missing, then the call is |
595 | emulated by simply reading the data (currently in 64kiB chunks). |
599 | emulated by simply reading the data (currently in 64kiB chunks). |
596 | |
600 | |
|
|
601 | =item eio_syncfs (int fd, int pri, eio_cb cb, void *data) |
|
|
602 | |
|
|
603 | Calls Linux' C<syncfs> syscall, if available. Returns C<-1> and sets |
|
|
604 | C<errno> to C<ENOSYS> if the call is missing I<but still calls sync()>, |
|
|
605 | if the C<fd> is C<< >= 0 >>, so you can probe for the availability of the |
|
|
606 | syscall with a negative C<fd> argument and checking for C<-1/ENOSYS>. |
|
|
607 | |
597 | =item eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data) |
608 | =item eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data) |
598 | |
609 | |
599 | Calls C<sync_file_range>. If the syscall is missing, then this is the same |
610 | Calls C<sync_file_range>. If the syscall is missing, then this is the same |
600 | as calling C<fdatasync>. |
611 | as calling C<fdatasync>. |
601 | |
612 | |