aio_abi.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* include/linux/aio_abi.h
  2. *
  3. * Copyright 2000,2001,2002 Red Hat.
  4. *
  5. * Written by Benjamin LaHaise <bcrl@kvack.org>
  6. *
  7. * Distribute under the terms of the GPLv2 (see ../../COPYING) or under
  8. * the following terms.
  9. *
  10. * Permission to use, copy, modify, and distribute this software and its
  11. * documentation is hereby granted, provided that the above copyright
  12. * notice appears in all copies. This software is provided without any
  13. * warranty, express or implied. Red Hat makes no representations about
  14. * the suitability of this software for any purpose.
  15. *
  16. * IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
  17. * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
  18. * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED
  19. * OF THE POSSIBILITY OF SUCH DAMAGE.
  20. *
  21. * RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  23. * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
  24. * RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
  25. * ENHANCEMENTS, OR MODIFICATIONS.
  26. */
  27. #ifndef __LINUX__AIO_ABI_H
  28. #define __LINUX__AIO_ABI_H
  29. #include <linux/types.h>
  30. #include <linux/fs.h>
  31. #include <linux/signal.h>
  32. #include <asm/byteorder.h>
  33. typedef __kernel_ulong_t aio_context_t;
  34. enum {
  35. IOCB_CMD_PREAD = 0,
  36. IOCB_CMD_PWRITE = 1,
  37. IOCB_CMD_FSYNC = 2,
  38. IOCB_CMD_FDSYNC = 3,
  39. /* These two are experimental.
  40. * IOCB_CMD_PREADX = 4,
  41. * IOCB_CMD_POLL = 5,
  42. */
  43. IOCB_CMD_NOOP = 6,
  44. IOCB_CMD_PREADV = 7,
  45. IOCB_CMD_PWRITEV = 8,
  46. };
  47. /*
  48. * Valid flags for the "aio_flags" member of the "struct iocb".
  49. *
  50. * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb"
  51. * is valid.
  52. */
  53. #define IOCB_FLAG_RESFD (1 << 0)
  54. #define IOCB_FLAG_IOPRIO (1 << 1)
  55. /* read() from /dev/aio returns these structures. */
  56. struct io_event {
  57. __u64 data; /* the data field from the iocb */
  58. __u64 obj; /* what iocb this event came from */
  59. __s64 res; /* result code for this event */
  60. __s64 res2; /* secondary result */
  61. };
  62. /*
  63. * we always use a 64bit off_t when communicating
  64. * with userland. its up to libraries to do the
  65. * proper padding and aio_error abstraction
  66. */
  67. struct iocb {
  68. /* these are internal to the kernel/libc. */
  69. __u64 aio_data; /* data to be returned in event's data */
  70. #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
  71. __u32 aio_key; /* the kernel sets aio_key to the req # */
  72. __kernel_rwf_t aio_rw_flags; /* RWF_* flags */
  73. #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
  74. __kernel_rwf_t aio_rw_flags; /* RWF_* flags */
  75. __u32 aio_key; /* the kernel sets aio_key to the req # */
  76. #else
  77. #error edit for your odd byteorder.
  78. #endif
  79. /* common fields */
  80. __u16 aio_lio_opcode; /* see IOCB_CMD_ above */
  81. __s16 aio_reqprio;
  82. __u32 aio_fildes;
  83. __u64 aio_buf;
  84. __u64 aio_nbytes;
  85. __s64 aio_offset;
  86. /* extra parameters */
  87. __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */
  88. /* flags for the "struct iocb" */
  89. __u32 aio_flags;
  90. /*
  91. * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an
  92. * eventfd to signal AIO readiness to
  93. */
  94. __u32 aio_resfd;
  95. }; /* 64 bytes */
  96. #undef IFBIG
  97. #undef IFLITTLE
  98. struct __aio_sigset {
  99. sigset_t __user *sigmask;
  100. size_t sigsetsize;
  101. };
  102. #endif /* __LINUX__AIO_ABI_H */