- 31 Aug, 2011 40 commits
-
-
Rusty Russell authored
-
Rusty Russell authored
It's only used in two files, make it static in one and do it manually in the other.
-
Rusty Russell authored
Move the tdb1_repack() code into the core, make it general, rename to tdb_repack(). It's generic code: copy database into temporary, wipe it, copy back.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag. Also, change tdb1_check's checkfn argument to return an error code (and set tdb->last_error accordingly).
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag; we now only do a tdb1_traverse_read on a read-only database, as there is no tdb2 equivalent.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Finally, we gut tdb1_open() to the tdb1-specific parts, and call it from tdb_open if they specify the TDB_VERSION1 flag or the version is a TDB1. We also unify tdb_close(), based on the TDB_VERSION1 flag. Note that tdb_open(TDB_VERSION1) will fail on an existing tdb if it's a TDB2.
-
Rusty Russell authored
It also only makes sense with O_CREAT.
-
Rusty Russell authored
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.
-
Rusty Russell authored
This brings it closer to tdb_open(), so we can unify more easily.
-
Rusty Russell authored
We're going to need access to it from tdb1_open, so expose it now. It's better in hash.c anyway.
-
Rusty Russell authored
This is a percursor to unifying with tdb_open() from tdb2, which handles this itself.
-
Rusty Russell authored
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.
-
Rusty Russell authored
There's also a semantic change here: for tdb1, being read-only meant no locking, and it was an error to try to lock a r/o database. For TDB2, you'd need to specify TDB_NOLOCK, which suppresses locking silently.
-
Rusty Russell authored
This means converting the tdb1 inbuilt hash functions to the tdb2-style, so they return 64 bit. We truncate to 32 bit everywhere but in tdb_check() which needs to do so explicitly.
-
Rusty Russell authored
In TDB2, the user can override locking functions, so they may deliberarely fail (eg. be non-blocking) expecting to retry. For this reason, the TDB2 API requires the caller to cancel the transaction if tdb_transaction_prepare_commit() fails.
-
Rusty Russell authored
The TDB1 code logs multiple times on errors; we must prevent that in the limited case where locking fails. With TDB2, this can happen due to the lock function attribute, where the user supplies replacement locking functions which are allowed to return with errno EAGAIN or EINTR for various special-effects. Flooding the logs for this is unfriendly.
-
Rusty Russell authored
This means they will use the TDB_ATTRIBUTE_FLOCK functions, and get automatic reopen support.
-
Rusty Russell authored
Because tdb2 allows multiple opens of the same TDB, we separate out the file information from the struct tdb_context. Do the same for tdb1.
-
Rusty Russell authored
This will be set for old TDBs; we can start distinguishing paths based on it now.
-
Rusty Russell authored
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 authored
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 authored
-
Rusty Russell authored
To do this, we make sure that the first few fields of tdb1_context and tdb_context are the same. This sweep also fixes up a few paths where we weren't setting tdb->ecode before our old logging function.
-
Rusty Russell authored
They're about to start sharing TDB2's definitions.
-
Rusty Russell authored
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 authored
The caller should do this: the SAMBA compatibility later does.
-
Rusty Russell authored
We do this using hooks in tdb2.
-
Rusty Russell authored
They'll all be accessed via the tdb2 API.
-
Rusty Russell authored
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.
-