1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
Commit Graph

15 Commits

Author SHA1 Message Date
Amitay Isaacs
a63d731ae0 lib/tdb2: Do not include config.h in (to-be) public library, use replace.
Like tdb1, it's the caller's responsibility to set up various config
options (eg. by #include "config.h") before including the public
header.

We use HAVE_CCAN for including the (private) CCAN headers, otherwise
dummy macros are used.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-21 15:29:17 +10:30
Rusty Russell
eff985b7ef tdb2: add an internal TDB_CANT_CHECK flag.
This will be used shortly to indicate that a TDB2 file indicates it
cannot be checked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit e01d795c8964b791def1e9f68c386b350b3a2a84)
2011-12-05 17:04:30 +10:30
Rusty Russell
4bc8b0c194 tdb2: use HAVE_LIBREPLACE instead of _SAMBA_BUILD_.
This is what lib/tdb2 really wants: to know if it should use normal
headers or replace.h.  It currently uses _SAMBA_BUILD_, which is wrong
for ldb, for example.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Tue Nov  1 03:19:58 CET 2011 on sn-devel-104
2011-11-01 03:19:58 +01:00
Rusty Russell
b50b48f575 tdb2: add tdb_attribute_tdb1_max_dead
This allows us to simulate the old "volatile" flag for tdb1.  It's not
necessary for tdb2.

As this is the last function in tdb1.h, we remove that file.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit b8e64e9346793164651a36eccb3c205077e5c91b)
2011-09-14 08:06:13 +09:30
Rusty Russell
13238912fa tdb2: expose and document tdb1_incompatible_hash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit a4f2eb983b92b68bcad2a0d640924b8b456e3d69)
2011-09-14 08:05:13 +09:30
Rusty Russell
a15c1cf175 tdb2: tdb_repack
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.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit e487983a4099b6f760056ff7182f2ff543e6da71)
2011-09-14 08:03:13 +09:30
Rusty Russell
6e16e29d53 tdb2: add TDB_ATTRIBUTE_TDB1_HASHSIZE
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-14 07:47:13 +09:30
Rusty Russell
5a3f207318 tdb2: add TDB_VERSION1 flag.
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-14 07:36:13 +09:30
Rusty Russell
b67acb7e2a tdb2: tdb_foreach()
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-14 07:20:13 +09:30
Rusty Russell
617c1fcfa4 tdb2: save openhook, allow tdb_get_attribute() on it.
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-14 07:18:13 +09:30
Rusty Russell
bdc5499205 tdb2: add TDB_RDONLY flag, allow setting/unsetting it.
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-14 07:16:13 +09:30
Rusty Russell
ab61a57e01 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.

(Imported from CCAN commit 6e3d9e8a66bf8b45150500f176452ee8e9ee9927)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 07:12:13 +09:30
Rusty Russell
e8eebe0fbc 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.

(Imported from CCAN commit baa17ee2d5e01a32030f19e566007417d72b4b6e)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 07:06:13 +09:30
Rusty Russell
6b3f9ac0f8 tdb2: minor changes to SAMBIFY it.
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-20 11:18:35 +02:00
Rusty Russell
d24ddb0350 tdb2: add lib/tdb2 (from CCAN init-1161-g661d41f)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00