aio.h 727 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (C) 2004 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef AIO_H__
  6. #define AIO_H__
  7. enum aio_type { AIO_READ, AIO_WRITE, AIO_MMAP };
  8. struct aio_thread_reply {
  9. void *data;
  10. int err;
  11. };
  12. struct aio_context {
  13. enum aio_type type;
  14. int fd;
  15. void *data;
  16. int len;
  17. unsigned long long offset;
  18. int reply_fd;
  19. struct aio_context *next;
  20. };
  21. #define INIT_AIO(aio_type, aio_fd, aio_data, aio_len, aio_offset, \
  22. aio_reply_fd) \
  23. { .type = aio_type, \
  24. .fd = aio_fd, \
  25. .data = aio_data, \
  26. .len = aio_len, \
  27. .offset = aio_offset, \
  28. .reply_fd = aio_reply_fd }
  29. #define INIT_AIO_CONTEXT { .reply_fd = -1, \
  30. .next = NULL }
  31. extern int submit_aio(struct aio_context *aio);
  32. #endif