summaryrefslogtreecommitdiff
path: root/lib/tdb2/transaction.c
AgeCommit message (Collapse)AuthorFilesLines
2012-02-21lib/tdb2: Mark public function as suchAmitay Isaacs1-4/+4
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-08Fix shadow variable name warning.Jeremy Allison1-10/+10
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 8 22:55:08 CET 2012 on sn-devel-104
2012-01-30tdb2: copy tdb1's changed expansion logic.Rusty Russell1-3/+6
TDB2 uses the same expansion logic as TDB1, which got factored out recently. So update TDB2 to match. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit c438ec17d7b2efe76e56e5fc5ab88bd4a02735e8)
2012-01-30tdb2: careful on wrap.Rusty Russell1-5/+5
It's much harder to wrap a 64-bit tdb2 than a 32-bit tdb1, but we should still take care against bugs. Also, we should *not* cast the length to a size_t when comparing it to the stat result, in case size_t is 32 bit. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 6f7cb26e589cea081e71c59801eae87178967861)
2011-09-14tdb2: add error conversion functions.Rusty Russell1-10/+13
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). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit afa6d57b7d93fe4675a952f556eb462951baa257)
2011-09-14tdb2: set tdb_error() on tdb_transaction_prepare_commit.Rusty Russell1-1/+1
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit feb36b14278b4230af70dab90369a345b6a027ef)
2011-09-14tdb2: don't return -1 (ie. TDB_ERR_CORRUPT) on transaction write fail.Rusty Russell1-1/+1
A left-over -1 return; should be returning ecode (probably TDB_ERR_IO). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 077bdae6877d26749987b26a1b5b28cdba5ebbdd)
2011-09-14tdb2: unify tdb1_transaction_start etc. into tdb_transaction_start.Rusty Russell1-0/+21
Switch on the TDB_VERSION1 flag. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 6bc8ea012391198bc3898ae2937558b60dd55906)
2011-09-14tdb2: merge tdb1_context into tdb_context.Rusty Russell1-135/+135
Finally, we split out the tdb2-specific parts of tdb_context, and put them into a "tdb2" sub-struct; the tdb1 parts go into a "tdb1" sub-struct. We get rido of tdb1_context and use tdb_context everywhere. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit bbeb528e74c0e234e1f724ac8d54be404cfc6f9a)
2011-09-14tdb2: make tdb1 use same low-level lock functions.Rusty Russell1-1/+1
This means they will use the TDB_ATTRIBUTE_FLOCK functions, and get automatic reopen support. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit fbad02b680b6cbc33ae305ae1cbcdead4eedc7b1)
2011-09-14tdb2: add TDB_RDONLY flag, allow setting/unsetting it.Rusty Russell1-2/+2
You can only unset it if the TDB was originally opened O_RDWR. Also, cleaned up error handling in tdb_allrecord_lock() so we only get one log message on a r/o database. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit b87e14495d5b07e1b247218a72329f10ecb3da7f)
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: cleanup oob handling.Rusty Russell1-7/+6
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-06-20tdb2: add lib/tdb2 (from CCAN init-1161-g661d41f)Rusty Russell1-0/+1308
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>