VirtualBox

Changeset 25607 in vbox for trunk/include


Ignore:
Timestamp:
Dec 31, 2009 1:21:39 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56298
Message:

iprt,pdmcritsect: Shortening and cleaning up the lock validator structure names.

Location:
trunk/include/iprt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/critsect.h

    r25406 r25607  
    8787    RTSEMEVENT                          EventSem;
    8888    /** Lock validator record.  Only used in strict builds. */
    89     R3R0PTRTYPE(PRTLOCKVALIDATORREC)    pValidatorRec;
     89    R3R0PTRTYPE(PRTLOCKVALRECEXCL)      pValidatorRec;
    9090    /** Alignmnet padding. */
    9191    RTHCPTR                             Alignment;
  • trunk/include/iprt/lockvalidator.h

    r25602 r25607  
    4646/** Pointer to a record union.
    4747 * @internal  */
    48 typedef union RTLOCKVALIDATORRECUNION *PRTLOCKVALIDATORRECUNION;
     48typedef union RTLOCKVALRECUNION *PRTLOCKVALRECUNION;
    4949
    5050/**
    5151 * Source position.
    5252 */
    53 typedef struct RTLOCKVALIDATORSRCPOS
     53typedef struct RTLOCKVALSRCPOS
    5454{
    5555    /** The file where the lock was taken. */
     
    6464    uint32_t                            u32Padding; /**< Alignment padding. */
    6565#endif
    66 } RTLOCKVALIDATORSRCPOS;
    67 AssertCompileSize(RTLOCKVALIDATORSRCPOS, HC_ARCH_BITS == 32 ? 16 : 32);
     66} RTLOCKVALSRCPOS;
     67AssertCompileSize(RTLOCKVALSRCPOS, HC_ARCH_BITS == 32 ? 16 : 32);
    6868/* The pointer types are defined in iprt/types.h. */
    6969
    70 /** @def RTLOCKVALIDATORSRCPOS_INIT
    71  * Initializer for a RTLOCKVALIDATORSRCPOS variable.
     70/** @def RTLOCKVALSRCPOS_INIT
     71 * Initializer for a RTLOCKVALSRCPOS variable.
    7272 *
    7373 * @param   pszFile         The file name.  Optional (NULL).
     
    7878 */
    7979#if HC_ARCH_BITS == 64
    80 # define RTLOCKVALIDATORSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \
     80# define RTLOCKVALSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \
    8181    { (pszFile), (pszFunction), (uId), (uLine), 0 }
    8282#else
    83 # define RTLOCKVALIDATORSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \
     83# define RTLOCKVALSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \
    8484    { (pszFile), (pszFunction), (uId), (uLine) }
    8585#endif
    8686
    87 /** @def RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API
    88  * Initializer for a RTLOCKVALIDATORSRCPOS variable in a typicial debug API
     87/** @def RTLOCKVALSRCPOS_INIT_DEBUG_API
     88 * Initializer for a RTLOCKVALSRCPOS variable in a typicial debug API
    8989 * variant.  Assumes RT_SRC_POS_DECL and RTHCUINTPTR uId as arguments.
    9090 */
    91 #define RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API()  \
    92     RTLOCKVALIDATORSRCPOS_INIT(pszFile, iLine, pszFunction, uId)
    93 
    94 /** @def RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API
    95  * Initializer for a RTLOCKVALIDATORSRCPOS variable in a normal API
     91#define RTLOCKVALSRCPOS_INIT_DEBUG_API()  \
     92    RTLOCKVALSRCPOS_INIT(pszFile, iLine, pszFunction, uId)
     93
     94/** @def RTLOCKVALSRCPOS_INIT_NORMAL_API
     95 * Initializer for a RTLOCKVALSRCPOS variable in a normal API
    9696 * variant.  Assumes iprt/asm.h is included.
    9797 */
    98 #define RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API() \
    99     RTLOCKVALIDATORSRCPOS_INIT(__FILE__, __LINE__, __PRETTY_FUNCTION__, (uintptr_t)ASMReturnAddress())
     98#define RTLOCKVALSRCPOS_INIT_NORMAL_API() \
     99    RTLOCKVALSRCPOS_INIT(__FILE__, __LINE__, __PRETTY_FUNCTION__, (uintptr_t)ASMReturnAddress())
    100100
    101101/** Pointer to a record of one ownership share.  */
    102 typedef struct RTLOCKVALIDATORSHARED *PRTLOCKVALIDATORSHARED;
     102typedef struct RTLOCKVALRECSHRD *PRTLOCKVALRECSHRD;
    103103
    104104
     
    110110    /** The magic value indicating the record type. */
    111111    uint32_t                            u32Magic;
    112 } RTLOCKVALIDATORRECCORE;
     112} RTLOCKVALRECCORE;
    113113/** Pointer to a lock validator record core. */
    114 typedef RTLOCKVALIDATORRECCORE *PRTLOCKVALIDATORRECCORE;
     114typedef RTLOCKVALRECCORE *PRTLOCKVALRECCORE;
    115115/** Pointer to a const lock validator record core. */
    116 typedef RTLOCKVALIDATORRECCORE const *PCRTLOCKVALIDATORRECCORE;
    117 
    118 
    119 /**
    120  * Record recording the ownership of a lock.
     116typedef RTLOCKVALRECCORE const *PCRTLOCKVALRECCORE;
     117
     118
     119/**
     120 * Record recording the exclusive ownership of a lock.
    121121 *
    122122 * This is typically part of the per-lock data structure when compiling with
    123123 * the lock validator.
    124124 */
    125 typedef struct RTLOCKVALIDATORREC
     125typedef struct RTLOCKVALRECEXCL
    126126{
    127     /** Record core with RTLOCKVALIDATORREC_MAGIC as the magic value. */
    128     RTLOCKVALIDATORRECCORE              Core;
     127    /** Record core with RTLOCKVALRECEXCL_MAGIC as the magic value. */
     128    RTLOCKVALRECCORE                    Core;
    129129    /** Whether it's enabled or not. */
    130130    bool                                fEnabled;
     
    132132    bool                                afReserved[3];
    133133    /** Source position where the lock was taken. */
    134     RTLOCKVALIDATORSRCPOS               SrcPos;
     134    RTLOCKVALSRCPOS                     SrcPos;
    135135    /** The current owner thread. */
    136136    RTTHREAD volatile                   hThread;
    137137    /** Pointer to the lock record below us. Only accessed by the owner. */
    138     R3R0PTRTYPE(PRTLOCKVALIDATORREC)    pDown;
     138    R3R0PTRTYPE(PRTLOCKVALRECUNION)     pDown;
    139139    /** Recursion count */
    140140    uint32_t                            cRecursion;
     
    149149    /** Pointer to the next sibling record.
    150150     * This is used to find the read side of a read-write lock.  */
    151     R3R0PTRTYPE(PRTLOCKVALIDATORRECUNION) pSibling;
    152 } RTLOCKVALIDATORREC;
    153 AssertCompileSize(RTLOCKVALIDATORREC, HC_ARCH_BITS == 32 ? 8 + 16 + 32 : 8 + 32 + 56);
     151    R3R0PTRTYPE(PRTLOCKVALRECUNION) pSibling;
     152} RTLOCKVALRECEXCL;
     153AssertCompileSize(RTLOCKVALRECEXCL, HC_ARCH_BITS == 32 ? 8 + 16 + 32 : 8 + 32 + 56);
    154154/* The pointer type is defined in iprt/types.h. */
    155155
     
    157157 * For recording the one ownership share.
    158158 */
    159 typedef struct RTLOCKVALIDATORSHAREDONE
     159typedef struct RTLOCKVALRECSHRDOWN
    160160{
    161     /** Record core with RTLOCKVALIDATORSHAREDONE_MAGIC as the magic value. */
    162     RTLOCKVALIDATORRECCORE              Core;
     161    /** Record core with RTLOCKVALRECSHRDOWN_MAGIC as the magic value. */
     162    RTLOCKVALRECCORE                    Core;
    163163    /** Recursion count */
    164164    uint32_t                            cRecursion;
     
    166166    RTTHREAD volatile                   hThread;
    167167    /** Pointer to the lock record below us. Only accessed by the owner. */
    168     R3R0PTRTYPE(PRTLOCKVALIDATORREC)    pDown;
     168    R3R0PTRTYPE(PRTLOCKVALRECUNION)     pDown;
    169169    /** Pointer back to the shared record. */
    170     R3R0PTRTYPE(PRTLOCKVALIDATORSHARED) pSharedRec;
     170    R3R0PTRTYPE(PRTLOCKVALRECSHRD)      pSharedRec;
    171171#if HC_ARCH_BITS == 32
    172172    /** Reserved. */
     
    174174#endif
    175175    /** Source position where the lock was taken. */
    176     RTLOCKVALIDATORSRCPOS               SrcPos;
    177 } RTLOCKVALIDATORSHAREDONE;
    178 AssertCompileSize(RTLOCKVALIDATORSHAREDONE, HC_ARCH_BITS == 32 ? 24 + 16 : 32 + 32);
    179 /** Pointer to a RTLOCKVALIDATORSHAREDONE. */
    180 typedef RTLOCKVALIDATORSHAREDONE *PRTLOCKVALIDATORSHAREDONE;
     176    RTLOCKVALSRCPOS                     SrcPos;
     177} RTLOCKVALRECSHRDOWN;
     178AssertCompileSize(RTLOCKVALRECSHRDOWN, HC_ARCH_BITS == 32 ? 24 + 16 : 32 + 32);
     179/** Pointer to a RTLOCKVALRECSHRDOWN. */
     180typedef RTLOCKVALRECSHRDOWN *PRTLOCKVALRECSHRDOWN;
    181181
    182182/**
     
    186186 * the lock validator.
    187187 */
    188 typedef struct RTLOCKVALIDATORSHARED
     188typedef struct RTLOCKVALRECSHRD
    189189{
    190     /** Record core with RTLOCKVALIDATORSHARED_MAGIC as the magic value. */
    191     RTLOCKVALIDATORRECCORE              Core;
     190    /** Record core with RTLOCKVALRECSHRD_MAGIC as the magic value. */
     191    RTLOCKVALRECCORE                    Core;
    192192    /** The lock sub-class. */
    193193    uint32_t volatile                   uSubClass;
     
    200200    /** Pointer to the next sibling record.
    201201     * This is used to find the write side of a read-write lock.  */
    202     R3R0PTRTYPE(PRTLOCKVALIDATORRECUNION) pSibling;
     202    R3R0PTRTYPE(PRTLOCKVALRECUNION)    pSibling;
    203203
    204204    /** The number of entries in the table.
     
    219219    bool                                afPadding[2];
    220220    /** Pointer to a table containing pointers to records of all the owners. */
    221     R3R0PTRTYPE(PRTLOCKVALIDATORSHAREDONE volatile *) papOwners;
     221    R3R0PTRTYPE(PRTLOCKVALRECSHRDOWN volatile *) papOwners;
    222222#if HC_ARCH_BITS == 32
    223223    /** Alignment padding. */
    224224    uint32_t                            u32Alignment;
    225225#endif
    226 } RTLOCKVALIDATORSHARED;
    227 AssertCompileSize(RTLOCKVALIDATORSHARED, HC_ARCH_BITS == 32 ? 24 + 20 + 4 : 40 + 24);
     226} RTLOCKVALRECSHRD;
     227AssertCompileSize(RTLOCKVALRECSHRD, HC_ARCH_BITS == 32 ? 24 + 20 + 4 : 40 + 24);
    228228
    229229
     
    244244 * Initialize a lock validator record.
    245245 *
    246  * Use RTLockValidatorRecDelete to deinitialize it.
     246 * Use RTLockValidatorRecExclDelete to deinitialize it.
    247247 *
    248248 * @param   pRec                The record.
     
    255255 * @param   hLock               The lock handle.
    256256 */
    257 RTDECL(void) RTLockValidatorRecInit(PRTLOCKVALIDATORREC pRec, RTLOCKVALIDATORCLASS hClass,
    258                                     uint32_t uSubClass, const char *pszName, void *hLock);
     257RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALIDATORCLASS hClass,
     258                                        uint32_t uSubClass, const char *pszName, void *hLock);
    259259/**
    260260 * Uninitialize a lock validator record previously initialized by
     
    263263 * @param   pRec                The record.  Must be valid.
    264264 */
    265 RTDECL(void) RTLockValidatorRecDelete(PRTLOCKVALIDATORREC pRec);
     265RTDECL(void) RTLockValidatorRecExclDelete(PRTLOCKVALRECEXCL pRec);
    266266
    267267/**
    268268 * Create and initialize a lock validator record.
    269269 *
    270  * Use RTLockValidatorRecDestroy to deinitialize and destroy the returned
     270 * Use RTLockValidatorRecExclDestroy to deinitialize and destroy the returned
    271271 * record.
    272272 *
     
    281281 * @param   hLock               The lock handle.
    282282 */
    283 RTDECL(int)  RTLockValidatorRecCreate(PRTLOCKVALIDATORREC *ppRec, RTLOCKVALIDATORCLASS hClass,
    284                                       uint32_t uSubClass, const char *pszName, void *hLock);
    285 
    286 /**
    287  * Deinitialize and destroy a record created by RTLockValidatorRecCreate.
     283RTDECL(int)  RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALIDATORCLASS hClass,
     284                                          uint32_t uSubClass, const char *pszName, void *hLock);
     285
     286/**
     287 * Deinitialize and destroy a record created by RTLockValidatorRecExclCreate.
    288288 *
    289289 * @param   ppRec               Pointer to the record pointer.  Will be set to
    290290 *                              NULL.
    291291 */
    292 RTDECL(void) RTLockValidatorRecDestroy(PRTLOCKVALIDATORREC *ppRec);
     292RTDECL(void) RTLockValidatorRecExclDestroy(PRTLOCKVALRECEXCL *ppRec);
    293293
    294294/**
    295295 * Initialize a lock validator record for a shared lock.
    296296 *
    297  * Use RTLockValidatorSharedRecDelete to deinitialize it.
     297 * Use RTLockValidatorRecSharedDelete to deinitialize it.
    298298 *
    299299 * @param   pRec                The shared lock record.
     
    306306 * @param   hLock               The lock handle.
    307307 */
    308 RTDECL(void) RTLockValidatorSharedRecInit(PRTLOCKVALIDATORSHARED pRec, RTLOCKVALIDATORCLASS hClass,
     308RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALIDATORCLASS hClass,
    309309                                          uint32_t uSubClass, const char *pszName, void *hLock);
    310310/**
    311311 * Uninitialize a lock validator record previously initialized by
    312  * RTLockValidatorSharedRecInit.
     312 * RTLockValidatorRecSharedInit.
    313313 *
    314314 * @param   pRec                The shared lock record.  Must be valid.
    315315 */
    316 RTDECL(void) RTLockValidatorSharedRecDelete(PRTLOCKVALIDATORSHARED pRec);
     316RTDECL(void) RTLockValidatorRecSharedDelete(PRTLOCKVALRECSHRD pRec);
    317317
    318318/**
     
    324324 * @param   pRec2               Record 2.
    325325 */
    326 RTDECL(int) RTLockValidatorMakeSiblings(PRTLOCKVALIDATORRECCORE pRec1, PRTLOCKVALIDATORRECCORE pRec2);
     326RTDECL(int) RTLockValidatorRecMakeSiblings(PRTLOCKVALRECCORE pRec1, PRTLOCKVALRECCORE pRec2);
    327327
    328328/**
     
    342342 * @param   pSrcPos             The source position of the lock operation.
    343343 */
    344 RTDECL(int)  RTLockValidatorCheckOrder(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos);
     344RTDECL(int)  RTLockValidatorCheckOrder(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos);
    345345
    346346/**
     
    361361 * @param   pSrcPos             The source position of the lock operation.
    362362 */
    363 RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread,
     363RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread,
    364364                                         RTTHREADSTATE enmState, bool fRecursiveOk,
    365                                          PCRTLOCKVALIDATORSRCPOS pSrcPos);
     365                                         PCRTLOCKVALSRCPOS pSrcPos);
    366366
    367367/**
     
    384384 * @param   pSrcPos             The source position of the lock operation.
    385385 */
    386 RTDECL(int) RTLockValidatorCheckWriteOrderBlocking(PRTLOCKVALIDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead,
     386RTDECL(int) RTLockValidatorCheckWriteOrderBlocking(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead,
    387387                                                   RTTHREAD hThread, RTTHREADSTATE enmState, bool fRecursiveOk,
    388                                                    PCRTLOCKVALIDATORSRCPOS pSrcPos);
     388                                                   PCRTLOCKVALSRCPOS pSrcPos);
    389389
    390390/**
     
    407407 * @param   pSrcPos             The source position of the lock operation.
    408408 */
    409 RTDECL(int) RTLockValidatorCheckReadOrderBlocking(PRTLOCKVALIDATORSHARED pRead, PRTLOCKVALIDATORREC pWrite,
     409RTDECL(int) RTLockValidatorCheckReadOrderBlocking(PRTLOCKVALRECSHRD pRead, PRTLOCKVALRECEXCL pWrite,
    410410                                                  RTTHREAD hThread, RTTHREADSTATE enmState, bool fRecursiveOk,
    411                                                   PCRTLOCKVALIDATORSRCPOS pSrcPos);
     411                                                  PCRTLOCKVALSRCPOS pSrcPos);
    412412
    413413/**
     
    423423 * @param   pRec                The validator record.
    424424 */
    425 RTDECL(int)  RTLockValidatorCheckAndRelease(PRTLOCKVALIDATORREC pRec);
     425RTDECL(int)  RTLockValidatorCheckAndRelease(PRTLOCKVALRECEXCL pRec);
    426426
    427427/**
     
    438438 * @param   hThread             The handle of the calling thread.
    439439 */
    440 RTDECL(int)  RTLockValidatorCheckAndReleaseReadOwner(PRTLOCKVALIDATORSHARED pRead, RTTHREAD hThread);
     440RTDECL(int)  RTLockValidatorCheckAndReleaseReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread);
    441441
    442442/**
     
    453453 * @param   pSrcPos             The source position of the lock operation.
    454454 */
    455 RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALIDATORREC pRec, PCRTLOCKVALIDATORSRCPOS pSrcPos);
     455RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALRECEXCL pRec, PCRTLOCKVALSRCPOS pSrcPos);
    456456
    457457/**
     
    467467 * @param   pRec                The validator record.
    468468 */
    469 RTDECL(int) RTLockValidatorUnwindRecursion(PRTLOCKVALIDATORREC pRec);
     469RTDECL(int) RTLockValidatorUnwindRecursion(PRTLOCKVALRECEXCL pRec);
    470470
    471471/**
     
    485485 * @param   pWrite              The validator record for the writer.
    486486 */
    487 RTDECL(int) RTLockValidatorRecordReadWriteRecursion(PRTLOCKVALIDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead, PCRTLOCKVALIDATORSRCPOS pSrcPos);
     487RTDECL(int) RTLockValidatorRecordReadWriteRecursion(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead, PCRTLOCKVALSRCPOS pSrcPos);
    488488
    489489/**
     
    501501 * @param   pWrite              The validator record for the writer.
    502502 */
    503 RTDECL(int) RTLockValidatorUnwindReadWriteRecursion(PRTLOCKVALIDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead);
     503RTDECL(int) RTLockValidatorUnwindReadWriteRecursion(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead);
    504504
    505505/**
     
    517517 * @param   pSrcPos             The source position of the lock operation.
    518518 */
    519 RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos);
     519RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos);
    520520
    521521/**
     
    528528 * @param   pRec                The validator record.
    529529 */
    530 RTDECL(RTTHREAD) RTLockValidatorUnsetOwner(PRTLOCKVALIDATORREC pRec);
     530RTDECL(RTTHREAD) RTLockValidatorUnsetOwner(PRTLOCKVALRECEXCL pRec);
    531531
    532532/**
     
    540540 * @param   pSrcPos             The source position of the lock operation.
    541541 */
    542 RTDECL(void) RTLockValidatorAddReadOwner(PRTLOCKVALIDATORSHARED pRead, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos);
     542RTDECL(void) RTLockValidatorAddReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos);
    543543
    544544/**
     
    551551 * @param   hThread             The thread to to remove.
    552552 */
    553 RTDECL(void) RTLockValidatorRemoveReadOwner(PRTLOCKVALIDATORSHARED pRead, RTTHREAD hThread);
     553RTDECL(void) RTLockValidatorRemoveReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread);
    554554
    555555/**
  • trunk/include/iprt/types.h

    r25591 r25607  
    14791479/** Pointer to a lock validator record.
    14801480 * The structure definition is found in iprt/lockvalidator.h.  */
    1481 typedef struct RTLOCKVALIDATORREC          *PRTLOCKVALIDATORREC;
     1481typedef struct RTLOCKVALRECEXCL        *PRTLOCKVALRECEXCL;
    14821482/** Pointer to a lock validator source poisition.
    14831483 * The structure definition is found in iprt/lockvalidator.h.  */
    1484 typedef struct RTLOCKVALIDATORSRCPOS       *PRTLOCKVALIDATORSRCPOS;
     1484typedef struct RTLOCKVALSRCPOS         *PRTLOCKVALSRCPOS;
    14851485/** Pointer to a const lock validator source poisition.
    14861486 * The structure definition is found in iprt/lockvalidator.h.  */
    1487 typedef struct RTLOCKVALIDATORSRCPOS const *PCRTLOCKVALIDATORSRCPOS;
     1487typedef struct RTLOCKVALSRCPOS const   *PCRTLOCKVALSRCPOS;
    14881488
    14891489
Note: See TracChangeset for help on using the changeset viewer.

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