-PRINTF_ATTRIBUTE(4, 5) static void
-null_log_fn(struct tdb_context *tdb,
- enum tdb_debug_level level, void *priv,
- const char *fmt, ...)
-{
-}
-
-/* We do a lot of work assuming our copy of the header volatile area
- * is uptodate, and usually it is. However, once we grab a lock, we have to
- * re-check it. */
-bool update_header(struct tdb_context *tdb)
-{
- struct tdb_header_volatile pad, *v;
-
- if (tdb->header_uptodate) {
- tdb->log(tdb, TDB_DEBUG_WARNING, tdb->log_priv,
- "warning: header uptodate already\n");
- }
-
- /* We could get a partial update if we're not holding any locks. */
- assert(tdb_has_locks(tdb));
-
- v = tdb_get(tdb, offsetof(struct tdb_header, v), &pad, sizeof(*v));
- if (!v) {
- /* On failure, imply we updated header so they retry. */
- return true;
- }
- tdb->header_uptodate = true;
- if (likely(memcmp(&tdb->header.v, v, sizeof(*v)) == 0)) {
- return false;
- }
- tdb->header.v = *v;
- return true;
-}
-
-static uint64_t jenkins_hash(const void *key, size_t length, uint64_t seed,
- void *arg)
-{
- return hash64_stable((const unsigned char *)key, length, seed);
-}
-
-uint64_t tdb_hash(struct tdb_context *tdb, const void *ptr, size_t len)
-{
- return tdb->khash(ptr, len, tdb->header.hash_seed, tdb->hash_priv);
-}
-