VirtualBox

Changeset 19562 in vbox for trunk/src/VBox/Runtime/include


Ignore:
Timestamp:
May 10, 2009 9:44:16 PM (16 years ago)
Author:
vboxsync
Message:

Runtime/Aio: Change API again

  • pcReqs in RTFileAioCtxSubmit is useless because it does not specify which request fails. Removed it again and made it possible to get the state of a request through RTFileAioReqGetRC()
  • Introduce request states for the first point and to catch more errors using the API before a system dependent call is made to return the same error codes one every system for the same cause.
  • Add RTFileAioGetLimits to get global limits and indication for AIO support.
  • General cleanups and fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/include/internal/fileaio.h

    r19166 r19562  
    3636
    3737/*******************************************************************************
     38*   Structures and Typedefs                                                    *
     39*******************************************************************************/
     40/**
     41 * Defined request states.
     42 */
     43typedef enum RTFILEAIOREQSTATE
     44{
     45    /** Prepared. */
     46    RTFILEAIOREQSTATE_PREPARED = 0,
     47    /** Submitted. */
     48    RTFILEAIOREQSTATE_SUBMITTED,
     49    /** Completed. */
     50    RTFILEAIOREQSTATE_COMPLETED,
     51    /** Omni present 32bit hack. */
     52    RTFILEAIOREQSTATE_32BIT_HACK = 0x7fffffff
     53} RTFILEAIOREQSTATE;
     54
     55/*******************************************************************************
    3856*   Defined Constants And Macros                                               *
    3957*******************************************************************************/
     58
     59/** Return true if the specified request is not valid, false otherwise. */
     60#define RTFILEAIOREQ_IS_NOT_VALID(pReq) \
     61    (RT_UNLIKELY(!VALID_PTR(pReq) || (pReq->u32Magic != RTFILEAIOREQ_MAGIC)))
    4062
    4163/** Validates a context handle and returns VERR_INVALID_HANDLE if not valid. */
     
    6688#define RTFILEAIOCTX_VALID_RETURN(pCtx) RTFILEAIOCTX_VALID_RETURN_RC((pCtx), VERR_INVALID_HANDLE)
    6789
     90/** Checks if a request is in the specified state and returns the specified rc if not. */
     91#define RTFILEAIOREQ_STATE_RETURN_RC(pReq, State, rc) \
     92    do { \
     93        if (RT_UNLIKELY(pReq->enmState != RTFILEAIOREQSTATE_##State)) \
     94            return rc; \
     95    } while (0)
     96
     97/** Checks if a request is not in the specified state and returns the specified rc if it is. */
     98#define RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReq, State, rc) \
     99    do { \
     100        if (RT_UNLIKELY(pReq->enmState == RTFILEAIOREQSTATE_##State)) \
     101            return rc; \
     102    } while (0)
     103
     104/** Sets the request into a specific state. */
     105#define RTFILEAIOREQ_SET_STATE(pReq, State) \
     106    do { \
     107        pReq->enmState = RTFILEAIOREQSTATE_##State; \
     108    } while (0)
     109
     110
    68111__BEGIN_DECLS
    69112
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