1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
/*
* The next two functions are the hash functions used to store objects in the
* lock hash tables. They are hashing the same items, but one (__lock_ohash)
* takes a DBT (used for hashing a parameter passed from the user) and the
* other (__lock_lhash) takes a DB_LOCKOBJ (used for hashing something that is
* already in the lock manager). In both cases, we have a special check to
* fast path the case where we think we are doing a hash on a DB page/fileid
* pair. If the size is right, then we do the fast hash.
*
* We know that DB uses DB_LOCK_ILOCK types for its lock objects. The first
* four bytes are the 4-byte page number and the next DB_FILE_ID_LEN bytes
* are a unique file id, where the first 4 bytes on UNIX systems are the file
* inode number, and the first 4 bytes on Windows systems are the FileIndexLow
* bytes. This is followed by a random number. The inode values tend
* to increment fairly slowly and are not good for hashing. So, we use
* the XOR of the page number and the four bytes of the file id random
* number to produce a 32-bit hash value.
*
* We have no particular reason to believe that this algorithm will produce
* a good hash, but we want a fast hash more than we want a good one, when
* we're coming through this code path.
*/
/*
* __lock_ohash --
*
* PUBLIC: u_int32_t __lock_ohash __P((const DBT *));
*/
u_int32_t
DBT *dbt;
/*
* __lock_lhash --
*
* PUBLIC: u_int32_t __lock_lhash __P((DB_LOCKOBJ *));
*/
u_int32_t
DB_LOCKOBJ *lock_obj;
/*
* __lock_nomem --
* Report a lack of some resource.
*
* PUBLIC: int __lock_nomem __P((ENV *, const char *));
*/
int
ENV *env;
const char *res;