Jeff Dike | 75e5584 | 2005-09-03 15:57:45 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004 Jeff Dike (jdike@karaya.com) |
| 3 | * Licensed under the GPL |
| 4 | */ |
| 5 | |
| 6 | #ifndef AIO_H__ |
| 7 | #define AIO_H__ |
| 8 | |
| 9 | enum aio_type { AIO_READ, AIO_WRITE, AIO_MMAP }; |
| 10 | |
| 11 | struct aio_thread_reply { |
| 12 | void *data; |
| 13 | int err; |
| 14 | }; |
| 15 | |
| 16 | struct aio_context { |
Jeff Dike | 09ace81 | 2005-09-03 15:57:46 -0700 | [diff] [blame] | 17 | enum aio_type type; |
| 18 | int fd; |
| 19 | void *data; |
| 20 | int len; |
| 21 | unsigned long long offset; |
Jeff Dike | 75e5584 | 2005-09-03 15:57:45 -0700 | [diff] [blame] | 22 | int reply_fd; |
| 23 | struct aio_context *next; |
| 24 | }; |
| 25 | |
Jeff Dike | 09ace81 | 2005-09-03 15:57:46 -0700 | [diff] [blame] | 26 | #define INIT_AIO(aio_type, aio_fd, aio_data, aio_len, aio_offset, \ |
| 27 | aio_reply_fd) \ |
| 28 | { .type = aio_type, \ |
| 29 | .fd = aio_fd, \ |
| 30 | .data = aio_data, \ |
| 31 | .len = aio_len, \ |
| 32 | .offset = aio_offset, \ |
| 33 | .reply_fd = aio_reply_fd } |
| 34 | |
Jeff Dike | 75e5584 | 2005-09-03 15:57:45 -0700 | [diff] [blame] | 35 | #define INIT_AIO_CONTEXT { .reply_fd = -1, \ |
| 36 | .next = NULL } |
| 37 | |
Jeff Dike | 09ace81 | 2005-09-03 15:57:46 -0700 | [diff] [blame] | 38 | extern int submit_aio(struct aio_context *aio); |
Jeff Dike | 75e5584 | 2005-09-03 15:57:45 -0700 | [diff] [blame] | 39 | |
| 40 | #endif |