summaryrefslogtreecommitdiff
path: root/lib/tdb_compat
AgeCommit message (Collapse)AuthorFilesLines
2011-09-14tdb_compat: change offset of CLEAR_IF_FIRST lock.Rusty Russell1-2/+2
This makes it match tdb1, which mean it will Just Work as TDB2 gets tdb1 format support. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Sep 14 02:21:29 CEST 2011 on sn-devel-104
2011-09-14tdb_compat: support tdb_reopen/tdb_reopen_all for TDB2Rusty Russell2-3/+49
This matters with the clear-if-first support: we need to re-establish those locks at this point. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb_compat: make tdb2s temporarily read-only for tdb_traverse_read()Rusty Russell2-2/+27
It doesn't make a difference unless the tdb2 opens a TDB1 on disk, in which case tdb1_traverse() takes a write lock on the entire file. By setting the tdb to read-only first, we simulate the old behaviour. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb_compat: adapt to tdb2 API change.Rusty Russell2-0/+3
Add the ecode arg to all the log functions, and log it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_compat: respect TDB_NO_FSYNC environment variable for tdb2.Rusty Russell1-0/+6
I don't think this kind of hack belongs in the tdb2 source, but SAMBA uses it to speed testing, so we should respect it: handle it in our compat open wrapper. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Mon Jun 20 12:32:08 CEST 2011 on sn-devel-104
2011-06-20tdb2: tie it into build process if --enable-tdb2-breaks-compatRusty Russell1-2/+13
This is simplistic. We need to support making TDB2 a standalone library, but for now, we simply built it in-tree. Once we have tdb1 compatibility in tdb2, we can rename this option to --enable-tdb2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_compat.h: divert every tdb build and includes to tdb_compatRusty Russell1-1/+10
We change all the headers and wscript files to use tdb_compat; this means we have one place to decide whether to use TDB1 or TDB2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20lib/tdb_compat: header for tdb1 vs tdb2.Rusty Russell3-0/+239
TDB2's API is slightly different from TDB1. In particular, all functions return 0 (TDB_SUCCESS) or a negative error number, rather than -1 or tdb_null and storing the error in tdb_error() (though TDB2 does that as well). The simplest fix is to replace all the different functions with a wrapper, and that is done here. Compatibility functions: tdb_null: not used as an error return, so not defined by tdb2. tdb_fetch_compat: TDB1-style data-returning tdb_fetch. tdb_firstkey_compat: TDB1-style data-returning tdb_firstkey tdb_nextkey_compat: TDB1-style data-returning tdb_nextkey, with TDB2-style free of old key. tdb_errorstr_compat: TDB1-style tdb_errorstr() which takes TDB instead of ecode. TDB_CONTEXT: TDB1-style typedef for struct tdb_context. tdb_open_compat: Simplified open routine which takes log function, sets TDB_ALLOW_NESTING as Samba expects, and adds TDB_CLEAR_IF_FIRST support. Things defined away in TDB2 wrappers: tdb_traverse_read: TDB2's tdb_traverse only uses read-locks anyway. tdb_reopen/tdb_reopen_all: TDB2 detects this error itself. TDB_INCOMPATIBLE_HASH: TDB2 uses the Jenkins hash already. TDB_VOLATILE: TDB2 shouldn't have freelist scaling issues. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>