| Uwe Zeisberger | f30c226 | 2006-10-03 23:01:26 +0200 | [diff] [blame] | 1 | /* include/linux/aio_abi.h | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 <asm/byteorder.h> | 
 | 31 |  | 
 | 32 | typedef unsigned long	aio_context_t; | 
 | 33 |  | 
 | 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, | 
| Badari Pulavarty | eed4e51 | 2006-09-30 23:28:49 -0700 | [diff] [blame] | 44 | 	IOCB_CMD_PREADV = 7, | 
 | 45 | 	IOCB_CMD_PWRITEV = 8, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | }; | 
 | 47 |  | 
| Davide Libenzi | 9c3060b | 2007-05-10 22:23:21 -0700 | [diff] [blame] | 48 | /* | 
 | 49 |  * Valid flags for the "aio_flags" member of the "struct iocb". | 
 | 50 |  * | 
 | 51 |  * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb" | 
 | 52 |  *                   is valid. | 
 | 53 |  */ | 
 | 54 | #define IOCB_FLAG_RESFD		(1 << 0) | 
 | 55 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | /* read() from /dev/aio returns these structures. */ | 
 | 57 | struct io_event { | 
 | 58 | 	__u64		data;		/* the data field from the iocb */ | 
 | 59 | 	__u64		obj;		/* what iocb this event came from */ | 
 | 60 | 	__s64		res;		/* result code for this event */ | 
 | 61 | 	__s64		res2;		/* secondary result */ | 
 | 62 | }; | 
 | 63 |  | 
 | 64 | #if defined(__LITTLE_ENDIAN) | 
 | 65 | #define PADDED(x,y)	x, y | 
 | 66 | #elif defined(__BIG_ENDIAN) | 
 | 67 | #define PADDED(x,y)	y, x | 
 | 68 | #else | 
 | 69 | #error edit for your odd byteorder. | 
 | 70 | #endif | 
 | 71 |  | 
 | 72 | /* | 
 | 73 |  * we always use a 64bit off_t when communicating | 
 | 74 |  * with userland.  its up to libraries to do the | 
 | 75 |  * proper padding and aio_error abstraction | 
 | 76 |  */ | 
 | 77 |  | 
 | 78 | struct iocb { | 
 | 79 | 	/* these are internal to the kernel/libc. */ | 
 | 80 | 	__u64	aio_data;	/* data to be returned in event's data */ | 
 | 81 | 	__u32	PADDED(aio_key, aio_reserved1); | 
 | 82 | 				/* the kernel sets aio_key to the req # */ | 
 | 83 |  | 
 | 84 | 	/* common fields */ | 
 | 85 | 	__u16	aio_lio_opcode;	/* see IOCB_CMD_ above */ | 
 | 86 | 	__s16	aio_reqprio; | 
 | 87 | 	__u32	aio_fildes; | 
 | 88 |  | 
 | 89 | 	__u64	aio_buf; | 
 | 90 | 	__u64	aio_nbytes; | 
 | 91 | 	__s64	aio_offset; | 
 | 92 |  | 
 | 93 | 	/* extra parameters */ | 
 | 94 | 	__u64	aio_reserved2;	/* TODO: use this for a (struct sigevent *) */ | 
| Davide Libenzi | 9c3060b | 2007-05-10 22:23:21 -0700 | [diff] [blame] | 95 |  | 
 | 96 | 	/* flags for the "struct iocb" */ | 
 | 97 | 	__u32	aio_flags; | 
 | 98 |  | 
 | 99 | 	/* | 
 | 100 | 	 * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an | 
 | 101 | 	 * eventfd to signal AIO readiness to | 
 | 102 | 	 */ | 
 | 103 | 	__u32	aio_resfd; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | }; /* 64 bytes */ | 
 | 105 |  | 
 | 106 | #undef IFBIG | 
 | 107 | #undef IFLITTLE | 
 | 108 |  | 
 | 109 | #endif /* __LINUX__AIO_ABI_H */ | 
 | 110 |  |