lock_util.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the file LICENSE for redistribution information.
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * Copyright (c) 1996, 1997, 1998
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Sleepycat Software. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic const char sccsid[] = "@(#)lock_util.c 10.10 (Sleepycat) 9/20/98";
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif /* not lint */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * __lock_cmp --
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * This function is used to compare a DBT that is about to be entered
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * into a hash table with an object already in the hash table. Note
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * that it just returns true on equal and 0 on not-equal. Therefore
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * this function cannot be used as a sort function; its purpose is to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * be used as a hash comparison function.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * PUBLIC: int __lock_cmp __P((const DBT *, DB_LOCKOBJ *));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * PUBLIC: int __lock_locker_cmp __P((u_int32_t, DB_LOCKOBJ *));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (memcmp(&locker, obj_data, sizeof(u_int32_t)) == 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The next two functions are the hash functions used to store objects in the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * lock hash table. They are hashing the same items, but one (__lock_ohash)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * takes a DBT (used for hashing a parameter passed from the user) and the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * other (__lock_lhash) takes a DB_LOCKOBJ (used for hashing something that is
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * already in the lock manager). In both cases, we have a special check to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fast path the case where we think we are doing a hash on a DB page/fileid
#define FAST_HASH(P) { \
return (__h); \
void *obj_data;
return (tmp);
return (locker);