Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / aio_abi.h
blob30fdcc89d14213fecec5ff69c8dfa98f7e4fa5f2
1 /* linux/aio_abi.h
3 * Copyright 2000,2001,2002 Red Hat.
5 * Written by Benjamin LaHaise <bcrl@kvack.org>
7 * Distribute under the terms of the GPLv2 (see ../../COPYING) or under
8 * the following terms.
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.
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.
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.
27 #ifndef __LINUX__AIO_ABI_H
28 #define __LINUX__AIO_ABI_H
30 #include <asm/byteorder.h>
32 typedef unsigned long 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,
43 IOCB_CMD_NOOP = 6,
46 /* read() from /dev/aio returns these structures. */
47 struct io_event {
48 __u64 data; /* the data field from the iocb */
49 __u64 obj; /* what iocb this event came from */
50 __s64 res; /* result code for this event */
51 __s64 res2; /* secondary result */
54 #if defined(__LITTLE_ENDIAN)
55 #define PADDED(x,y) x, y
56 #elif defined(__BIG_ENDIAN)
57 #define PADDED(x,y) y, x
58 #else
59 #error edit for your odd byteorder.
60 #endif
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
68 struct iocb {
69 /* these are internal to the kernel/libc. */
70 __u64 aio_data; /* data to be returned in event's data */
71 __u32 PADDED(aio_key, aio_reserved1);
72 /* the kernel sets aio_key to the req # */
74 /* common fields */
75 __u16 aio_lio_opcode; /* see IOCB_CMD_ above */
76 __s16 aio_reqprio;
77 __u32 aio_fildes;
79 __u64 aio_buf;
80 __u64 aio_nbytes;
81 __s64 aio_offset;
83 /* extra parameters */
84 __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */
85 __u64 aio_reserved3;
86 }; /* 64 bytes */
88 #undef IFBIG
89 #undef IFLITTLE
91 #endif /* __LINUX__AIO_ABI_H */