summaryrefslogtreecommitdiff
path: root/lib/tdb2/lock.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>
2011-09-14tdb2: add error conversion functions.Rusty Russell1-2/+2
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: check lock owner in tdb1 backend.Rusty Russell1-3/+11
This reports errors if we fork() while holding a lock, or misuse a tdb which we have dual-opened. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit bef6f1b02e95370ecb2cb44be87c82afc9cb74b2)
2011-09-14tdb2: unify tdb1_chainlock et al. into tdb_chainlockRusty Russell1-6/+12
Switch on the TDB_VERSION1 flag. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit ceb2f3eacbad917ee990afbc3dd800bfb0607887)
2011-09-14tdb2: unify tdb1_open into tdb_openRusty Russell1-1/+6
Finally, we gut tdb1_open() to the tdb1-specific parts, and call it from tdb_open if they specify the TDB_VERSION1 flag or the version is a TDB1. We also unify tdb_close(), based on the TDB_VERSION1 flag. Note that tdb_open(TDB_VERSION1) will fail on an existing tdb if it's a TDB2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit c8c3b3568677e8b0105f84e4ab068c580faf4591)
2011-09-14tdb2: make tdb1 use same low-level lock functions.Rusty Russell1-18/+18
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-3/+4
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-06-20tdb2: add lib/tdb2 (from CCAN init-1161-g661d41f)Rusty Russell1-0/+875
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>