]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: propogate rank inform when binding to MX
authorVMware, Inc <>
Thu, 17 Jun 2010 21:13:15 +0000 (14:13 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 17 Jun 2010 21:13:15 +0000 (14:13 -0700)
The binding MX to MXUser functions need to propogate the rank
information into the MXUser lock header since the MXUser
"get the rank" function takes the rank information from there.
Some code gets the rank (for asserts and other sundry things)
from the MX lock directly and some from the MXUser lock.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/userlock.h
open-vm-tools/lib/lock/ulRec.c

index 20e9acb87ec18e2d9d28b6c6852b76db5618f703..184c1dffb1dce34422681354dc88fc8272da056d 100644 (file)
@@ -164,7 +164,8 @@ void MXUser_LogStats(unsigned epoch);
 void MXUser_SetInPanic(void);
 Bool MXUser_InPanic(void);
 
-MXUserRecLock       *MXUser_BindMXMutexRec(struct MX_MutexRec *mutex);
+MXUserRecLock       *MXUser_BindMXMutexRec(struct MX_MutexRec *mutex,
+                                           MX_Rank rank);
 struct MX_MutexRec  *MXUser_GetRecLockVmm(const MXUserRecLock *lock);
 MX_Rank              MXUser_GetRecLockRank(const MXUserRecLock *lock);
 #endif  // _USERLOCK_H_
index 2de48adccdbddd7894cc32103d9c9e32a6d82c3d..2c8566f9538f5daf827ddddd4a27aeed841c0733 100644 (file)
@@ -730,7 +730,8 @@ MXUser_GetRecLockRank(const MXUserRecLock *lock)  // IN:
  */
 
 MXUserRecLock *
-MXUser_BindMXMutexRec(struct MX_MutexRec *mutex)  // IN:
+MXUser_BindMXMutexRec(struct MX_MutexRec *mutex,  // IN:
+                      MX_Rank rank)               // IN:
 {
    MXUserRecLock *lock;
 
@@ -759,7 +760,7 @@ MXUser_BindMXMutexRec(struct MX_MutexRec *mutex)  // IN:
    lock->header.lockName = Str_SafeAsprintf(NULL, "MX_%p", mutex);
 
    lock->header.lockSignature = USERLOCK_SIGNATURE;
-   lock->header.lockRank = RANK_UNRANKED;  // unused
+   lock->header.lockRank = rank;
    lock->header.lockDumper = NULL;
 
 #if defined(MXUSER_STATS)
@@ -805,7 +806,7 @@ MXUser_InitFromMXRec(const char *name,    // IN:
    ASSERT(isBelowBull == (rank < RANK_userlevelLock));
 
    MX_InitLockRec(name, rank, mutex);
-   userLock = MXUser_BindMXMutexRec(mutex);
+   userLock = MXUser_BindMXMutexRec(mutex, rank);
    ASSERT(userLock);
 
    return userLock;