Rusty Russell [Wed, 31 Aug 2011 05:51:16 +0000 (15:21 +0930)]
tdb2: Make TDB1 code use TDB2's open flags.
This means getting rid of TDB_VOLATILE (perhaps we should use an
attribute for that?), TDB_INCOMPATIBLE_HASH (use the
tdb_attribute_hash for that) and TDB_CLEAR_IF_FIRST (use the
tdb_attribute_openhook for that).
We also get rid of TDB_DISALLOW_NESTING: that's the default for TDB2.
Rusty Russell [Wed, 31 Aug 2011 05:50:16 +0000 (15:20 +0930)]
tdb2: approximate INCOMPATIBLE_HASH flag with tdb1_incompatible_hash()
Rather than leak TDB_INCOMPATIBLE_HASH through to the TDB2 API, we make
it that if they use the tdb1_incompatible_hash function as their hash,
then we treat it as if they had specified the TDB_INCOMPATIBLE_HASH
flag (ie. we mark the header so it's unusable by tdb < 1.2.6).
This precludes the possibility of using TDB_INCOMPATIBLE_HASH with a
custom hash function: that used to allow the user to ensure that old TDB
versions couldn't open the TDB file (and recent ones check the header to
ensure they're using the right hash). But that's a small loss.
Rusty Russell [Wed, 31 Aug 2011 05:46:16 +0000 (15:16 +0930)]
tdb2: rearrange tdb_context layout so tdb1_context can match
By moving all the parts of struct tdb_context which logging and
locking use to the beginning of the structure, we can make
tdb1_context match, and thus pass that directly to the tdb_logerr()
function, and later the locking functions.
This is only necessary until we unify tdb1_context and tdb_context.
Rusty Russell [Wed, 31 Aug 2011 04:25:15 +0000 (13:55 +0930)]
tdb2: Hand error code to logging function.
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.
Rusty Russell [Wed, 31 Aug 2011 01:15:12 +0000 (10:45 +0930)]
tdb2: move transaction lock
Make it the same offset as TDB1. This isn't strictly necessary, but
it would allow for total unification later, since TDB1 and TDB2's
transaction code is otherwise completely compatible.
Rusty Russell [Wed, 31 Aug 2011 01:14:12 +0000 (10:44 +0930)]
tdb2: enforce TDB_CONVERT
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.
Rusty Russell [Wed, 31 Aug 2011 01:13:12 +0000 (10:43 +0930)]
tdb2: cleanup oob handling.
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.
Rusty Russell [Wed, 31 Aug 2011 01:10:12 +0000 (10:40 +0930)]
tdb2: Fix to always use 64-bit offset definition
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.
Rusty Russell [Tue, 30 Aug 2011 04:31:26 +0000 (14:01 +0930)]
Makefile: speed fastcheck
Rather than timeout, explicitly disable tests_pass_valgrind and
tests_compile_coverage. This is important now we run under valgrind
the first time we run the tests, thus would always time out and not
run most of the tests at all!
"make check" takes 7m57s, old "make fastcheck" takes 3m28s, and this takes
only 1m57s, but much more is run (as shown by the larger score total).
Rusty Russell [Tue, 30 Aug 2011 04:31:25 +0000 (14:01 +0930)]
ccanlint: clean up reduced feature handling.
Putting the reduced config.h in the current directory means that it's
actually being picked up by other tests, such as the string checks.
So move it to a sub-directory where we need an explicit -I.
We also fix the dependencies, so that "--target
tests_pass_without_features" works.
Rusty Russell [Tue, 30 Aug 2011 04:31:25 +0000 (14:01 +0930)]
ccanlint: handle duplicate dependencies in _info
We eliminate dependencies as we recurse, but if a single _info file
lists a dependency twice, we add it to the list twice and this skip
over the middle ones.
Rusty Russell [Tue, 30 Aug 2011 04:27:08 +0000 (13:57 +0930)]
ccanlint: keep separate array of compiled versions.
Rather than mug the old ->compiled version when we reduce features,
keep both in the structure. This makes it clear that we are using the
right version (we weren't in all cases, in particular we weren't
recompiling the test helpers correctly.
Rusty Russell [Wed, 24 Aug 2011 03:22:46 +0000 (12:52 +0930)]
ccanlint: allow per-file restrictions, so we don't have to remove all tests.
For example, valgrind can't handle some things, so we may need to
switch it off, but we don't want to do that for every test.
So, start a standard format for per-file restrictions, eg:
Ccanlint: tests_pass_valgrind test/foo.c:FAIL
For the moment, only tests_pass_valgrind takes options, so it has to
change: we now have a helper which returns the array of options
applicable to a given file.
Rusty Russell [Wed, 24 Aug 2011 03:22:24 +0000 (12:52 +0930)]
ccanlint: make valgrind understand child output.
We turned on --child-silent-after-fork=yes, because the output
confused our dumb parser. Now we split output by prefix ("==<pid>==")
and then we can sort out the leaks from the errors.
Rusty Russell [Mon, 22 Aug 2011 03:17:08 +0000 (12:47 +0930)]
tdb2: fix intermittant failure in run-50-multiple-freelists-fail.c
layout.c's TDB creation functions were incorrect in case of a hash
collision, causing occasional failure. Make it always use the
(previously-failing) seed value, and fix it.
Joey Adams [Mon, 15 Aug 2011 06:36:33 +0000 (02:36 -0400)]
btree: Changed license from BSD-3 to MIT, and set version to 0.2
NOTE: btree was originally copyright 2010, and has not been
touched by me since then. I don't know if changing the license
to something more permissive requires updating the copyright year
or not.
Joey Adams [Mon, 15 Aug 2011 06:06:17 +0000 (02:06 -0400)]
block_pool: Changed license from BSD-3 to MIT, and set version to 0.1
NOTE: block_pool was originally copyright 2009, and has not been
touched by me since then. I don't know if changing the license
to something more permissive requires updating the copyright year
or not.
Douglas Bagnall [Sat, 13 Aug 2011 12:19:59 +0000 (21:49 +0930)]
opt: incidental comment and whitespace repair
This comment occurred in a couple of places:
/* Set an integer value, various forms. Sets to 1 on arg == NULL. */
One instance was clearly spurious, while the other was misleading.
Another resolution to this mismatch would be to add
"if (arg == NULL){*l = 1; return NULL}" somewhere, but I suspect
it may have been left out/removed because someone thought better.