summaryrefslogtreecommitdiff
path: root/lib/tdb2/tdb2.h
AgeCommit message (Collapse)AuthorFilesLines
2011-09-14tdb2: add TDB_ATTRIBUTE_TDB1_HASHSIZERusty Russell1-3/+19
This replaces the tdb1_open "hash_size" argument. It will only be valid when you call tdb_open() with O_CREAT in open_flags, and TDB_VERSION1 in tdb_flags. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 49475d68deecd0b31597ed6094229171d2699b11)
2011-09-14tdb2: add TDB_VERSION1 flag.Rusty Russell1-0/+1
This will be set for old TDBs; we can start distinguishing paths based on it now. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 2b50be90a23893a06e0f1436a31d18b97ad0e11d)
2011-09-14tdb2: tdb_foreach()Rusty Russell1-0/+14
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: save openhook, allow tdb_get_attribute() on it.Rusty Russell1-2/+0
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-0/+1
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: Hand error code to logging function.Rusty Russell1-0/+1
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: Fix to always use 64-bit offset definitionRusty Russell1-0/+4
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-06-20tdb2: minor changes to SAMBIFY it.Rusty Russell1-0/+2
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 Russell1-0/+846
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>