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