diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:41:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:41:13 +0930 |
commit | f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9 (patch) | |
tree | 580a9c1302b332602263b7f1192ea5ee61d43521 /lib/tdb2/tdb1_private.h | |
parent | b4a5c6dcb6c60a32b92772396dadfffa6b721732 (diff) | |
download | samba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.tar.gz samba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.tar.bz2 samba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.zip |
tdb2: Make TDB1 use the same tdb_hash() wrapper as TDB2
This means converting the tdb1 inbuilt hash functions to the
tdb2-style, so they return 64 bit. We truncate to 32 bit everywhere
but in tdb_check() which needs to do so explicitly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 3e46dde21261966941469a6c75e1b45cd2d26324)
Diffstat (limited to 'lib/tdb2/tdb1_private.h')
-rw-r--r-- | lib/tdb2/tdb1_private.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/tdb2/tdb1_private.h b/lib/tdb2/tdb1_private.h index 9350076f27..22a6f7972f 100644 --- a/lib/tdb2/tdb1_private.h +++ b/lib/tdb2/tdb1_private.h @@ -58,6 +58,9 @@ #define tdb_allrecord_upgrade(tdb1, start) \ tdb_allrecord_upgrade((struct tdb_context *)(tdb1), (start)) +#define tdb_hash(tdb1, ptr, len) \ + tdb_hash((struct tdb_context *)(tdb1), (ptr), (len)) + #define tdb_lock_gradual(tdb1, ltype, flags, off, len) \ tdb_lock_gradual((struct tdb_context *)(tdb1), \ (ltype), (flags), (off), (len)) @@ -209,12 +212,16 @@ struct tdb1_context { /* Our statistics. */ struct tdb_attribute_stats stats; + /* Hash function. */ + uint64_t (*hash_fn)(const void *key, size_t len, uint64_t seed, void *); + void *hash_data; + uint64_t hash_seed; + bool read_only; /* opened read-only */ int traverse_read; /* read-only traversal */ int traverse_write; /* read-write traversal */ struct tdb1_header header; /* a cached copy of the header */ struct tdb1_traverse_lock travlocks; /* current traversal locks */ - unsigned int (*hash_fn)(TDB_DATA *key); const struct tdb1_methods *methods; struct tdb1_transaction *transaction; int page_size; @@ -280,6 +287,6 @@ bool tdb1_write_all(int fd, const void *buf, size_t count); int tdb1_transaction_recover(struct tdb1_context *tdb); void tdb1_header_hash(struct tdb1_context *tdb, uint32_t *magic1_hash, uint32_t *magic2_hash); -unsigned int tdb1_old_hash(TDB_DATA *key); +uint64_t tdb1_old_hash(const void *key, size_t len, uint64_t seed, void *); size_t tdb1_dead_space(struct tdb1_context *tdb, tdb1_off_t off); #endif /* CCAN_TDB2_TDB1_PRIVATE_H */ |