1 | /* |
1 | /* |
2 | * libeio API header |
2 | * libeio API header |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libeio@schmorp.de> |
4 | * Copyright (c) 2007,2008,2009,2010,2011,2012 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 | * |
… | |
… | |
181 | { |
181 | { |
182 | EIO_CUSTOM, |
182 | EIO_CUSTOM, |
183 | EIO_WD_OPEN, EIO_WD_CLOSE, |
183 | EIO_WD_OPEN, EIO_WD_CLOSE, |
184 | |
184 | |
185 | EIO_CLOSE, EIO_DUP2, |
185 | EIO_CLOSE, EIO_DUP2, |
186 | EIO_READ, EIO_WRITE, |
186 | EIO_SEEK, EIO_READ, EIO_WRITE, |
187 | EIO_READAHEAD, EIO_SENDFILE, |
187 | EIO_READAHEAD, EIO_SENDFILE, |
188 | EIO_FSTAT, EIO_FSTATVFS, |
188 | EIO_FSTAT, EIO_FSTATVFS, |
189 | EIO_FTRUNCATE, EIO_FUTIME, EIO_FCHMOD, EIO_FCHOWN, |
189 | EIO_FTRUNCATE, EIO_FUTIME, EIO_FCHMOD, EIO_FCHOWN, |
190 | EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC, EIO_SYNCFS, |
190 | EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC, EIO_SYNCFS, |
191 | EIO_MSYNC, EIO_MTOUCH, EIO_SYNC_FILE_RANGE, EIO_FALLOCATE, |
191 | EIO_MSYNC, EIO_MTOUCH, EIO_SYNC_FILE_RANGE, EIO_FALLOCATE, |
… | |
… | |
210 | EIO_LINK, EIO_SYMLINK, EIO_READLINK, |
210 | EIO_LINK, EIO_SYMLINK, EIO_READLINK, |
211 | |
211 | |
212 | EIO_REQ_TYPE_NUM |
212 | EIO_REQ_TYPE_NUM |
213 | }; |
213 | }; |
214 | |
214 | |
|
|
215 | /* seek whence modes */ |
|
|
216 | /* these are guaranteed to hasve the traditional 0, 1, 2 values, */ |
|
|
217 | /* so you might as wlel use those */ |
|
|
218 | enum |
|
|
219 | { |
|
|
220 | EIO_SEEK_SET = 0, |
|
|
221 | EIO_SEEK_CUR = 1, |
|
|
222 | EIO_SEEK_END = 2 |
|
|
223 | }; |
|
|
224 | |
|
|
225 | |
215 | /* mlockall constants */ |
226 | /* mlockall constants */ |
216 | enum |
227 | enum |
217 | { |
228 | { |
218 | EIO_MCL_CURRENT = 1, |
229 | EIO_MCL_CURRENT = 1, |
219 | EIO_MCL_FUTURE = 2, |
230 | EIO_MCL_FUTURE = 2 |
220 | }; |
231 | }; |
221 | |
232 | |
222 | /* request priorities */ |
233 | /* request priorities */ |
223 | |
234 | |
224 | enum { |
235 | enum { |
225 | EIO_PRI_MIN = -4, |
236 | EIO_PRI_MIN = -4, |
226 | EIO_PRI_MAX = 4, |
237 | EIO_PRI_MAX = 4, |
227 | EIO_PRI_DEFAULT = 0, |
238 | EIO_PRI_DEFAULT = 0 |
228 | }; |
239 | }; |
229 | |
240 | |
230 | /* eio request structure */ |
241 | /* eio request structure */ |
231 | /* this structure is mostly read-only */ |
242 | /* this structure is mostly read-only */ |
232 | /* when initialising it, all members must be zero-initialised */ |
243 | /* when initialising it, all members must be zero-initialised */ |
… | |
… | |
244 | eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */ |
255 | eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */ |
245 | eio_tstamp nv2; /* utime, futime: mtime */ |
256 | eio_tstamp nv2; /* utime, futime: mtime */ |
246 | |
257 | |
247 | int type; /* EIO_xxx constant ETP */ |
258 | int type; /* EIO_xxx constant ETP */ |
248 | int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, mlockall, readdir: flags */ |
259 | int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, mlockall, readdir: flags */ |
249 | long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode, sync_file_range, fallocate: flags */ |
260 | long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode, seek: whence, sync_file_range, fallocate: flags */ |
250 | long int3; /* chown, fchown: gid; rename, link: working directory of new name */ |
261 | long int3; /* chown, fchown: gid; rename, link: working directory of new name */ |
251 | int errorno; /* errno value on syscall return */ |
262 | int errorno; /* errno value on syscall return */ |
252 | |
263 | |
253 | #if __i386 || __amd64 |
264 | #if __i386 || __amd64 |
254 | unsigned char cancelled; |
265 | unsigned char cancelled; |
… | |
… | |
326 | eio_req *eio_mlockall (int flags, int pri, eio_cb cb, void *data); |
337 | eio_req *eio_mlockall (int flags, int pri, eio_cb cb, void *data); |
327 | eio_req *eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data); |
338 | eio_req *eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data); |
328 | eio_req *eio_fallocate (int fd, int mode, off_t offset, size_t len, int pri, eio_cb cb, void *data); |
339 | eio_req *eio_fallocate (int fd, int mode, off_t offset, size_t len, int pri, eio_cb cb, void *data); |
329 | eio_req *eio_close (int fd, int pri, eio_cb cb, void *data); |
340 | eio_req *eio_close (int fd, int pri, eio_cb cb, void *data); |
330 | eio_req *eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb, void *data); |
341 | eio_req *eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb, void *data); |
|
|
342 | eio_req *eio_seek (int fd, off_t offset, int whence, int pri, eio_cb cb, void *data); |
331 | eio_req *eio_read (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data); |
343 | eio_req *eio_read (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data); |
332 | eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data); |
344 | eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data); |
333 | eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ |
345 | eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ |
334 | eio_req *eio_fstatvfs (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ |
346 | eio_req *eio_fstatvfs (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ |
335 | eio_req *eio_futime (int fd, eio_tstamp atime, eio_tstamp mtime, int pri, eio_cb cb, void *data); |
347 | eio_req *eio_futime (int fd, eio_tstamp atime, eio_tstamp mtime, int pri, eio_cb cb, void *data); |