summaryrefslogtreecommitdiff
path: root/lib/tdb2
AgeCommit message (Collapse)AuthorFilesLines
2011-09-14tdb2: return TDB_ERR_RDONLY if trying to start a transaction on a R/O tdb.Rusty Russell1-2/+11
This is more accurate than returning TDB_ERR_EINVAL. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 91436a25574597dbd1fd2de5bcd5826a234100d6)
2011-09-14tdb2: save open_flags instead of mmap_flags.Rusty Russell3-5/+11
It's more consistent with what tdb1 does, and slightly more encapsulated. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 6b7c3c840eafbec211b9f58751c5ff754302a68e)
2011-09-14tdb_compat: adapt to tdb2 API change.Rusty Russell1-1/+3
Add the ecode arg to all the log functions, and log it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb2: Hand error code to logging function.Rusty Russell10-15/+34
Since we've deprecated tdb_error() function (and it didn't work right from inside the logging function anyway, since we didn't set tdb->ecode yet) we need to hand it to the log function. (Imported from CCAN commit 6e3d9e8a66bf8b45150500f176452ee8e9ee9927) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb2: move transaction lockRusty Russell1-2/+2
Make it the same offset as TDB1. This isn't strictly necessary, but it would allow for total unification later, since TDB1 and TDB2's transaction code is otherwise completely compatible. (Imported from CCAN commit de432e8f857ce23bccde7c6ffa3e7e21456df18b) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb2: enforce TDB_CONVERTRusty Russell4-0/+72
If the caller actually specifies TDB_CONVERT, fail if the TDB does not need conversion. It's unusual for the user to specify TDB_CONVERT (it's auto-detected) but better to be strict. (Imported from CCAN commit 3e3ee8b0c1e77340ab9e8678c2d23646d8cdb627) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb2: cleanup oob handling.Rusty Russell3-25/+30
The tdb_oob() function can fail due to errors, as well as because the length asked for is greater than the size of the file. Clean that up: (1) If probe is true, only fail if there's an error, not if the length is too great. (2) Exit tdb_open() if it tdb_oob() probe fails; this helps cut down test time for failtest. (3) Don't set probe to true in tdb_direct() fail; a minor issue, but it means we log failure. (Imported from CCAN commit 77658070a3e4f712b94d659b2e399031ce3394c8) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb2: fix tdb_lock offset.Rusty Russell1-1/+1
It can be 64 bits, for huge databases. (Imported from CCAN commit 736c033322079baf754261d82b6a83de53b2bb4e) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb2: fix internal tdb_write_convert() error handling in tdb_open()Rusty Russell1-4/+5
As noted, failtest was taking a long time, because a failure injected here was not detected. (Imported from CCAN commit 51f592dfcda4d58d6b9d8134b6e1aff791dc40f2) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb2: Fix to always use 64-bit offset definitionRusty Russell7-11/+627
We use off_t in the tdb2 interface (for tdb_attribute_flock); we need to make sure that all callers agree on the size. This also causes a problem in the tests: it's not enough to include config.h first, we need the _FILE_OFFSET_BITS define from private.h. Otherwise, we can disagree about the definitions of F_SETLK, F_SETLKW and off_t, causing strange problems. (Imported from CCAN commit baa17ee2d5e01a32030f19e566007417d72b4b6e) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-08-31tdb2: add full LGPL headersRusty Russell2-0/+34
This is for SAMBA, so we follow their rules and do full license headers. Two files were missing them. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 58025731) Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Aug 31 09:52:43 CEST 2011 on sn-devel-104
2011-06-20tdb2: tie it into build process if --enable-tdb2-breaks-compatRusty Russell2-0/+103
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-20tdb2: create tdb2 versions of various testing TDBs.Rusty Russell1-1/+13
Soon, TDB2 will handle tdb1 files, but until then, we substitute. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: python wrapperRusty Russell1-0/+574
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: minor changes to SAMBIFY it.Rusty Russell3-4/+18
This is a bit messy, but it works. Kept as a separate patch so it's easier to merge back and forth with CCAN's tdb2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: add lib/tdb2 (from CCAN init-1161-g661d41f)Rusty Russell84-0/+26504
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>