summaryrefslogtreecommitdiff
path: root/lib/tdb2/open.c
AgeCommit message (Collapse)AuthorFilesLines
2011-09-14tdb2: tdb_foreach()Rusty Russell1-0/+10
Create an iterator over every open tdb (not internal TDBs). This is useful for re-establishing the tdb1-style active lock for CLEAR_IF_FIRST. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 1a0c636bc38213bd0322db47529f78f2dc22ffdd)
2011-09-14tdb2: keep link of every non-internal tdb.Rusty Russell1-22/+19
Instead of a per-file linked list, use a per-tdb list. This is needed for tdb_foreach(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 2414f261918b4fb8a549dd385dba32118e37bf85)
2011-09-14tdb2: save openhook, allow tdb_get_attribute() on it.Rusty Russell1-13/+14
This makes it easy to call it again after a fork(), such as for re-establishing the CLEAR_IF_FIRST files locks. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 937d0babe99dcd315040a9e48430140e63e4a7df)
2011-09-14tdb2: add TDB_RDONLY flag, allow setting/unsetting it.Rusty Russell1-3/+10
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: save open_flags instead of mmap_flags.Rusty Russell1-2/+1
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-14tdb2: enforce TDB_CONVERTRusty Russell1-0/+6
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 Russell1-1/+3
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 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-08-31tdb2: add full LGPL headersRusty Russell1-0/+17
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: add lib/tdb2 (from CCAN init-1161-g661d41f)Rusty Russell1-0/+661
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>