Back to home page

OSCL-LXR

 
 

    


0001 /* include/linux/aio_abi.h
0002  *
0003  * Copyright 2000,2001,2002 Red Hat.
0004  *
0005  * Written by Benjamin LaHaise <bcrl@kvack.org>
0006  *
0007  * Distribute under the terms of the GPLv2 (see ../../COPYING) or under 
0008  * the following terms.
0009  *
0010  * Permission to use, copy, modify, and distribute this software and its
0011  * documentation is hereby granted, provided that the above copyright
0012  * notice appears in all copies.  This software is provided without any
0013  * warranty, express or implied.  Red Hat makes no representations about
0014  * the suitability of this software for any purpose.
0015  *
0016  * IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
0017  * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
0018  * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED
0019  * OF THE POSSIBILITY OF SUCH DAMAGE.
0020  *
0021  * RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
0023  * PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
0024  * RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
0025  * ENHANCEMENTS, OR MODIFICATIONS.
0026  */
0027 #ifndef __LINUX__AIO_ABI_H
0028 #define __LINUX__AIO_ABI_H
0029 
0030 #include <linux/types.h>
0031 #include <linux/fs.h>
0032 #include <asm/byteorder.h>
0033 
0034 typedef __kernel_ulong_t aio_context_t;
0035 
0036 enum {
0037     IOCB_CMD_PREAD = 0,
0038     IOCB_CMD_PWRITE = 1,
0039     IOCB_CMD_FSYNC = 2,
0040     IOCB_CMD_FDSYNC = 3,
0041     /* 4 was the experimental IOCB_CMD_PREADX */
0042     IOCB_CMD_POLL = 5,
0043     IOCB_CMD_NOOP = 6,
0044     IOCB_CMD_PREADV = 7,
0045     IOCB_CMD_PWRITEV = 8,
0046 };
0047 
0048 /*
0049  * Valid flags for the "aio_flags" member of the "struct iocb".
0050  *
0051  * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb"
0052  *                   is valid.
0053  * IOCB_FLAG_IOPRIO - Set if the "aio_reqprio" member of the "struct iocb"
0054  *                    is valid.
0055  */
0056 #define IOCB_FLAG_RESFD     (1 << 0)
0057 #define IOCB_FLAG_IOPRIO    (1 << 1)
0058 
0059 /* read() from /dev/aio returns these structures. */
0060 struct io_event {
0061     __u64       data;       /* the data field from the iocb */
0062     __u64       obj;        /* what iocb this event came from */
0063     __s64       res;        /* result code for this event */
0064     __s64       res2;       /* secondary result */
0065 };
0066 
0067 /*
0068  * we always use a 64bit off_t when communicating
0069  * with userland.  its up to libraries to do the
0070  * proper padding and aio_error abstraction
0071  */
0072 
0073 struct iocb {
0074     /* these are internal to the kernel/libc. */
0075     __u64   aio_data;   /* data to be returned in event's data */
0076 
0077 #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
0078     __u32   aio_key;    /* the kernel sets aio_key to the req # */
0079     __kernel_rwf_t aio_rw_flags;    /* RWF_* flags */
0080 #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
0081     __kernel_rwf_t aio_rw_flags;    /* RWF_* flags */
0082     __u32   aio_key;    /* the kernel sets aio_key to the req # */
0083 #else
0084 #error edit for your odd byteorder.
0085 #endif
0086 
0087     /* common fields */
0088     __u16   aio_lio_opcode; /* see IOCB_CMD_ above */
0089     __s16   aio_reqprio;
0090     __u32   aio_fildes;
0091 
0092     __u64   aio_buf;
0093     __u64   aio_nbytes;
0094     __s64   aio_offset;
0095 
0096     /* extra parameters */
0097     __u64   aio_reserved2;  /* TODO: use this for a (struct sigevent *) */
0098 
0099     /* flags for the "struct iocb" */
0100     __u32   aio_flags;
0101 
0102     /*
0103      * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an
0104      * eventfd to signal AIO readiness to
0105      */
0106     __u32   aio_resfd;
0107 }; /* 64 bytes */
0108 
0109 #undef IFBIG
0110 #undef IFLITTLE
0111 
0112 #endif /* __LINUX__AIO_ABI_H */
0113