1N/A * See the file LICENSE for redistribution information. 1N/A * Copyright (c) 1996, 1997, 1998 1N/A * Sleepycat Software. All rights reserved. 1N/A#
endif /* not lint */ 1N/A * This function is used to compare a DBT that is about to be entered 1N/A * into a hash table with an object already in the hash table. Note 1N/A * that it just returns true on equal and 0 on not-equal. Therefore 1N/A * this function cannot be used as a sort function; its purpose is to 1N/A * be used as a hash comparison function. 1N/A * PUBLIC: int __lock_cmp __P((const DBT *, DB_LOCKOBJ *)); 1N/A * PUBLIC: int __lock_locker_cmp __P((u_int32_t, DB_LOCKOBJ *)); 1N/A * The next two functions are the hash functions used to store objects in the 1N/A * lock hash table. They are hashing the same items, but one (__lock_ohash) 1N/A * takes a DBT (used for hashing a parameter passed from the user) and the 1N/A * other (__lock_lhash) takes a DB_LOCKOBJ (used for hashing something that is 1N/A * already in the lock manager). In both cases, we have a special check to 1N/A * fast path the case where we think we are doing a hash on a DB page/fileid 1N/A * pair. If the size is right, then we do the fast hash. 1N/A * We know that DB uses DB_LOCK_ILOCK types for its lock objects. The first 1N/A * four bytes are the 4-byte page number and the next DB_FILE_ID_LEN bytes 1N/A * are a unique file id, where the first 4 bytes on UNIX systems are the file 1N/A * inode number, and the first 4 bytes on Windows systems are the FileIndexLow 1N/A * bytes. So, we use the XOR of the page number and the first four bytes of 1N/A * the file id to produce a 32-bit hash value. 1N/A * We have no particular reason to believe that this algorithm will produce 1N/A * a good hash, but we want a fast hash more than we want a good one, when 1N/A * we're coming through this code path. 1N/A * PUBLIC: u_int32_t __lock_ohash __P((const DBT *)); 1N/A * PUBLIC: u_int32_t __lock_lhash __P((DB_LOCKOBJ *)); 1N/A * __lock_locker_hash -- 1N/A * Hash function for entering lockers into the hash table. Since these 1N/A * are simply 32-bit unsigned integers, just return the locker value. 1N/A * PUBLIC: u_int32_t __lock_locker_hash __P((u_int32_t));