Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0fd5be2955f8e6487c0f4ab711e2a6958bb8f412)
|
|
The following patches integrate it together, but from here on we build
it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
The caller should do this: the SAMBA compatibility later does.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 75a6a6ad64156ef3b13493be2970ae3cb99ccf8b)
|
|
We do this using hooks in tdb2.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 444fade529f68eb2b0aebbc8de442478c5c6f916)
|
|
They'll all be accessed via the tdb2 API.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 39f55294799c6443c0ad7bef09f1c113cf89d295)
|
|
We're going to use TDB2's API, so some TDB1 APIs are obviously unnecessary.
We also get rid of USE_RIGHT_MERGES and TRACE code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit b929638e3cfe629285af3ecd0813e03eaeaa1133)
|
|
The main change is to s/tdb/tdb1_/ everywhere.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit fab544c24c1ad6523f95893abcaec4e6cce6c2b4)
|
|
Since we've renamed everything in tdb1, they won't clash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 5d6194b434f3664d1025df12ef06c6a25f693bc8)
|
|
We import the entire codebase, putting a "tdb1_" prefix on the files
and changing the "tdb_" prefix to "tdb1_" everywhere.
The next patches will gradually merge it with the TDB2 code where
necessary.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 19e6c1a250ade1e7204ada17163294855585e825)
|
|
This lets us add the new files to a single place.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 476567430be6962625bf399192e20938985232c7)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
This is more accurate than returning TDB_ERR_EINVAL.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 91436a25574597dbd1fd2de5bcd5826a234100d6)
|
|
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)
|
|
Add the ecode arg to all the log functions, and log it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
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>
|
|
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.
(Imported from CCAN commit de432e8f857ce23bccde7c6ffa3e7e21456df18b)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
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>
|
|
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>
|
|
It can be 64 bits, for huge databases.
(Imported from CCAN commit 736c033322079baf754261d82b6a83de53b2bb4e)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
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>
|
|
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>
|
|
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
|
|
This is simplistic. We need to support making TDB2 a standalone library,
but for now, we simply built it in-tree.
Once we have tdb1 compatibility in tdb2, we can rename this option to
--enable-tdb2.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
Soon, TDB2 will handle tdb1 files, but until then, we substitute.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
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>
|
|
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|