Skip to content

Commit f21fa6a

Browse files
committed
Rename lockt to locktype and rename LOCKT to LOCKTYPE.
1 parent cff7e20 commit f21fa6a

File tree

6 files changed

+94
-94
lines changed

6 files changed

+94
-94
lines changed

src/backend/storage/lmgr/lock.c

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.30 1998/06/27 15:47:46 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.31 1998/06/28 21:17:34 momjian Exp $
1111
*
1212
* NOTES
1313
* Outside modules can create a lock table and acquire/release
@@ -52,7 +52,7 @@
5252

5353
static int
5454
WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
55-
LOCKT lockt);
55+
LOCKTYPE locktype);
5656

5757
/*#define LOCK_MGR_DEBUG*/
5858

@@ -437,15 +437,15 @@ LockTableRename(LockTableId tableId)
437437
* xid.xid current xid 0
438438
* persistence transaction user or backend
439439
*
440-
* The lockt parameter can have the same values for normal locks
440+
* The locktype parameter can have the same values for normal locks
441441
* although probably only WRITE_LOCK can have some practical use.
442442
*
443443
* DZ - 4 Oct 1996
444444
#endif
445445
*/
446446

447447
bool
448-
LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
448+
LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKTYPE locktype)
449449
{
450450
XIDLookupEnt *result,
451451
item;
@@ -469,7 +469,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
469469
lockName->tupleId.ip_posid,
470470
((lockName->tupleId.ip_blkid.bi_hi << 16) +
471471
lockName->tupleId.ip_blkid.bi_lo),
472-
lockt);
472+
locktype);
473473
#endif
474474
}
475475
#endif
@@ -485,7 +485,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
485485
if (LockingIsDisabled)
486486
return (TRUE);
487487

488-
LOCK_PRINT("Acquire", lockName, lockt);
488+
LOCK_PRINT("Acquire", lockName, locktype);
489489
masterLock = ltable->ctl->masterLock;
490490

491491
SpinAcquire(masterLock);
@@ -571,7 +571,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
571571
* ----------------
572572
*/
573573
lock->nHolding++;
574-
lock->holders[lockt]++;
574+
lock->holders[locktype]++;
575575

576576
/* --------------------
577577
* If I'm the only one holding a lock, then there
@@ -582,19 +582,19 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
582582
*/
583583
if (result->nHolding == lock->nActive)
584584
{
585-
result->holders[lockt]++;
585+
result->holders[locktype]++;
586586
result->nHolding++;
587-
GrantLock(lock, lockt);
587+
GrantLock(lock, locktype);
588588
SpinRelease(masterLock);
589589
return (TRUE);
590590
}
591591

592592
Assert(result->nHolding <= lock->nActive);
593593

594-
status = LockResolveConflicts(ltable, lock, lockt, myXid);
594+
status = LockResolveConflicts(ltable, lock, locktype, myXid);
595595

596596
if (status == STATUS_OK)
597-
GrantLock(lock, lockt);
597+
GrantLock(lock, locktype);
598598
else if (status == STATUS_FOUND)
599599
{
600600
#ifdef USER_LOCKS
@@ -611,15 +611,15 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
611611
hash_search(xidTable, (Pointer) &item, HASH_REMOVE, &found);
612612
}
613613
lock->nHolding--;
614-
lock->holders[lockt]--;
614+
lock->holders[locktype]--;
615615
SpinRelease(masterLock);
616616
#ifdef USER_LOCKS_DEBUG
617617
elog(NOTICE, "LockAcquire: user lock failed");
618618
#endif
619619
return (FALSE);
620620
}
621621
#endif
622-
status = WaitOnLock(ltable, tableId, lock, lockt);
622+
status = WaitOnLock(ltable, tableId, lock, locktype);
623623
XID_PRINT("Someone granted me the lock", result);
624624
}
625625

@@ -647,7 +647,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
647647
int
648648
LockResolveConflicts(LOCKTAB *ltable,
649649
LOCK *lock,
650-
LOCKT lockt,
650+
LOCKTYPE locktype,
651651
TransactionId xid)
652652
{
653653
XIDLookupEnt *result,
@@ -703,7 +703,7 @@ LockResolveConflicts(LOCKTAB *ltable,
703703
* do not continue and share the lock, even if we can. bjm
704704
* ------------------------
705705
*/
706-
int myprio = ltable->ctl->prio[lockt];
706+
int myprio = ltable->ctl->prio[locktype];
707707
PROC_QUEUE *waitQueue = &(lock->waitProcs);
708708
PROC *topproc = (PROC *) MAKE_PTR(waitQueue->links.prev);
709709

@@ -716,15 +716,15 @@ LockResolveConflicts(LOCKTAB *ltable,
716716
* with mine, then I get the lock.
717717
*
718718
* Checking for conflict: lock->mask represents the types of
719-
* currently held locks. conflictTable[lockt] has a bit
719+
* currently held locks. conflictTable[locktype] has a bit
720720
* set for each type of lock that conflicts with mine. Bitwise
721721
* compare tells if there is a conflict.
722722
* ----------------------------
723723
*/
724-
if (!(ltable->ctl->conflictTab[lockt] & lock->mask))
724+
if (!(ltable->ctl->conflictTab[locktype] & lock->mask))
725725
{
726726

727-
result->holders[lockt]++;
727+
result->holders[locktype]++;
728728
result->nHolding++;
729729

730730
XID_PRINT("Conflict Resolved: updated xid entry stats", result);
@@ -753,12 +753,12 @@ LockResolveConflicts(LOCKTAB *ltable,
753753
* conflict and I have to sleep.
754754
* ------------------------
755755
*/
756-
if (!(ltable->ctl->conflictTab[lockt] & bitmask))
756+
if (!(ltable->ctl->conflictTab[locktype] & bitmask))
757757
{
758758

759759
/* no conflict. Get the lock and go on */
760760

761-
result->holders[lockt]++;
761+
result->holders[locktype]++;
762762
result->nHolding++;
763763

764764
XID_PRINT("Conflict Resolved: updated xid entry stats", result);
@@ -771,11 +771,11 @@ LockResolveConflicts(LOCKTAB *ltable,
771771
}
772772

773773
static int
774-
WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKT lockt)
774+
WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKTYPE locktype)
775775
{
776776
PROC_QUEUE *waitQueue = &(lock->waitProcs);
777777

778-
int prio = ltable->ctl->prio[lockt];
778+
int prio = ltable->ctl->prio[locktype];
779779

780780
/*
781781
* the waitqueue is ordered by priority. I insert myself according to
@@ -785,10 +785,10 @@ WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKT lockt)
785785
* synchronization for this queue. That will not be true if/when
786786
* people can be deleted from the queue by a SIGINT or something.
787787
*/
788-
LOCK_DUMP_AUX("WaitOnLock: sleeping on lock", lock, lockt);
788+
LOCK_DUMP_AUX("WaitOnLock: sleeping on lock", lock, locktype);
789789
if (ProcSleep(waitQueue,
790790
ltable->ctl->masterLock,
791-
lockt,
791+
locktype,
792792
prio,
793793
lock) != NO_ERROR)
794794
{
@@ -799,13 +799,13 @@ WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKT lockt)
799799
* -------------------
800800
*/
801801
lock->nHolding--;
802-
lock->holders[lockt]--;
803-
LOCK_DUMP_AUX("WaitOnLock: aborting on lock", lock, lockt);
802+
lock->holders[locktype]--;
803+
LOCK_DUMP_AUX("WaitOnLock: aborting on lock", lock, locktype);
804804
SpinRelease(ltable->ctl->masterLock);
805805
elog(ERROR, "WaitOnLock: error on wakeup - Aborting this transaction");
806806
}
807807

808-
LOCK_DUMP_AUX("WaitOnLock: wakeup on lock", lock, lockt);
808+
LOCK_DUMP_AUX("WaitOnLock: wakeup on lock", lock, locktype);
809809
return (STATUS_OK);
810810
}
811811

@@ -820,7 +820,7 @@ WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKT lockt)
820820
* come along and request the lock).
821821
*/
822822
bool
823-
LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
823+
LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKTYPE locktype)
824824
{
825825
LOCK *lock = NULL;
826826
SPINLOCK masterLock;
@@ -843,7 +843,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
843843
lockName->tupleId.ip_posid,
844844
((lockName->tupleId.ip_blkid.bi_hi << 16) +
845845
lockName->tupleId.ip_blkid.bi_lo),
846-
lockt);
846+
locktype);
847847
#endif
848848
}
849849
#endif
@@ -859,7 +859,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
859859
if (LockingIsDisabled)
860860
return (TRUE);
861861

862-
LOCK_PRINT("Release", lockName, lockt);
862+
LOCK_PRINT("Release", lockName, locktype);
863863

864864
masterLock = ltable->ctl->masterLock;
865865
xidTable = ltable->xidHash;
@@ -919,9 +919,9 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
919919
* fix the general lock stats
920920
*/
921921
lock->nHolding--;
922-
lock->holders[lockt]--;
922+
lock->holders[locktype]--;
923923
lock->nActive--;
924-
lock->activeHolders[lockt]--;
924+
lock->activeHolders[locktype]--;
925925

926926
Assert(lock->nActive >= 0);
927927

@@ -992,7 +992,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
992992
* now check to see if I have any private locks. If I do, decrement
993993
* the counts associated with them.
994994
*/
995-
result->holders[lockt]--;
995+
result->holders[locktype]--;
996996
result->nHolding--;
997997

998998
XID_PRINT("LockRelease updated xid stats", result);
@@ -1038,9 +1038,9 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
10381038
* fix the general lock stats
10391039
*/
10401040
lock->nHolding--;
1041-
lock->holders[lockt]--;
1041+
lock->holders[locktype]--;
10421042
lock->nActive--;
1043-
lock->activeHolders[lockt]--;
1043+
lock->activeHolders[locktype]--;
10441044

10451045
Assert(lock->nActive >= 0);
10461046

@@ -1069,10 +1069,10 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
10691069
* with the remaining locks.
10701070
* --------------------------
10711071
*/
1072-
if (!(lock->activeHolders[lockt]))
1072+
if (!(lock->activeHolders[locktype]))
10731073
{
10741074
/* change the conflict mask. No more of this lock type. */
1075-
lock->mask &= BITS_OFF[lockt];
1075+
lock->mask &= BITS_OFF[locktype];
10761076
}
10771077

10781078
if (wakeupNeeded)
@@ -1095,11 +1095,11 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
10951095
* the new lock holder.
10961096
*/
10971097
void
1098-
GrantLock(LOCK *lock, LOCKT lockt)
1098+
GrantLock(LOCK *lock, LOCKTYPE locktype)
10991099
{
11001100
lock->nActive++;
1101-
lock->activeHolders[lockt]++;
1102-
lock->mask |= BITS_ON[lockt];
1101+
lock->activeHolders[locktype]++;
1102+
lock->mask |= BITS_ON[locktype];
11031103
}
11041104

11051105
#ifdef USER_LOCKS

0 commit comments

Comments
 (0)