VirtualBox

Changeset 90433 in vbox


Ignore:
Timestamp:
Jul 30, 2021 3:48:09 PM (4 years ago)
Author:
vboxsync
Message:

VMM/PDMCritSectEnter: Added macros for correctly asserting on successfull PDMCritSectEnter calls when rcBusy is VINF_SUCCESS or the caller can't return an error. Makes it easier to spot these compared to generic AssertReleaseRC. bugref:6695

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmcritsect.h

    r90348 r90433  
    9999#endif
    100100
     101/** @def PDM_CRITSECT_RELEASE_ASSERT_RC
     102 * Helper for PDMCritSectEnter w/ rcBusy VINF_SUCCESS when there is no way
     103 * to forward failures to the caller. */
     104#define PDM_CRITSECT_RELEASE_ASSERT_RC(a_pVM, a_pCritSect, a_rc) \
     105    AssertReleaseMsg(RT_SUCCESS(a_rc), ("pVM=%p pCritSect=%p: %Rrc\n", (a_pVM), (a_pCritSect), (a_rc))
     106
     107/** @def PDM_CRITSECT_RELEASE_ASSERT_RC_DEV
     108 * Helper for PDMCritSectEnter w/ rcBusy VINF_SUCCESS when there is no way
     109 * to forward failures to the caller, device edition. */
     110#define PDM_CRITSECT_RELEASE_ASSERT_RC_DEV(a_pDevIns, a_pCritSect, a_rc) \
     111    AssertReleaseMsg(RT_SUCCESS(a_rc), ("pDevIns=%p pCritSect=%p: %Rrc\n", (a_pDevIns), (a_pCritSect), (a_rc))
     112
     113/** @def PDM_CRITSECT_RELEASE_ASSERT_RC_DRV
     114 * Helper for PDMCritSectEnter w/ rcBusy VINF_SUCCESS when there is no way
     115 * to forward failures to the caller, driver edition. */
     116#define PDM_CRITSECT_RELEASE_ASSERT_RC_DRV(a_pDevIns, a_pCritSect, a_rc) \
     117    AssertReleaseMsg(RT_SUCCESS(a_rc), ("pDrvIns=%p pCritSect=%p: %Rrc\n", (a_pDrvIns), (a_pCritSect), (a_rc))
     118
     119/** @def PDM_CRITSECT_RELEASE_ASSERT_RC_USB
     120 * Helper for PDMCritSectEnter w/ rcBusy VINF_SUCCESS when there is no way
     121 * to forward failures to the caller, USB device edition. */
     122#define PDM_CRITSECT_RELEASE_ASSERT_RC_USB(a_pUsbIns, a_pCritSect, a_rc) \
     123    AssertReleaseMsg(RT_SUCCESS(a_rc), ("pUsbIns=%p pCritSect=%p: %Rrc\n", (a_pUsbIns), (a_pCritSect), (a_rc))
     124
     125
    101126/** @} */
    102127
  • trunk/include/VBox/vmm/pdmdev.h

    r90428 r90433  
    78917891 *
    78927892 * @note    Even callers setting @a rcBusy to VINF_SUCCESS must either handle
    7893  *          possible failures in ring-0 or apply an AssertReleaseRC() to the
    7894  *          return value of this function.
     7893 *          possible failures in ring-0 or at least apply
     7894 *          PDM_CRITSECT_RELEASE_ASSERT_RC_DEV() to the return value of this
     7895 *          function.
    78957896 *
    78967897 * @sa      PDMCritSectEnter
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r90428 r90433  
    518518 *
    519519 * @note    Even callers setting @a rcBusy to VINF_SUCCESS must either handle
    520  *          possible failures in ring-0 or apply an AssertReleaseRC() to the
    521  *          return value of this function.
     520 *          possible failures in ring-0 or apply
     521 *          PDM_CRITSECT_RELEASE_ASSERT_RC(),
     522 *          PDM_CRITSECT_RELEASE_ASSERT_RC_DEV(),
     523 *          PDM_CRITSECT_RELEASE_ASSERT_RC_DRV() or
     524 *          PDM_CRITSECT_RELEASE_ASSERT_RC_USB() to the return value of this
     525 *          function.
    522526 */
    523527VMMDECL(int) PDMCritSectEnter(PVMCC pVM, PPDMCRITSECT pCritSect, int rcBusy)
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