tdb2: approximate INCOMPATIBLE_HASH flag with tdb1_incompatible_hash()
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:04:13 +0000 (07:34 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:04:13 +0000 (07:34 +0930)
commit61b1bd1dca145a0417907793579352c66b016c23
tree913e709da52d81b38afb6f91e917e5e25db3f451
parentebb3017cf08cc4dad3217db6cea404069b494b47
tdb2: approximate INCOMPATIBLE_HASH flag with tdb1_incompatible_hash()

Rather than leak TDB_INCOMPATIBLE_HASH through to the TDB2 API, we make
it that if they use the tdb1_incompatible_hash function as their hash,
then we treat it as if they had specified the TDB_INCOMPATIBLE_HASH
flag (ie. we mark the header so it's unusable by tdb < 1.2.6).

This precludes the possibility of using TDB_INCOMPATIBLE_HASH with a
custom hash function: that used to allow the user to ensure that old TDB
versions couldn't open the TDB file (and recent ones check the header to
ensure they're using the right hash).  But that's a small loss.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 3004f7e89a5978064b4fb29c1027e6d0d39e9418)
lib/tdb2/tdb1.h
lib/tdb2/tdb1_hash.c
lib/tdb2/tdb1_open.c
lib/tdb2/test/run-tdb1-incompatible.c
lib/tdb2/test/run-tdb1-oldhash.c
lib/tdb2/test/run-tdb1-wronghash-fail.c