tdb2: remove: it's now in SAMBA where it belongs.
tdb2: add error conversion functions. This clarifies the code a little, but also provides a more explicit mechanism which can be used to debug error handling (by introducing tdb_err_t and making it a pointer type).
tdb2: unify tdb1_chainlock et al. into tdb_chainlock Switch on the TDB_VERSION1 flag.
tdb2: make jenkins_hash function non-static, rename to tdb_jenkins_hash. We're going to need access to it from tdb1_open, so expose it now. It's better in hash.c anyway.
tdb2: TDB_ATTRIBUTE_STATS access via tdb_get_attribute. Now we have tdb_get_attribute, it makes sense to make that the method of accessing statistics. That way they are always available, and it's probably cheaper doing the direct increment than even the unlikely() branch.
tdb2: tdb_set_attribute, tdb_unset_attribute and tdb_get_attribute It makes sense for some attributes to be manipulated after tdb_open, so allow that.
tdb2: rename internal hashfn and logfn to hash_fn and log_fn. We use underscores everywhere else, so be consistent.
tdb2: shorten attribute members. It's redundant calling hash.hash_fn for example. Standardize on fn and data as names (private conflicts with C++).
tdb2: implement tdb_chainlock_read/tdb_chainunlock_read.
tdb2: tdb_lockall() and tdb_lockall_read() support. We also change tdb_chainunlock not to return an error (as per the other locking functions: we log a message, but don't return an error).
tdb2: tdb_error() This makes transition from tdb1 much simpler.
tdb2: change API to return the error value. Mostly a fairly simple transformation, since 0 still means success. One new twist is that tdb_nextkey now frees the .dptr of the key; this us usually what we want but does cause issues for our weird test code.
tdb2: rework free.c functions to return enum TDB_ERROR.
tdb2: rework hash.c functions to return enum TDB_ERROR. This time we have to use our tri-value "tdb_bool_err" type to indicate true, false, or error, which now allows us to correctly handle errors in key matching (rather than treating it as a non-match).
tdb2: rework remaining io.c functions to return enum TDB_ERROR. In particular, we replace the TDB_OFF_ERR ((off_t)-1) with a range of negative error values.
tdb2: rework some io.c functions to encode errors in their pointer returns. This causes a subtle enhancement in tdb_direct(): it previously returned NULL on both "can't use direct access" or "some error occurred", as the caller always uses read/write functions as a fallback anyway. Now we distinguish the error case.
tdb2: rework some io.c functions to return enum TDB_ERROR.
tdb2: rework lock.c functions to return enum TDB_ERROR. Make the other functions in lock.s return an error code, too.
tdb2: remove tdb_traverse_read It's not actually different from tdb_traverse(). We can re-add it later if it makes sense.
tdb2: simplify logging levels, rename TDB_DEBUG_* to TDB_LOG_* It was never clear to me which levels should be used for what cases. I can only usefully distinguish three at the moment: (1) TDB errors, which render the TDB unreliable. (2) TDB user errors, caused by API misuse. (3) TDB notifications of strange behaviour, from which we have recovered.