summaryrefslogtreecommitdiffstats
path: root/common/dhash/dhash.h
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-12-08 14:05:22 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-12-08 23:35:25 -0500
commite041252f788d80c53d91696b5bfc37cb47ccda54 (patch)
tree43454b7a700a76ea21b215d51cbe0b0842aae0ac /common/dhash/dhash.h
parent2b6b5bca3d55fc07eb22af3af3f77a3f17a6d7a0 (diff)
downloadsssd-e041252f788d80c53d91696b5bfc37cb47ccda54.tar.gz
sssd-e041252f788d80c53d91696b5bfc37cb47ccda54.tar.xz
sssd-e041252f788d80c53d91696b5bfc37cb47ccda54.zip
dhash: Add private pointer for delete callback
Also pass a flag to the delete callback to tell it if this is a normal entry removal or we are cleaning up the tbale definitively.
Diffstat (limited to 'common/dhash/dhash.h')
-rw-r--r--common/dhash/dhash.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/common/dhash/dhash.h b/common/dhash/dhash.h
index a8b0d83f6..72b054e8e 100644
--- a/common/dhash/dhash.h
+++ b/common/dhash/dhash.h
@@ -97,6 +97,12 @@ typedef enum
HASH_VALUE_DOUBLE
} hash_value_enum;
+typedef enum
+{
+ HASH_TABLE_DESTROY,
+ HASH_ENTRY_DESTROY
+} hash_destroy_enum;
+
typedef struct hash_key_t {
hash_key_enum type;
union {
@@ -135,7 +141,8 @@ typedef struct hash_statistics_t {
/* typedef's for callback based iteration */
typedef bool(*hash_iterate_callback)(hash_entry_t *item, void *user_data);
-typedef void (*hash_delete_callback)(hash_entry_t *item);
+typedef void (hash_delete_callback)(hash_entry_t *item,
+ hash_destroy_enum type, void *pvt);
/* typedef's for iteration object based iteration */
struct hash_iter_context_t;
@@ -172,7 +179,8 @@ const char* hash_error_string(int error);
* may need to be disposed of. The delete_callback may be NULL.
*/
int hash_create(unsigned long count, hash_table_t **tbl,
- hash_delete_callback delete_callback);
+ hash_delete_callback *delete_callback,
+ void *delete_private_data);
/*
* Create a new hash table and fine tune it's configurable parameters.
@@ -197,7 +205,8 @@ int hash_create_ex(unsigned long count, hash_table_t **tbl,
hash_alloc_func *alloc_func,
hash_free_func *free_func,
void *alloc_private_data,
- hash_delete_callback delete_callback);
+ hash_delete_callback *delete_callback,
+ void *delete_private_data);
#ifdef HASH_STATISTICS
/*