]> git.ozlabs.org Git - ccan/commit
tdb2: approximate INCOMPATIBLE_HASH flag with tdb1_incompatible_hash()
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Aug 2011 05:50:16 +0000 (15:20 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Aug 2011 05:50:16 +0000 (15:20 +0930)
commit3004f7e89a5978064b4fb29c1027e6d0d39e9418
tree4eabeeea8fa8d4119ef867fed39f92939998e373
parent8a47d50d72ea62e378dc92b150c92c1317c73fa3
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.
ccan/tdb2/tdb1.h
ccan/tdb2/tdb1_hash.c
ccan/tdb2/tdb1_open.c
ccan/tdb2/test/run-tdb1-incompatible.c
ccan/tdb2/test/run-tdb1-oldhash.c
ccan/tdb2/test/run-tdb1-wronghash-fail.c