VirtualBox

Changeset 21505 in vbox for trunk/src/VBox/Runtime/r3/linux


Ignore:
Timestamp:
Jul 10, 2009 9:54:21 PM (15 years ago)
Author:
vboxsync
Message:

Fix Linux AIO by removing the needed header and defining needed types in the file. We didn't used that much from the header anyway and Linus sayed once that interfaces from kernel to user space wont change in an incompatible way so I think we are safe.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/linux/fileaio-linux.cpp

    r21504 r21505  
    6363#include "internal/fileaio.h"
    6464
    65 /* Prevent including some header files the C++ compiler doesn't like. */
    66 #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
    67 #define _LINUX_BYTEORDER_SWABB_H
    68 #include <linux/aio_abi.h>
    6965#include <unistd.h>
    7066#include <sys/syscall.h>
     
    7773*   Structures and Typedefs                                                    *
    7874*******************************************************************************/
     75/** The async I/O context handle */
     76typedef unsigned long LNXKAIOCONTEXT;
     77
     78/**
     79 * Supported commands for the iocbs
     80 */
     81enum
     82{
     83    LNXKAIO_IOCB_CMD_READ = 0,
     84    LNXKAIO_IOCB_CMD_WRITE
     85};
     86
    7987/**
    8088 * The iocb structure of a request which is passed to the kernel.
     
    167175{
    168176    /** Handle to the async I/O context. */
    169     aio_context_t       AioContext;
     177    LNXKAIOCONTEXT      AioContext;
    170178    /** Maximum number of requests this context can handle. */
    171179    int                 cRequestsMax;
     
    195203    RTFILEAIOREQSTATE     enmState;
    196204    /** The I/O context this request is associated with. */
    197     aio_context_t         AioContext;
     205    LNXKAIOCONTEXT        AioContext;
    198206    /** Return code the request completed with. */
    199207    int                   Rc;
     
    219227 * Creates a new async I/O context.
    220228 */
    221 DECLINLINE(int) rtFileAsyncIoLinuxCreate(unsigned cEvents, aio_context_t *pAioContext)
     229DECLINLINE(int) rtFileAsyncIoLinuxCreate(unsigned cEvents, LNXKAIOCONTEXT *pAioContext)
    222230{
    223231    int rc = syscall(__NR_io_setup, cEvents, pAioContext);
     
    231239 * Destroys a async I/O context.
    232240 */
    233 DECLINLINE(int) rtFileAsyncIoLinuxDestroy(aio_context_t AioContext)
     241DECLINLINE(int) rtFileAsyncIoLinuxDestroy(LNXKAIOCONTEXT AioContext)
    234242{
    235243    int rc = syscall(__NR_io_destroy, AioContext);
     
    243251 * Submits an array of I/O requests to the kernel.
    244252 */
    245 DECLINLINE(int) rtFileAsyncIoLinuxSubmit(aio_context_t AioContext, long cReqs, LNXKAIOIOCB **ppIoCB, int *pcSubmitted)
     253DECLINLINE(int) rtFileAsyncIoLinuxSubmit(LNXKAIOCONTEXT AioContext, long cReqs, LNXKAIOIOCB **ppIoCB, int *pcSubmitted)
    246254{
    247255    int rc = syscall(__NR_io_submit, AioContext, cReqs, ppIoCB);
     
    257265 * Cancels a I/O request.
    258266 */
    259 DECLINLINE(int) rtFileAsyncIoLinuxCancel(aio_context_t AioContext, PLNXKAIOIOCB pIoCB, PLNXKAIOIOEVENT pIoResult)
     267DECLINLINE(int) rtFileAsyncIoLinuxCancel(LNXKAIOCONTEXT AioContext, PLNXKAIOIOCB pIoCB, PLNXKAIOIOEVENT pIoResult)
    260268{
    261269    int rc = syscall(__NR_io_cancel, AioContext, pIoCB, pIoResult);
     
    270278 * @returns Number of events (natural number w/ 0), IPRT error code (negative).
    271279 */
    272 DECLINLINE(int) rtFileAsyncIoLinuxGetEvents(aio_context_t AioContext, long cReqsMin, long cReqs,
     280DECLINLINE(int) rtFileAsyncIoLinuxGetEvents(LNXKAIOCONTEXT AioContext, long cReqsMin, long cReqs,
    273281                                            PLNXKAIOIOEVENT paIoResults, struct timespec *pTimeout)
    274282{
     
    289297     * completion port.
    290298     */
    291     aio_context_t AioContext = 0;
     299    LNXKAIOCONTEXT AioContext = 0;
    292300    rc = rtFileAsyncIoLinuxCreate(1, &AioContext);
    293301    if (RT_FAILURE(rc))
     
    385393                                    void *pvBuf, size_t cbRead, void *pvUser)
    386394{
    387     return rtFileAioReqPrepareTransfer(hReq, hFile, IOCB_CMD_PREAD,
     395    return rtFileAioReqPrepareTransfer(hReq, hFile, LNXKAIO_IOCB_CMD_READ,
    388396                                       off, pvBuf, cbRead, pvUser);
    389397}
     
    393401                                     void *pvBuf, size_t cbWrite, void *pvUser)
    394402{
    395     return rtFileAioReqPrepareTransfer(hReq, hFile, IOCB_CMD_PWRITE,
     403    return rtFileAioReqPrepareTransfer(hReq, hFile, LNXKAIO_IOCB_CMD_WRITE,
    396404                                       off, pvBuf, cbWrite, pvUser);
    397405}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette