aio_abi.h
上传用户:szlgq88
上传日期:2009-04-28
资源大小:48287k
文件大小:3k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /* 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 <asm/byteorder.h>
  30. typedef unsigned long aio_context_t;
  31. enum {
  32. IOCB_CMD_PREAD = 0,
  33. IOCB_CMD_PWRITE = 1,
  34. IOCB_CMD_FSYNC = 2,
  35. IOCB_CMD_FDSYNC = 3,
  36. /* These two are experimental.
  37.  * IOCB_CMD_PREADX = 4,
  38.  * IOCB_CMD_POLL = 5,
  39.  */
  40. IOCB_CMD_NOOP = 6,
  41. };
  42. /* read() from /dev/aio returns these structures. */
  43. struct io_event {
  44. __u64 data; /* the data field from the iocb */
  45. __u64 obj; /* what iocb this event came from */
  46. __s64 res; /* result code for this event */
  47. __s64 res2; /* secondary result */
  48. };
  49. #if defined(__LITTLE_ENDIAN)
  50. #define PADDED(x,y) x, y
  51. #elif defined(__BIG_ENDIAN)
  52. #define PADDED(x,y) y, x
  53. #else
  54. #error edit for your odd byteorder.
  55. #endif
  56. /*
  57.  * we always use a 64bit off_t when communicating
  58.  * with userland.  its up to libraries to do the
  59.  * proper padding and aio_error abstraction
  60.  */
  61. struct iocb {
  62. /* these are internal to the kernel/libc. */
  63. __u64 aio_data; /* data to be returned in event's data */
  64. __u32 PADDED(aio_key, aio_reserved1);
  65. /* the kernel sets aio_key to the req # */
  66. /* common fields */
  67. __u16 aio_lio_opcode; /* see IOCB_CMD_ above */
  68. __s16 aio_reqprio;
  69. __u32 aio_fildes;
  70. __u64 aio_buf;
  71. __u64 aio_nbytes;
  72. __s64 aio_offset;
  73. /* extra parameters */
  74. __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */
  75. __u64 aio_reserved3;
  76. }; /* 64 bytes */
  77. #undef IFBIG
  78. #undef IFLITTLE
  79. #endif /* __LINUX__AIO_ABI_H */