tdb merges (was svn commit r17607)

tridge at tridge at
Wed Aug 23 03:08:50 GMT 2006


 > Adapt the Samba4 directory structure for tdb. Makes it easier to diff.
 > Let's see what it breaks. For me it works :-)

Thanks for this!

Do you have any objections to me merging across the "enum
tdb_debug_level" change? That's the biggest difference between the two
trees now.

The other candidate to merge is the tdb_get_logging_private()
function, which needs a change to the definition of API functions that
take a logging function (eg. tdb_open_ex()). The justification for
that change is it allows an external tdb logging function to get at a
private pointer, allowing it to extend the logging without having a
global variable. See ltdb_log_fn() in ldb_tdb_wrap.c for an example of
its use.

Unfortunately that requires an API change to tdb_open_ex() though. To
solve this type of problem permanently we could instead have this:

 struct tdb_context *tdb;
 int ret;

 tdb = tdb_init(mem_ctx);
 tdb_set_logging_fn(tdb, log_fn); 
 tdb_set_logging_fn_private(tdb, log_private);
 tdb_set_hash_size(tdb, hash_size);
 tdb_set_hash_func(tdb, hash_fn);

 ret = tdb_open(tdb, name, tdb_flags, open_flags, mode); 

this obviously also means an API change, but it should prevent API
changes in the future, as when we add extra features we can add new
tdb_set_*() functions without breaking existing code. 

We'd also need to enforce that some tdb_set_*() functions (such as
hash_size) can't be called after tdb_open(), so you can only call them
immediately after the tdb_init() call.

Cheers, Tridge

More information about the samba-technical mailing list