fileaio.h revision 643b32fda84b53ffdc94e190ff8c5bce34d022b0
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * IPRT - Internal RTFileAio header.
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson * Copyright (C) 2009 Oracle Corporation
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * This file is part of VirtualBox Open Source Edition (OSE), as
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * available from http://www.virtualbox.org. This file is free software;
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * you can redistribute it and/or modify it under the terms of the GNU
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * General Public License (GPL) as published by the Free Software
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Foundation, in version 2 as it comes in the "COPYING" file of the
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson * The contents of this file may alternatively be used under the terms
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson * of the Common Development and Distribution License Version 1.0
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
90c099e88e9f16bfee9edee3ac1a51fc98843772Brian Wellington * VirtualBox OSE distribution, in which case the provisions of the
a5c077e40c784cf9e25c95a1ab94db2faab04ae9Brian Wellington * CDDL are applicable instead of those of the GPL.
cc0a5f714231709409b9e1b85f0f97ae50854451Mark Andrews * You may elect to license modified versions of this file under the
d9059b0c38bd630c367d81424d72b1308cd74b04Tatuya JINMEI 神明達哉 * terms and conditions of either the GPL or the CDDL or both.
ec3b216506b715f10e0b653afc20068ce8c5aa79Evan Hunt/*******************************************************************************
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉* Structures and Typedefs *
90c099e88e9f16bfee9edee3ac1a51fc98843772Brian Wellington*******************************************************************************/
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * Defined request states.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews /** Prepared. */
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson /** Submitted. */
3aca8e5bf3740bbcc3bb13dde242d7cc369abb27Mark Andrews /** Completed. */
9c566a852f31c3a5d0b9d6eaf11463114339c01dAndreas Gustafsson /** Omni present 32bit hack. */
9c566a852f31c3a5d0b9d6eaf11463114339c01dAndreas Gustafsson RTFILEAIOREQSTATE_32BIT_HACK = 0x7fffffff
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson/*******************************************************************************
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt* Defined Constants And Macros *
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt*******************************************************************************/
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt/** Return true if the specified request is not valid, false otherwise. */
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt (RT_UNLIKELY(!VALID_PTR(pReq) || (pReq->u32Magic != RTFILEAIOREQ_MAGIC)))
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt/** Validates a context handle and returns VERR_INVALID_HANDLE if not valid. */
1adb2e87a20a480e640385609c9652dac04c7dffAndreas Gustafsson AssertReturn((pReq)->u32Magic == RTFILEAIOREQ_MAGIC, (rc)); \
1adb2e87a20a480e640385609c9652dac04c7dffAndreas Gustafsson/** Validates a context handle and returns VERR_INVALID_HANDLE if not valid. */
1adb2e87a20a480e640385609c9652dac04c7dffAndreas Gustafsson#define RTFILEAIOREQ_VALID_RETURN(pReq) RTFILEAIOREQ_VALID_RETURN_RC((pReq), VERR_INVALID_HANDLE)
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt/** Validates a context handle and returns (void) if not valid. */
351b62535d4c4f89883bfdba025999dd32490266Evan Hunt AssertReturnVoid((pReq)->u32Magic == RTFILEAIOREQ_MAGIC); \
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson/** Validates a context handle and returns the specified rc if not valid. */
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson#define RTFILEAIOCTX_VALID_RETURN_RC(pCtx, rc) \
2f012d936b5ccdf6520c96a4de23721dc58a2221Automatic Updater AssertReturn((pCtx)->u32Magic == RTFILEAIOCTX_MAGIC, (rc)); \
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson/** Validates a context handle and returns VERR_INVALID_HANDLE if not valid. */
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson#define RTFILEAIOCTX_VALID_RETURN(pCtx) RTFILEAIOCTX_VALID_RETURN_RC((pCtx), VERR_INVALID_HANDLE)
45e1bd63587102c3bb361eaca42ee7b714fb3542Mark Andrews/** Checks if a request is in the specified state and returns the specified rc if not. */
90c099e88e9f16bfee9edee3ac1a51fc98843772Brian Wellington#define RTFILEAIOREQ_STATE_RETURN_RC(pReq, State, rc) \
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt if (RT_UNLIKELY(pReq->enmState != RTFILEAIOREQSTATE_##State)) \
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt/** Checks if a request is not in the specified state and returns the specified rc if it is. */
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt#define RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReq, State, rc) \
11156f82bab19b2e7f5d4df6184ae0c99518442fAutomatic Updater if (RT_UNLIKELY(pReq->enmState == RTFILEAIOREQSTATE_##State)) \
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt/** Checks if a request in the given states and sserts if not. */
11156f82bab19b2e7f5d4df6184ae0c99518442fAutomatic Updater#define RTFIELAIOREQ_ASSERT_STATE(pReq, State) \
222d38735f97f771054e223b03f84c5858252332Evan Hunt Assert((pReq)->enmState == RTFILEAIOREQSTATE_##State); \
222d38735f97f771054e223b03f84c5858252332Evan Hunt/** Sets the request into a specific state. */