|
16 | 16 |
|
17 | 17 | #include "postgres.h"
|
18 | 18 | #include "miscadmin.h"
|
19 |
| -#include "storage/lock.h" |
| 19 | +#include "storage/lmgr.h" |
20 | 20 | #include "storage/proc.h"
|
21 |
| -#include "storage/multilev.h" |
22 | 21 | #include "utils/elog.h"
|
23 | 22 |
|
24 | 23 | #include "user_locks.h"
|
25 | 24 |
|
26 | 25 | int
|
27 |
| -user_lock(unsigned int id1, unsigned int id2, LOCKMODE lockmode) |
| 26 | +user_lock(uint32 id1, uint32 id2, LOCKMODE lockmode) |
28 | 27 | {
|
29 | 28 | LOCKTAG tag;
|
30 | 29 |
|
31 | 30 | memset(&tag, 0, sizeof(LOCKTAG));
|
32 | 31 | tag.dbId = MyDatabaseId;
|
33 | 32 | tag.relId = 0;
|
34 |
| - tag.tupleId.ip_blkid.bi_hi = id2 >> 16; |
35 |
| - tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff; |
36 |
| - tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff); |
| 33 | + tag.objId.blkno = (BlockNumber) id2; |
| 34 | + tag.offnum = (OffsetNumber) (id1 & 0xffff); |
37 | 35 |
|
38 | 36 | return LockAcquire(USER_LOCKMETHOD, &tag, lockmode);
|
39 | 37 | }
|
40 | 38 |
|
41 | 39 | int
|
42 |
| -user_unlock(unsigned int id1, unsigned int id2, LOCKMODE lockmode) |
| 40 | +user_unlock(uint32 id1, uint32 id2, LOCKMODE lockmode) |
43 | 41 | {
|
44 | 42 | LOCKTAG tag;
|
45 | 43 |
|
46 | 44 | memset(&tag, 0, sizeof(LOCKTAG));
|
47 | 45 | tag.dbId = MyDatabaseId;
|
48 | 46 | tag.relId = 0;
|
49 |
| - tag.tupleId.ip_blkid.bi_hi = id2 >> 16; |
50 |
| - tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff; |
51 |
| - tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff); |
| 47 | + tag.objId.blkno = (BlockNumber) id2; |
| 48 | + tag.offnum = (OffsetNumber) (id1 & 0xffff); |
52 | 49 |
|
53 | 50 | return LockRelease(USER_LOCKMETHOD, &tag, lockmode);
|
54 | 51 | }
|
55 | 52 |
|
56 | 53 | int
|
57 |
| -user_write_lock(unsigned int id1, unsigned int id2) |
| 54 | +user_write_lock(uint32 id1, uint32 id2) |
58 | 55 | {
|
59 |
| - return user_lock(id1, id2, WRITE_LOCK); |
| 56 | + return user_lock(id1, id2, ExclusiveLock); |
60 | 57 | }
|
61 | 58 |
|
62 | 59 |
|
63 | 60 | int
|
64 |
| -user_write_unlock(unsigned int id1, unsigned int id2) |
| 61 | +user_write_unlock(uint32 id1, uint32 id2) |
65 | 62 | {
|
66 |
| - return user_unlock(id1, id2, WRITE_LOCK); |
| 63 | + return user_unlock(id1, id2, ExclusiveLock); |
67 | 64 | }
|
68 | 65 |
|
69 | 66 | int
|
70 | 67 | user_write_lock_oid(Oid oid)
|
71 | 68 | {
|
72 |
| - return user_lock(0, oid, WRITE_LOCK); |
| 69 | + return user_lock(0, oid, ExclusiveLock); |
73 | 70 | }
|
74 | 71 |
|
75 | 72 | int
|
76 | 73 | user_write_unlock_oid(Oid oid)
|
77 | 74 | {
|
78 |
| - return user_unlock(0, oid, WRITE_LOCK); |
| 75 | + return user_unlock(0, oid, ExclusiveLock); |
79 | 76 | }
|
80 | 77 |
|
81 | 78 | int
|
|
0 commit comments