Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
We use the TDB_ATTRIBUTE_TDB1_HASHSIZE to set the hash size.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
This is only meaningful when using the TDB_VERSION1 flag: we set the
attribute to control the maximum number of dead records (to 5, which is
what TDB_VOLATILE did for tdb1).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
This is only meaningful when using the TDB_VERSION1 flag: it is done
by using a magic hash value (which will fall back to the default hash
if that works instead).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
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>
|
|
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>
|
|
Add the ecode arg to all the log functions, and log it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
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>
|