X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Fdoc%2FTDB1_porting.txt;h=90ba2497382d456e285ec6990c5eb86177dbe812;hb=dc9da1e34fe6a9d113fd57e116ebbc6d5bd54819;hp=4a6e924411302655db1d9a5facacd717839e9238;hpb=a4393df8ed138b853b4ff212db7e1a50aba0b8c7;p=ccan diff --git a/ccan/tdb2/doc/TDB1_porting.txt b/ccan/tdb2/doc/TDB1_porting.txt index 4a6e9244..90ba2497 100644 --- a/ccan/tdb2/doc/TDB1_porting.txt +++ b/ccan/tdb2/doc/TDB1_porting.txt @@ -1,8 +1,13 @@ Interface differences between TDB1 and TDB2. +- tdb2 uses 'struct tdb_data', tdb1 uses 'struct TDB_DATA'. Use the + TDB_DATA typedef if you want portability between the two. + - tdb2 functions return 0 on success, and a negative error on failure, - whereas tdb1 functions returned 0 on success, and -1 on failure. tdb1 - then used tdb_error() to determine the error. + whereas tdb1 functions returned 0 on success, and -1 on failure. + tdb1 then used tdb_error() to determine the error; this is also + supported in tdb2 to ease backwards compatibility, though the other + form is preferred. - tdb2's tdb_fetch() returns an error, tdb1's returned the data directly (or tdb_null, and you were supposed to check tdb_error() to find out why). @@ -25,3 +30,15 @@ Interface differences between TDB1 and TDB2. TDB_LOG_WARNING. - tdb2 provides tdb_deq() for comparing two struct tdb_data. + +- tdb2's tdb_name() returns a copy of the name even for TDB_INTERNAL dbs. + +- tdb2 does not need tdb_reopen() or tdb_reopen_all(). If you call + fork() after during certain operations the child should close the + tdb, or complete the operations before continuing to use the tdb: + + tdb_transaction_start(): child must tdb_transaction_cancel() + tdb_lockall(): child must call tdb_unlockall() + tdb_lockall_read(): child must call tdb_unlockall_read() + tdb_chainlock(): child must call tdb_chainunlock() + tdb_parse() callback: child must return from tdb_parse()