From: Volker Lendecke Date: Thu, 3 Jul 2008 14:24:27 +0000 (+0200) Subject: Remove gencache_[un]lock_entry X-Git-Tag: samba-3.3.0pre1~684 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a5a575ffe5196caecedc93970a25abfbe6f8059;p=thirdparty%2Fsamba.git Remove gencache_[un]lock_entry Günther agreed that it might be unnecessary in dsgetdcname_cache_store() :-) --- diff --git a/source/include/proto.h b/source/include/proto.h index ae5481dc31c..85efe24a361 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -606,8 +606,6 @@ bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob, bool *expired); bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout); void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr), void* data, const char* keystr_pattern); -int gencache_lock_entry( const char *key ); -void gencache_unlock_entry( const char *key ); /* The following definitions come from lib/genrand.c */ diff --git a/source/lib/gencache.c b/source/lib/gencache.c index 1b4342a62bb..a55b2ab9ba9 100644 --- a/source/lib/gencache.c +++ b/source/lib/gencache.c @@ -484,28 +484,3 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time tdb_search_list_free(first_node); } - -/******************************************************************** - lock a key -********************************************************************/ - -int gencache_lock_entry( const char *key ) -{ - if (!gencache_init()) - return -1; - - return tdb_lock_bystring(cache, key); -} - -/******************************************************************** - unlock a key -********************************************************************/ - -void gencache_unlock_entry( const char *key ) -{ - if (!gencache_init()) - return; - - tdb_unlock_bystring(cache, key); - return; -} diff --git a/source/libsmb/dsgetdcname.c b/source/libsmb/dsgetdcname.c index 2a445cbd5a7..afc87030d08 100644 --- a/source/libsmb/dsgetdcname.c +++ b/source/libsmb/dsgetdcname.c @@ -159,7 +159,6 @@ static NTSTATUS dsgetdcname_cache_store(TALLOC_CTX *mem_ctx, { time_t expire_time; char *key; - bool ret = false; if (!gencache_init()) { return NT_STATUS_INTERNAL_DB_ERROR; @@ -172,15 +171,8 @@ static NTSTATUS dsgetdcname_cache_store(TALLOC_CTX *mem_ctx, expire_time = time(NULL) + DSGETDCNAME_CACHE_TTL; - if (gencache_lock_entry(key) != 0) { - return NT_STATUS_LOCK_NOT_GRANTED; - } - - ret = gencache_set_data_blob(key, blob, expire_time); - - gencache_unlock_entry(key); - - return ret ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; + return gencache_set_data_blob(key, blob, expire_time) + ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; } /****************************************************************