summaryrefslogtreecommitdiffstats
path: root/lib/tdb2/io.c
Commit message (Collapse)AuthorAgeFilesLines
* TDB2: Goodbye TDB2, Hello NTDB.Rusty Russell2012-06-191-650/+0
| | | | | | | | | | | This renames everything from tdb2 to ntdb: importantly, we no longer use the tdb_ namespace, so you can link against both ntdb and tdb if you want to. This also enables building of standalone ntdb by the autobuild script. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* TDB2: more internal cleanups after TDB1 compatibility removal.Rusty Russell2012-06-191-30/+27
| | | | | | | | This eliminates the separate tdb2 substructure, and makes some tdb1-required functions static. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* TDB2: remove TDB1 compatibility.Rusty Russell2012-06-191-5/+0
| | | | | | | This rips out all the TDB1 compatibility from tdb2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* lib/tdb2: fix OpenBSD incoherent mmap (tdb2 version)Rusty Russell2012-03-221-7/+25
| | | | | | | | This handles incoherent mmaps for TDB2 native databases, by forcing mmap on for such systems, just like we did for tdb1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* lib/tdb2: fix error string formatting.Rusty Russell2012-03-141-2/+2
| | | | | | | This caused a crash on PPC64 when we failed the mmap (found by failtest, reported by Amitay) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* tdb2: careful on wrap.Rusty Russell2012-01-301-10/+19
| | | | | | | | | | | | 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)
* tdb2: add error conversion functions.Rusty Russell2011-09-141-4/+4
| | | | | | | | | | 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)
* tdb2: unify tdb1_get_seqnum/tdb1_increment_seqnum into ↵Rusty Russell2011-09-141-0/+5
| | | | | | | | | tdb_get_seqnum/tdb_inc_seqnum Switch on the TDB_VERSION1 flag. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 57359c26e9626aa986ee0538efd13a44a466f39d)
* tdb2: merge tdb1_context into tdb_context.Rusty Russell2011-09-141-24/+24
| | | | | | | | | | 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)
* tdb2: add TDB_RDONLY flag, allow setting/unsetting it.Rusty Russell2011-09-141-5/+5
| | | | | | | | | | 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)
* tdb2: save open_flags instead of mmap_flags.Rusty Russell2011-09-141-1/+8
| | | | | | | 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)
* tdb2: cleanup oob handling.Rusty Russell2011-09-141-17/+21
| | | | | | | | | | | | | | | | | 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>
* tdb2: add lib/tdb2 (from CCAN init-1161-g661d41f)Rusty Russell2011-06-201-0/+615
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>