diff options
author | Jeremy Allison <jra@samba.org> | 2004-08-25 01:04:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:52:29 -0500 |
commit | f98af01f43d37d9d633ec8861232fc1c7f66d3f9 (patch) | |
tree | d3e6ed20ddaaa4661569b8db9bcd360faf395b74 /source3/smbd | |
parent | a96dfe038e98234698e1967c54be5f4a2a47fa09 (diff) | |
download | samba-f98af01f43d37d9d633ec8861232fc1c7f66d3f9.tar.gz samba-f98af01f43d37d9d633ec8861232fc1c7f66d3f9.tar.bz2 samba-f98af01f43d37d9d633ec8861232fc1c7f66d3f9.zip |
r2032: If you're selecting a hash algorithm for tdb, you need to do it at open time,
it doesn't make sense anywhere else.
Jeremy.
(This used to be commit d7ea1ea8fb3420ca1ad8d95acdc43313898200ff)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/statcache.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c index 07a9e3ca85..dfc1a6ed95 100644 --- a/source3/smbd/statcache.c +++ b/source3/smbd/statcache.c @@ -2,7 +2,7 @@ Unix SMB/CIFS implementation. stat cache code Copyright (C) Andrew Tridgell 1992-2000 - Copyright (C) Jeremy Allison 1999-2000 + Copyright (C) Jeremy Allison 1999-2004 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2003 This program is free software; you can redistribute it and/or modify @@ -280,16 +280,11 @@ BOOL stat_cache_lookup(connection_struct *conn, pstring name, pstring dirpath, } } -/* - ************************************************************** - * Compute a hash value based on a string key value. - * Make the string key into an array of int's if possible. - * For the last few chars that cannot be int'ed, use char instead. - * The function returns the bucket index number for the hashed - * key. - * JRA. Use a djb-algorithm hash for speed. - ************************************************************** - */ +/*************************************************************** + Compute a hash value based on a string key value. + The function returns the bucket index number for the hashed key. + JRA. Use a djb-algorithm hash for speed. +***************************************************************/ static u32 string_hash(TDB_DATA *key) { @@ -301,14 +296,10 @@ static u32 string_hash(TDB_DATA *key) return n; } -/*************************************************************************** ** - * Initializes or clears the stat cache. - * - * Input: none. - * Output: none. - * - * ************************************************************************** ** - */ +/*************************************************************************** + Initializes or clears the stat cache. +**************************************************************************/ + BOOL reset_stat_cache( void ) { if (!lp_stat_cache()) @@ -318,10 +309,11 @@ BOOL reset_stat_cache( void ) tdb_close(tdb_stat_cache); } - /* Create the in-memory tdb. */ - tdb_stat_cache = tdb_open_log("statcache", 0, TDB_INTERNAL, (O_RDWR|O_CREAT), 0644); + /* Create the in-memory tdb using our custom hash function. */ + tdb_stat_cache = tdb_open_ex("statcache", 0, TDB_INTERNAL, + (O_RDWR|O_CREAT), 0644, NULL, string_hash); + if (!tdb_stat_cache) return False; - tdb_set_hash_function(tdb_stat_cache, string_hash); return True; } |