[SCM] Samba Shared Repository - branch master updated

Rusty Russell rusty at samba.org
Mon Jun 18 23:32:03 MDT 2012


The branch, master has been updated
       via  7e80b89 ntdb: add autoconf support.
       via  1fe797a ntdb: put it back into the build.
       via  13ac664 libcli: use tdb directly, not tdb_compat.
       via  316e5e3 lib/tdb_wrap: use tdb directly, not tdb_compat.
       via  df4a6e8 ldb: use tdb directly, not tdb_compat.
       via  6dc02e8 lib/dbwrap: depend directly on tdb, not tdb_compat.
       via  2fc3265 lib/util_tdb: depend directly on tdb, not tdb_compat.
       via  5ff92d8 ntdb: update documentation.
       via  b888bc4 ntdb: optimize ntdb_fetch.
       via  8fdd20b ntdb: add -h arg to ntdbrestore
       via  a941b19 ntdb: reduce default hashsize on ntdbtorture.
       via  87f871a ntdb: add NTDB_ATTRIBUTE_HASHSIZE
       via  dd42962 ntdb: remove hash table trees.
       via  f986554 ntdb: special accessor functions for read/write of an offset.
       via  9133a98 ntdb: inline oob check
       via  d938c0b ntdb: allocator attribute.
       via  6d5a3e1 ntdb: still prepare recovery area with NTDB_NOSYNC.
       via  89b0d5a ntdb: simply disallow NULL names.
       via  7fae6c4 ntdb: reduce transaction pagesize from 64k to 16k.
       via  35381ca ntdb: remove last block transactoin logic.
       via  db25088 ntdb: create initial database to be multiple of NTDB_PGSIZE.
       via  9396757 ntdb: make sure file is always a multiple of PAGESIZE (now NTDB_PGSIZE)
       via  dd4eed4 ntdb: fix recovery data write.
       via  40cf088 ntdb: enhance external-helper test code.
       via  3bccb61 ntdb: use NTDB_LOG_WARNING level for failed open() without O_CREAT.
       via  c727362 ccan: remove bogus debug print.
       via  8a7c535 ntdb: make fork test more thorough.
       via  d48f6f8 ntdb: print 
 at end of log messages in tests.
       via  5027f9c ntdb: reduce race between creating file and getting open lock.
       via  1765c0f ntdb: catch any valgrind errors in test
       via  fc9b8ee ntdb: catch any valgrind errors in test
       via  f5e9ed1 ntdb: remove ntdb_error()
       via  16cc345 TDB2: Goodbye TDB2, Hello NTDB.
       via  76758b9 tdb2: Fix typo in TDB1_porting.txt
       via  c3dcdf0 TDB2: more internal cleanups after TDB1 compatibility removal.
       via  cab6e11 TDB2: remove TDB1 compatibility.
       via  6244f66 TDB2: make SAMBA use tdb1 again for the moment.
       via  5bad913 ccan: check for err.h ourselves
      from  85b8439 WHATSNEW: Fix typo.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7e80b89d48a3c9c048be4d75bae11f12a6d37f2c
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:17 2012 +0930

    ntdb: add autoconf support.
    
    This is copied from tdb; we build the utilities, but as nothing else
    links against it, we shouldn't be adding anything to the normal samba
    binary sizes.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
    
    Autobuild-User(master): Rusty Russell <rusty at rustcorp.com.au>
    Autobuild-Date(master): Tue Jun 19 07:31:06 CEST 2012 on sn-devel-104

commit 1fe797aada0f546e8d557625a78843274b7e5fc5
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:11 2012 +0930

    ntdb: put it back into the build.
    
    This doesn't do anything with it yet, just wires it back into the build.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 13ac664a6d264564da16078f0b5fb9b7df6e185f
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:10 2012 +0930

    libcli: use tdb directly, not tdb_compat.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 316e5e376c793d1f9882eebddbbd855cf121cce4
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:10 2012 +0930

    lib/tdb_wrap: use tdb directly, not tdb_compat.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit df4a6e82280845668dee6fe10f2025c9fa2b958c
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:10 2012 +0930

    ldb: use tdb directly, not tdb_compat.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 6dc02e832a57a9af882bbb94dfa56bfdabb70eb8
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:10 2012 +0930

    lib/dbwrap: depend directly on tdb, not tdb_compat.
    
    Simple change, as we get rid of tdb_compat in favour of either ntdb directly
    or dbwrap.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 2fc32658734d7196de5574c8cadeaea913e255e1
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:10 2012 +0930

    lib/util_tdb: depend directly on tdb, not tdb_compat.
    
    Simple change, as we get rid of tdb_compat in favour of tdb directly.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 5ff92d8f7d15e42745e53fd40ffb8a765c9ea2d8
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:09 2012 +0930

    ntdb: update documentation.
    
    Update the design.lyx file with the latest status and the change in hashing.
    Also, refresh and add examples to the TDB_porting.txt file.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit b888bc4316f3f9c74b6768ddb1db1ec8fbac975e
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:09 2012 +0930

    ntdb: optimize ntdb_fetch.
    
    We access the key on lookup, then access the data in the caller.  It
    makes more sense to access both at once.  We also put in a likely()
    for the case where the hash is not chained.
    
    Before:
    Adding 1000 records: 3644-3724(3675) ns (129656 bytes)
    Finding 1000 records: 1596-1696(1622) ns (129656 bytes)
    Missing 1000 records: 1409-1525(1452) ns (129656 bytes)
    Traversing 1000 records: 1636-1747(1668) ns (129656 bytes)
    Deleting 1000 records: 3138-3223(3175) ns (129656 bytes)
    Re-adding 1000 records: 3278-3414(3329) ns (129656 bytes)
    Appending 1000 records: 5396-5529(5426) ns (253312 bytes)
    Churning 1000 records: 9451-10095(9584) ns (253312 bytes)
    smbtorture results (--entries=1000)
    ntdb speed 183881-191112(188223) ops/sec
    
    After:
    Adding 1000 records: 3590-3701(3640) ns (129656 bytes)
    Finding 1000 records: 1539-1605(1566) ns (129656 bytes)
    Missing 1000 records: 1398-1440(1413) ns (129656 bytes)
    Traversing 1000 records: 1629-2015(1710) ns (129656 bytes)
    Deleting 1000 records: 3118-3236(3163) ns (129656 bytes)
    Re-adding 1000 records: 3235-3355(3275) ns (129656 bytes)
    Appending 1000 records: 5335-5444(5385) ns (253312 bytes)
    Churning 1000 records: 9350-9955(9494) ns (253312 bytes)
    smbtorture results (--entries=1000)
    ntdb speed 180559-199981(195106) ops/sec

commit 8fdd20b22f6b27b616b5b3a2285a267ffae0a262
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:09 2012 +0930

    ntdb: add -h arg to ntdbrestore
    
    Since our default hashsize is 8192 not 131, we look fat when we convert
    near-empty TDBs.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit a941b19e5d747a5468b3c10d4a1c95f539c476ac
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:08 2012 +0930

    ntdb: reduce default hashsize on ntdbtorture.
    
    Just like tdbtorture, having a hashsize of 2 stresses us much more!
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 87f871aae392279b9475ea74ffe3bb9149e02e7c
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:08 2012 +0930

    ntdb: add NTDB_ATTRIBUTE_HASHSIZE
    
    Since we've given up on expansion, let them frob the hashsize again.
    We have attributes, so we should use them for optional stuff like
    this.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit dd42962878ab7c9ddfa79d7c32094fb6748017b8
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:43:04 2012 +0930

    ntdb: remove hash table trees.
    
    TDB2 started with a top-level hash of 1024 entries, divided into 128
    groups of 8 buckets.  When a bucket filled, the 8 bucket group
    expanded into pointers into 8 new 64-entry hash tables.  When these
    filled, they expanded in turn, etc.
    
    It's a nice idea to automatically expand the hash tables, but it
    doesn't pay off.  Remove it for NTDB.
    
    1) It only beats TDB performance when the database is huge and the
       TDB hashsize is small.  We are about 20% slower on medium-size
       databases (1000 to 10000 records), worse on really small ones.
    2) Since we're 64 bits, our hash tables are already twice as expensive
       as TDB.
    3) Since our hash function is good, it means that all groups tend to
       fill at the same time, meaning the hash enlarges by a factor of 128
       all at once, leading to a very large database at that point.
    4) Our efficiency would improve if we enlarged the top level, but
       that makes our minimum db size even worse: it's already over 8k,
       and jumps to 1M after about 1000 entries!
    5) Making the sub group size larger gives a shallower tree, which
       performs better, but makes the "hash explosion" problem worse.
    6) The code is complicated, having to handle delete and reshuffling
       groups of hash buckets, and expansion of buckets.
    7) We have to handle the case where all the records somehow end up with
       the same hash value, which requires special code to chain records for
       that case.
    
    On the other hand, it would be nice if we didn't degrade as badly as
    TDB does when the hash chains get long.
    
    This patch removes the hash-growing code, but instead of chaining like
    TDB does when a bucket fills, we point the bucket to an array of
    record pointers.  Since each on-disk NTDB pointer contains some hash
    bits from the record (we steal the upper 8 bits of the offset), 99.5%
    of the time we don't need to load the record to determine if it
    matches.  This makes an array of offsets much more cache-friendly than
    a linked list.
    
    Here are the times (in ns) for tdb_store of N records, tdb_store of N
    records the second time, and a fetch of all N records.  I've also
    included the final database size and the smbtorture local.[n]tdb_speed
    results.
    
    Benchmark details:
    1) Compiled with -O2.
    2) assert() was disabled in TDB2 and NTDB.
    3) The "optimize fetch" patch was applied to NTDB.
    
    10 runs, using tmpfs (otherwise massive swapping as db hits ~30M,
    despite plenty of RAM).
    
    				Insert	Re-ins	Fetch	Size	dbspeed
    				(nsec)	(nsec)	(nsec)	(Kb)	(ops/sec)
    TDB (10000 hashsize):
    	100 records:		 3882	 3320	1609	   53	203204
    	1000 records:		 3651	 3281	1571	  115	218021
    	10000 records:		 3404	 3326	1595	  880	202874
    	100000 records:		 4317	 3825	2097	 8262	126811
    	1000000 records:	11568	11578	9320	77005	 25046
    
    TDB2 (1024 hashsize, expandable):
    	100 records:		 3867	 3329	1699	   17	187100
    	1000 records:		 4040	 3249	1639	  154	186255
    	10000 records:		 4143	 3300	1695	 1226	185110
    	100000 records:		 4481	 3425	1800	17848	163483
    	1000000 records:	 4055	 3534	1878   106386	160774
    
    NTDB (8192 hashsize)
    	100 records:		 4259	 3376	1692	   82	190852
    	1000 records:		 3640	 3275	1566	  130	195106
    	10000 records:		 4337	 3438	1614	  773	188362
    	100000 records:		 4750	 5165	1746	 9001	169197
    	1000000 records:	 4897	 5180	2341	83838	121901
    
    Analysis:
    	1) TDB wins on small databases, beating TDB2 by ~15%, NTDB by ~10%.
    	2) TDB starts to lose when hash chains get 10 long (fetch 10% slower
    	   than TDB2/NTDB).
    	3) TDB does horribly when hash chains get 100 long (fetch 4x slower
    	   than NTDB, 5x slower than TDB2, insert about 2-3x slower).
    	4) TDB2 databases are 40% larger than TDB1.  NTDB is about 15% larger
    	   than TDB1

commit f986554b1e38d8dd40b4bf4748d4aeb470e27d2e
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:42:13 2012 +0930

    ntdb: special accessor functions for read/write of an offset.
    
    We also split off the NTDB_CONVERT case (where the ntdb is of a
    different endian) into its own io function.
    
    NTDB speed:
    Adding 10000 records: 3894-9951(8553) ns (815528 bytes)
    Finding 10000 records: 1644-4294(3580) ns (815528 bytes)
    Missing 10000 records: 1497-4018(3303) ns (815528 bytes)
    Traversing 10000 records: 1585-4225(3505) ns (815528 bytes)
    Deleting 10000 records: 3088-8154(6927) ns (815528 bytes)
    Re-adding 10000 records: 3192-8308(7089) ns (815528 bytes)
    Appending 10000 records: 5187-13307(11365) ns (1274312 bytes)
    Churning 10000 records: 6772-17567(15078) ns (1274312 bytes)
    NTDB speed in transaction:
    Adding 10000 records: 1602-2404(2214) ns (815528 bytes)
    Finding 10000 records: 456-871(778) ns (815528 bytes)
    Missing 10000 records: 393-522(503) ns (815528 bytes)
    Traversing 10000 records: 729-1015(945) ns (815528 bytes)
    Deleting 10000 records: 1065-1476(1374) ns (815528 bytes)
    Re-adding 10000 records: 1397-1930(1819) ns (815528 bytes)
    Appending 10000 records: 2927-3351(3184) ns (1274312 bytes)
    Churning 10000 records: 3921-4697(4378) ns (1274312 bytes)
    smbtorture results:
    ntdb speed 86581-191518(175666) ops/sec
    Applying patch..increase-top-level.patch

commit 9133a98c4425085dd86695bed1a48ec750a52430
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:42:12 2012 +0930

    ntdb: inline oob check
    
    The simple "is it in range" check can be inline; complex cases can be
    handed through to the normal or transaction handler.
    
    NTDB speed:
    Adding 10000 records: 4111-9983(9149) ns (815528 bytes)
    Finding 10000 records: 1667-4464(3810) ns (815528 bytes)
    Missing 10000 records: 1511-3992(3546) ns (815528 bytes)
    Traversing 10000 records: 1698-4254(3724) ns (815528 bytes)
    Deleting 10000 records: 3608-7998(7358) ns (815528 bytes)
    Re-adding 10000 records: 3259-8504(7805) ns (815528 bytes)
    Appending 10000 records: 5393-13579(12356) ns (1274312 bytes)
    Churning 10000 records: 6966-17813(16136) ns (1274312 bytes)
    NTDB speed in transaction:
    Adding 10000 records: 916-2230(2004) ns (815528 bytes)
    Finding 10000 records: 330-866(770) ns (815528 bytes)
    Missing 10000 records: 196-520(471) ns (815528 bytes)
    Traversing 10000 records: 356-879(800) ns (815528 bytes)
    Deleting 10000 records: 505-1267(1108) ns (815528 bytes)
    Re-adding 10000 records: 658-1681(1477) ns (815528 bytes)
    Appending 10000 records: 1088-2827(2498) ns (1274312 bytes)
    Churning 10000 records: 1636-4267(3785) ns (1274312 bytes)
    smbtorture results:
    ntdb speed 85588-189430(157110) ops/sec

commit d938c0b591d9c4aff9c92ae5eedd26ed97455f42
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:42:08 2012 +0930

    ntdb: allocator attribute.
    
    This is designed to allow us to make ntdb_context (and NTDB_DATA returned
    from ntdb_fetch) a talloc pointer.  But it can also be used for any other
    alternate allocator.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 6d5a3e1602a1db8ca8e778f5e4f40bb623dff1e7
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:39:33 2012 +0930

    ntdb: still prepare recovery area with NTDB_NOSYNC.
    
    NTDB_NOSYNC now just prevents the fsync/msync calls, which speeds
    testing while still providing full coverage.  It also provides safety
    against processes dying during transaction commit (though obviously,
    not against the machine dying).
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 89b0d5ac6cd7f2c47148a9ac87ce8d6aea40050b
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 19 12:38:33 2012 +0930

    ntdb: simply disallow NULL names.
    
    TDB allows this for internal databases, but it's a bad idea, since the
    name is useful for logging.
    
    They're a hassle to deal with, and we'd just end up putting "unnamed"
    in there, so let the user deal with it.  If they don't, they get an
    informative core dump.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 7fae6c44e2ffd720af406d1e0b48c08007091aab
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:30 2012 +0930

    ntdb: reduce transaction pagesize from 64k to 16k.
    
    The performance numbers for transaction pagesize are indeterminate:
    larger pagesizes means a smaller transaction array, and a better
    chance of having a contiguous record (more efficient for
    ntdb_parse_record and some internal operations inside a transaction).
    
    On the other hand, large pagesize means more I/O even if we change a
    few bytes.
    
    But it also controls the multiple by which we will enlarge the file,
    and hence the minimum db size.  It's 4k for tdb1, but 16k seems
    reasonable in these modern times.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 35381cad1fec621c66b8cc309ed5f4156c4c9d3d
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:30 2012 +0930

    ntdb: remove last block transactoin logic.
    
    Now our database is always a multiple of NTDB_PGSIZE, we can remove the
    special handling for the last block.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit db2508840d55842ebaf0c0d7a2fa3c855498e75f
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:29 2012 +0930

    ntdb: create initial database to be multiple of NTDB_PGSIZE.
    
    As copied from tdb1, there is logic in the transaction code to handle
    a non-PGSIZE multiple db, but in fact this only happens for a
    completely unused database: as soon as we add anything to it, it is
    expanded to a NTDB_PGSIZE multiple.
    
    If we create the database with a free record which pads it out to
    NTDB_PGSIZE, we can remove this last-page-is-different logic.
    
    Of course, the fake ntdbs we create in our tests now also need to be
    multiples of NTDB_PGSIZE, so we change some numbers there too.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 9396757676c304398a3e94ad01f2657e667b113c
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:29 2012 +0930

    ntdb: make sure file is always a multiple of PAGESIZE (now NTDB_PGSIZE)
    
    ntdb uses tdb's transaction code, and it has an undocumented but implicit
    assumption: that the transaction recovery area is always aligned to the
    transaction pagesize.  This means that no block will overlap the recovery
    area.
    
    This is maintained by rounding the size of the database up, so do the same
    for ntdb.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit dd4eed47591eeb6aafe5782690c1b550d0e3ebc4
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:29 2012 +0930

    ntdb: fix recovery data write.
    
    We were missing the last few bytes.  Found by 100 runs of ntdbtorture
    -t -k.
    
    The transaction test code didn't catch this, because usually those
    last few bytes are irrelevant to the actual contents of the database.
    We fix the test.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 40cf08823dadb7f2f9cb3b32c2e64b6242522ef4
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:29 2012 +0930

    ntdb: enhance external-helper test code.
    
    Our external test helper is a bit primitive when it comes to doing STORE or
    FETCH commands: let us specify the data we expect, instead of assuming it's
    the same as the key.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 3bccb610c166df1ce2ea5c8a80daa451bd6edf67
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:28 2012 +0930

    ntdb: use NTDB_LOG_WARNING level for failed open() without O_CREAT.
    
    This is a fairly common pattern in Samba, and if we log an error on
    every open it spams the logs.  On the other hand, other errors are
    potentially more serious, so we still use NTDB_LOG_ERROR on them.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit c7273629a24feea03d60f17e706806c261130c57
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:28 2012 +0930

    ccan: remove bogus debug print.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 8a7c535db1f40a0f7c43d4e36227ad172bf6a654
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:28 2012 +0930

    ntdb: make fork test more thorough.
    
    We document that the child of a fork() can do a brunlock() if the parent
    does a brlock: we should not log an error when they do this.
    
    Also, test the case where we fork() and return inside a parse function
    (which is allowed).
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit d48f6f884b2789828bb183249faf3918ec4e363a
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:28 2012 +0930

    ntdb: print \n at end of log messages in tests.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 5027f9cd02bf322498313a6b7aabd03fd510d725
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:27 2012 +0930

    ntdb: reduce race between creating file and getting open lock.
    
    In tdb, we grab the open lock immediately after we open the file.  In
    ntdb, we usually did some work first.  tdbtorture managed to get in
    before the creator grabbed the lock:
    
    	testing with 3 processes, 5000 loops, seed=1338246020
    	ntdb:torture.ntdb:IO Error:ntdb_open: torture.ntdb is not a ntdb file
    	29023:torture.ntdb:db open failed
    
    At cost of a little duplicated code, we can reduce the race.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 1765c0f9baf16ff1c2f5f109fb31e411831f0945
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:27 2012 +0930

    ntdb: catch any valgrind errors in test
    
    Make --valgrind and --valgrind-log options work!
    
    Amitay figured this out!
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit fc9b8ee7904ce6fc560ec869f4835c0b83815f3a
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:27 2012 +0930

    ntdb: catch any valgrind errors in test
    
    We need --error-exitcode=, otherwise valgrind errors don't cause the
    test to fail.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit f5e9ed1ea965827f29fe0fa77a32e09737e51b45
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:27 2012 +0930

    ntdb: remove ntdb_error()
    
    It was a hack to make compatibility easier.  Since we're not doing that,
    it can go away: all callers must use the return value now.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 16cc345d4f84367e70e133200f7aa335c2aae8c6
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:26 2012 +0930

    TDB2: Goodbye TDB2, Hello NTDB.
    
    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 at rustcorp.com.au>

commit 76758b9767fad45ff144bbfef3ab84bca5d4650e
Author: Kirill Smelkov <kirr at mns.spb.ru>
Date:   Mon Jun 18 22:30:26 2012 +0930

    tdb2: Fix typo in TDB1_porting.txt
    
    Judging by code it's tdb1, where you needed to free old key's dptr
    manually.
    
    Signed-off-by: Kirill Smelkov <kirr at mns.spb.ru>
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit c3dcdf08f3472748c9e7984488398064abcd454a
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:26 2012 +0930

    TDB2: more internal cleanups after TDB1 compatibility removal.
    
    This eliminates the separate tdb2 substructure, and makes some
    tdb1-required functions static.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit cab6e116786641e28747de3f70c8cd89ba17673f
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:25 2012 +0930

    TDB2: remove TDB1 compatibility.
    
    This rips out all the TDB1 compatibility from tdb2.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 6244f668a34279e6da62213333dfb32c3ccdb17d
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 22:30:04 2012 +0930

    TDB2: make SAMBA use tdb1 again for the moment.
    
    Otherwise the following surgery will break the SAMBA build and testsuite.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 5bad913938daca4ae3020653690701db83826954
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jun 18 20:06:45 2012 +0930

    ccan: check for err.h ourselves
    
    Heimdal does this, but that doesn't help the autoconf build or the standalone
    libntdb build.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/samba3.py                      |   15 +-
 lib/ccan/failtest/failtest.c                       |    1 -
 lib/ccan/libccan.m4                                |    2 +
 lib/ccan/wscript                                   |    1 +
 lib/dbwrap/dbwrap.h                                |    2 +-
 lib/ldb-samba/ldb_wrap.c                           |    5 +-
 lib/ldb-samba/wscript_build                        |    2 +-
 lib/ldb/ldb_tdb/ldb_index.c                        |    6 +-
 lib/ldb/ldb_tdb/ldb_search.c                       |    6 +-
 lib/ldb/ldb_tdb/ldb_tdb.c                          |    8 +-
 lib/ldb/ldb_tdb/ldb_tdb.h                          |    2 +-
 lib/ldb/ldb_tdb/ldb_tdb_wrap.c                     |   33 +-
 lib/ldb/wscript                                    |   14 +-
 lib/ntdb/ABI/ntdb-0.9.sigs                         |   38 +
 lib/{tdb2 => ntdb}/LICENSE                         |    0
 lib/{tdb2 => ntdb}/Makefile                        |    0
 lib/ntdb/check.c                                   |  725 +++
 lib/{tdb2 => ntdb}/configure                       |    0
 lib/ntdb/doc/TDB_porting.txt                       |  426 ++
 lib/ntdb/doc/design.lyx                            | 2727 ++++++++++++
 lib/ntdb/doc/design.pdf                            |  Bin 0 -> 191943 bytes
 lib/ntdb/doc/design.txt                            | 1270 ++++++
 lib/ntdb/free.c                                    |  977 ++++
 lib/ntdb/hash.c                                    |  642 +++
 lib/ntdb/io.c                                      |  681 +++
 lib/ntdb/libntdb.m4                                |   41 +
 lib/ntdb/lock.c                                    |  883 ++++
 lib/ntdb/ntdb.c                                    |  583 +++
 lib/ntdb/ntdb.h                                    |  932 ++++
 lib/ntdb/ntdb.pc.in                                |   11 +
 lib/ntdb/open.c                                    |  910 ++++
 lib/ntdb/private.h                                 |  661 +++
 lib/ntdb/pyntdb.c                                  |  589 +++
 lib/ntdb/summary.c                                 |  321 ++
 lib/ntdb/test/api-12-store.c                       |   57 +
 lib/ntdb/test/api-13-delete.c                      |  204 +
 lib/ntdb/test/api-14-exists.c                      |   54 +
 lib/ntdb/test/api-16-wipe_all.c                    |   46 +
 lib/ntdb/test/api-20-alloc-attr.c                  |  108 +
 lib/ntdb/test/api-21-parse_record.c                |   67 +
 lib/ntdb/test/api-55-transaction.c                 |   73 +
 lib/ntdb/test/api-80-tdb_fd.c                      |   32 +
 lib/ntdb/test/api-81-seqnum.c                      |   69 +
 lib/ntdb/test/api-82-lockattr.c                    |  240 +
 lib/ntdb/test/api-83-openhook.c                    |  100 +
 lib/ntdb/test/api-91-get-stats.c                   |   61 +
 lib/ntdb/test/api-92-get-set-readonly.c            |  105 +
 lib/ntdb/test/api-93-repack.c                      |   80 +
 lib/ntdb/test/api-add-remove-flags.c               |   89 +
 lib/ntdb/test/api-check-callback.c                 |   87 +
 lib/ntdb/test/api-firstkey-nextkey.c               |  159 +
 lib/ntdb/test/api-fork-test.c                      |  199 +
 lib/ntdb/test/api-locktimeout.c                    |  193 +
 lib/ntdb/test/api-missing-entries.c                |   44 +
 lib/ntdb/test/api-open-multiple-times.c            |   83 +
 lib/ntdb/test/api-record-expand.c                  |   51 +
 lib/ntdb/test/api-simple-delete.c                  |   39 +
 lib/ntdb/test/api-summary.c                        |   58 +
 lib/ntdb/test/external-agent.c                     |  261 ++
 lib/ntdb/test/external-agent.h                     |   51 +
 lib/ntdb/test/failtest_helper.c                    |   99 +
 lib/ntdb/test/failtest_helper.h                    |   18 +
 lib/ntdb/test/helpapi-external-agent.c             |    7 +
 lib/ntdb/test/helprun-external-agent.c             |    7 +
 lib/ntdb/test/helprun-layout.c                     |  362 ++
 lib/ntdb/test/layout.h                             |   79 +
 lib/ntdb/test/lock-tracking.c                      |  147 +
 lib/{tdb2 => ntdb}/test/lock-tracking.h            |    0
 lib/ntdb/test/logging.c                            |   30 +
 lib/ntdb/test/logging.h                            |   17 +
 lib/ntdb/test/ntdb-source.h                        |   11 +
 lib/ntdb/test/run-001-encode.c                     |   39 +
 lib/ntdb/test/run-001-fls.c                        |   33 +
 lib/ntdb/test/run-01-new_database.c                |   34 +
 lib/ntdb/test/run-02-expand.c                      |   62 +
 lib/ntdb/test/run-03-coalesce.c                    |  178 +
 lib/ntdb/test/run-04-basichash.c                   |  321 ++
 lib/ntdb/test/run-05-readonly-open.c               |   71 +
 lib/ntdb/test/run-10-simple-store.c                |   58 +
 lib/ntdb/test/run-11-simple-fetch.c                |   58 +
 lib/ntdb/test/run-12-check.c                       |   46 +
 lib/ntdb/test/run-15-append.c                      |  130 +
 lib/ntdb/test/run-25-hashoverload.c                |   92 +
 lib/ntdb/test/run-30-exhaust-before-expand.c       |   75 +
 lib/ntdb/test/run-35-convert.c                     |   58 +
 lib/ntdb/test/run-50-multiple-freelists.c          |   70 +
 lib/ntdb/test/run-56-open-during-transaction.c     |  165 +
 lib/ntdb/test/run-57-die-during-transaction.c      |  321 ++
 lib/ntdb/test/run-64-bit-tdb.c                     |   88 +
 lib/ntdb/test/run-90-get-set-attributes.c          |  159 +
 lib/ntdb/test/run-capabilities.c                   |  271 ++
 lib/ntdb/test/run-expand-in-transaction.c          |   46 +
 lib/ntdb/test/run-features.c                       |   62 +
 lib/ntdb/test/run-lockall.c                        |   74 +
 lib/ntdb/test/run-remap-in-read_traverse.c         |   57 +
 lib/ntdb/test/run-seed.c                           |   61 +
 lib/ntdb/test/run-tdb_errorstr.c                   |   52 +
 lib/ntdb/test/run-tdb_foreach.c                    |   86 +
 lib/ntdb/test/run-traverse.c                       |  203 +
 lib/{tdb2 => ntdb}/test/tap-interface.c            |    0
 lib/ntdb/test/tap-interface.h                      |   41 +
 lib/ntdb/tools/Makefile                            |   16 +
 lib/ntdb/tools/growtdb-bench.c                     |  114 +
 lib/ntdb/tools/mkntdb.c                            |   29 +
 lib/ntdb/tools/ntdbbackup.c                        |  340 ++
 lib/ntdb/tools/ntdbdump.c                          |  122 +
 lib/ntdb/tools/ntdbrestore.c                       |  251 ++
 lib/ntdb/tools/ntdbtool.c                          |  810 ++++
 lib/ntdb/tools/ntdbtorture.c                       |  545 +++
 lib/ntdb/tools/speed.c                             |  441 ++
 lib/ntdb/transaction.c                             | 1300 ++++++
 lib/ntdb/traverse.c                                |  100 +
 lib/ntdb/wscript                                   |  265 ++
 lib/tdb2/ABI/tdb-2.0.0.sigs                        |   40 -
 lib/tdb2/TODO                                      |    4 -
 lib/tdb2/_info                                     |   91 -
 lib/tdb2/check.c                                   |  870 ----
 lib/tdb2/doc/TDB1_porting.txt                      |   72 -
 lib/tdb2/doc/design-1.3.txt                        | 1049 -----
 lib/tdb2/doc/design.lyx                            | 2689 -----------
 lib/tdb2/doc/design.lyx,v                          | 4679 --------------------
 lib/tdb2/doc/design.pdf                            |  Bin 240440 -> 0 bytes
 lib/tdb2/doc/design.txt                            | 1258 ------
 lib/tdb2/free.c                                    |  975 ----
 lib/tdb2/hash.c                                    |  913 ----
 lib/tdb2/io.c                                      |  658 ---
 lib/tdb2/lock.c                                    |  895 ----
 lib/tdb2/open.c                                    |  884 ----
 lib/tdb2/private.h                                 |  780 ----
 lib/tdb2/pytdb.c                                   |  591 ---
 lib/tdb2/summary.c                                 |  338 --
 lib/tdb2/tdb.c                                     |  649 ---
 lib/tdb2/tdb.pc.in                                 |   11 -
 lib/tdb2/tdb1_check.c                              |  479 --
 lib/tdb2/tdb1_freelist.c                           |  322 --
 lib/tdb2/tdb1_hash.c                               |  347 --
 lib/tdb2/tdb1_io.c                                 |  530 ---
 lib/tdb2/tdb1_lock.c                               |  560 ---
 lib/tdb2/tdb1_open.c                               |  234 -
 lib/tdb2/tdb1_private.h                            |  178 -
 lib/tdb2/tdb1_summary.c                            |  202 -
 lib/tdb2/tdb1_tdb.c                                |  833 ----
 lib/tdb2/tdb1_transaction.c                        | 1336 ------
 lib/tdb2/tdb1_traverse.c                           |  373 --
 lib/tdb2/tdb2.h                                    |  941 ----
 lib/tdb2/test/api-12-store.c                       |   57 -
 lib/tdb2/test/api-13-delete.c                      |  210 -
 lib/tdb2/test/api-14-exists.c                      |   59 -
 lib/tdb2/test/api-16-wipe_all.c                    |   51 -
 lib/tdb2/test/api-21-parse_record.c                |   72 -
 lib/tdb2/test/api-55-transaction.c                 |   76 -
 lib/tdb2/test/api-80-tdb_fd.c                      |   37 -
 lib/tdb2/test/api-81-seqnum.c                      |   80 -
 lib/tdb2/test/api-82-lockattr.c                    |  248 --
 lib/tdb2/test/api-83-openhook.c                    |   99 -
 lib/tdb2/test/api-91-get-stats.c                   |   60 -
 lib/tdb2/test/api-92-get-set-readonly.c            |  121 -
 lib/tdb2/test/api-93-repack.c                      |   83 -
 lib/tdb2/test/api-add-remove-flags.c               |   94 -
 lib/tdb2/test/api-check-callback.c                 |   91 -
 lib/tdb2/test/api-firstkey-nextkey.c               |  164 -
 lib/tdb2/test/api-fork-test.c                      |  205 -
 lib/tdb2/test/api-locktimeout.c                    |  196 -
 lib/tdb2/test/api-missing-entries.c                |   44 -
 lib/tdb2/test/api-open-multiple-times.c            |   94 -
 lib/tdb2/test/api-record-expand.c                  |   56 -
 lib/tdb2/test/api-simple-delete.c                  |   44 -
 lib/tdb2/test/api-summary.c                        |   64 -
 lib/tdb2/test/api-tdb1-flag-removal.c              |   39 -
 lib/tdb2/test/external-agent.c                     |  252 --
 lib/tdb2/test/external-agent.h                     |   51 -
 lib/tdb2/test/failtest_helper.c                    |   96 -
 lib/tdb2/test/failtest_helper.h                    |   19 -
 lib/tdb2/test/helpapi-external-agent.c             |    8 -
 lib/tdb2/test/helprun-external-agent.c             |   10 -
 lib/tdb2/test/helprun-layout.c                     |  402 --
 lib/tdb2/test/jenkins-be-hash.tdb1                 |  Bin 696 -> 0 bytes
 lib/tdb2/test/jenkins-le-hash.tdb1                 |  Bin 696 -> 0 bytes
 lib/tdb2/test/layout.h                             |   87 -
 lib/tdb2/test/lock-tracking.c                      |  158 -
 lib/tdb2/test/logging.c                            |   30 -
 lib/tdb2/test/logging.h                            |   17 -
 lib/tdb2/test/old-nohash-be.tdb1                   |  Bin 696 -> 0 bytes
 lib/tdb2/test/old-nohash-le.tdb1                   |  Bin 696 -> 0 bytes
 lib/tdb2/test/run-001-encode.c                     |   41 -
 lib/tdb2/test/run-001-fls.c                        |   33 -
 lib/tdb2/test/run-01-new_database.c                |   39 -
 lib/tdb2/test/run-02-expand.c                      |   62 -
 lib/tdb2/test/run-03-coalesce.c                    |  178 -
 lib/tdb2/test/run-04-basichash.c                   |  260 --
 lib/tdb2/test/run-05-readonly-open.c               |   75 -
 lib/tdb2/test/run-10-simple-store.c                |   63 -
 lib/tdb2/test/run-11-simple-fetch.c                |   63 -
 lib/tdb2/test/run-12-check.c                       |   50 -
 lib/tdb2/test/run-15-append.c                      |  153 -
 lib/tdb2/test/run-20-growhash.c                    |  137 -
 lib/tdb2/test/run-25-hashoverload.c                |  113 -
 lib/tdb2/test/run-30-exhaust-before-expand.c       |   71 -
 lib/tdb2/test/run-35-convert.c                     |   57 -
 lib/tdb2/test/run-50-multiple-freelists.c          |   70 -
 lib/tdb2/test/run-56-open-during-transaction.c     |  168 -
 lib/tdb2/test/run-57-die-during-transaction.c      |  295 --
 lib/tdb2/test/run-64-bit-tdb.c                     |   72 -
 lib/tdb2/test/run-90-get-set-attributes.c          |  186 -
 lib/tdb2/test/run-capabilities.c                   |  271 --
 lib/tdb2/test/run-expand-in-transaction.c          |   39 -
 lib/tdb2/test/run-features.c                       |   62 -
 lib/tdb2/test/run-lockall.c                        |   74 -
 lib/tdb2/test/run-remap-in-read_traverse.c         |   57 -
 lib/tdb2/test/run-seed.c                           |   61 -
 lib/tdb2/test/run-tdb1-3G-file.c                   |  139 -
 lib/tdb2/test/run-tdb1-bad-tdb-header.c            |   51 -
 lib/tdb2/test/run-tdb1-check.c                     |   56 -
 lib/tdb2/test/run-tdb1-corrupt.c                   |  121 -
 lib/tdb2/test/run-tdb1-endian.c                    |   52 -
 lib/tdb2/test/run-tdb1-hashsize.c                  |   60 -
 lib/tdb2/test/run-tdb1-incompatible.c              |  208 -
 lib/tdb2/test/run-tdb1-nested-transactions.c       |   70 -
 lib/tdb2/test/run-tdb1-nested-traverse.c           |   84 -
 lib/tdb2/test/run-tdb1-no-lock-during-traverse.c   |  109 -
 lib/tdb2/test/run-tdb1-oldhash.c                   |   44 -
 lib/tdb2/test/run-tdb1-readonly-check.c            |   44 -
 lib/tdb2/test/run-tdb1-rwlock-check.c              |   41 -
 lib/tdb2/test/run-tdb1-seqnum-wrap.c               |   38 -
 lib/tdb2/test/run-tdb1-summary.c                   |   55 -
 lib/tdb2/test/run-tdb1-traverse-in-transaction.c   |   82 -
 lib/tdb2/test/run-tdb1-wronghash-fail.c            |  141 -
 lib/tdb2/test/run-tdb1-zero-append.c               |   33 -
 lib/tdb2/test/run-tdb1.c                           |   39 -
 lib/tdb2/test/run-tdb_errorstr.c                   |   52 -
 lib/tdb2/test/run-tdb_foreach.c                    |   86 -
 lib/tdb2/test/run-traverse.c                       |  203 -
 lib/tdb2/test/rwlock-be.tdb1                       |  Bin 696 -> 0 bytes
 lib/tdb2/test/rwlock-le.tdb1                       |  Bin 696 -> 0 bytes
 lib/tdb2/test/tap-interface.h                      |   41 -
 lib/tdb2/test/tdb1-external-agent.c                |  186 -
 lib/tdb2/test/tdb1-external-agent.h                |   43 -
 lib/tdb2/test/tdb1-lock-tracking.c                 |  146 -
 lib/tdb2/test/tdb1-lock-tracking.h                 |   26 -
 lib/tdb2/test/tdb1.corrupt                         |  Bin 192512 -> 0 bytes
 lib/tdb2/test/tdb2-source.h                        |   21 -
 lib/tdb2/tools/Makefile                            |   16 -
 lib/tdb2/tools/growtdb-bench.c                     |  114 -
 lib/tdb2/tools/mktdb2.c                            |   29 -
 lib/tdb2/tools/speed.c                             |  443 --
 lib/tdb2/tools/tdb2backup.c                        |  371 --
 lib/tdb2/tools/tdb2dump.c                          |  122 -
 lib/tdb2/tools/tdb2restore.c                       |  231 -
 lib/tdb2/tools/tdb2tool.c                          |  810 ----
 lib/tdb2/tools/tdb2torture.c                       |  545 ---
 lib/tdb2/transaction.c                             | 1343 ------
 lib/tdb2/traverse.c                                |  134 -
 lib/tdb2/wscript                                   |  304 --
 lib/tdb_compat/tdb_compat.c                        |  222 -
 lib/tdb_compat/tdb_compat.h                        |   85 -
 lib/tdb_compat/wscript                             |   11 +-
 lib/tdb_wrap/tdb_wrap.c                            |   34 +-
 lib/tdb_wrap/tdb_wrap.h                            |    2 +-
 lib/tdb_wrap/wscript_build                         |    2 +-
 lib/util/util_tdb.c                                |   12 +-
 lib/util/wscript_build                             |    2 +-
 libcli/auth/schannel_state_tdb.c                   |    4 +-
 script/autobuild.py                                |   10 +-
 selftest/wscript                                   |    3 -
 source3/Makefile-smbtorture4                       |    2 +-
 source3/Makefile.in                                |    8 +
 source3/configure.in                               |   47 +
 source3/lib/gencache.c                             |    5 -
 source3/lib/messages_local.c                       |    2 +-
 source3/lib/tdb_validate.c                         |    4 -
 source3/lib/util_tdb.c                             |  106 -
 source3/smbd/mangle_hash.c                         |    5 -
 source3/smbd/proto.h                               |    5 -
 source3/winbindd/idmap_tdb.c                       |    4 -
 source4/cluster/local.c                            |    1 -
 .../dsdb/samdb/ldb_modules/partition_metadata.c    |   12 +-
 source4/ntvfs/posix/posix_eadb.c                   |    3 +-
 testsuite/headers/wscript_build                    |    5 +
 wscript                                            |    6 +-
 wscript_build                                      |    1 +
 280 files changed, 23274 insertions(+), 37312 deletions(-)
 create mode 100644 lib/ntdb/ABI/ntdb-0.9.sigs
 rename lib/{tdb2 => ntdb}/LICENSE (100%)
 rename lib/{tdb2 => ntdb}/Makefile (100%)
 create mode 100644 lib/ntdb/check.c
 rename lib/{tdb2 => ntdb}/configure (100%)
 create mode 100644 lib/ntdb/doc/TDB_porting.txt
 create mode 100644 lib/ntdb/doc/design.lyx
 create mode 100644 lib/ntdb/doc/design.pdf
 create mode 100644 lib/ntdb/doc/design.txt
 create mode 100644 lib/ntdb/free.c
 create mode 100644 lib/ntdb/hash.c
 create mode 100644 lib/ntdb/io.c
 create mode 100644 lib/ntdb/libntdb.m4
 create mode 100644 lib/ntdb/lock.c
 create mode 100644 lib/ntdb/ntdb.c
 create mode 100644 lib/ntdb/ntdb.h
 create mode 100644 lib/ntdb/ntdb.pc.in
 create mode 100644 lib/ntdb/open.c
 create mode 100644 lib/ntdb/private.h
 create mode 100644 lib/ntdb/pyntdb.c
 create mode 100644 lib/ntdb/summary.c
 create mode 100644 lib/ntdb/test/api-12-store.c
 create mode 100644 lib/ntdb/test/api-13-delete.c
 create mode 100644 lib/ntdb/test/api-14-exists.c
 create mode 100644 lib/ntdb/test/api-16-wipe_all.c
 create mode 100644 lib/ntdb/test/api-20-alloc-attr.c
 create mode 100644 lib/ntdb/test/api-21-parse_record.c
 create mode 100644 lib/ntdb/test/api-55-transaction.c
 create mode 100644 lib/ntdb/test/api-80-tdb_fd.c
 create mode 100644 lib/ntdb/test/api-81-seqnum.c
 create mode 100644 lib/ntdb/test/api-82-lockattr.c
 create mode 100644 lib/ntdb/test/api-83-openhook.c
 create mode 100644 lib/ntdb/test/api-91-get-stats.c
 create mode 100644 lib/ntdb/test/api-92-get-set-readonly.c
 create mode 100644 lib/ntdb/test/api-93-repack.c
 create mode 100644 lib/ntdb/test/api-add-remove-flags.c
 create mode 100644 lib/ntdb/test/api-check-callback.c
 create mode 100644 lib/ntdb/test/api-firstkey-nextkey.c
 create mode 100644 lib/ntdb/test/api-fork-test.c
 create mode 100644 lib/ntdb/test/api-locktimeout.c
 create mode 100644 lib/ntdb/test/api-missing-entries.c
 create mode 100644 lib/ntdb/test/api-open-multiple-times.c
 create mode 100644 lib/ntdb/test/api-record-expand.c
 create mode 100644 lib/ntdb/test/api-simple-delete.c
 create mode 100644 lib/ntdb/test/api-summary.c
 create mode 100644 lib/ntdb/test/external-agent.c
 create mode 100644 lib/ntdb/test/external-agent.h
 create mode 100644 lib/ntdb/test/failtest_helper.c
 create mode 100644 lib/ntdb/test/failtest_helper.h
 create mode 100644 lib/ntdb/test/helpapi-external-agent.c
 create mode 100644 lib/ntdb/test/helprun-external-agent.c
 create mode 100644 lib/ntdb/test/helprun-layout.c
 create mode 100644 lib/ntdb/test/layout.h
 create mode 100644 lib/ntdb/test/lock-tracking.c
 rename lib/{tdb2 => ntdb}/test/lock-tracking.h (100%)
 create mode 100644 lib/ntdb/test/logging.c
 create mode 100644 lib/ntdb/test/logging.h
 create mode 100644 lib/ntdb/test/ntdb-source.h
 create mode 100644 lib/ntdb/test/run-001-encode.c
 create mode 100644 lib/ntdb/test/run-001-fls.c
 create mode 100644 lib/ntdb/test/run-01-new_database.c
 create mode 100644 lib/ntdb/test/run-02-expand.c
 create mode 100644 lib/ntdb/test/run-03-coalesce.c
 create mode 100644 lib/ntdb/test/run-04-basichash.c
 create mode 100644 lib/ntdb/test/run-05-readonly-open.c
 create mode 100644 lib/ntdb/test/run-10-simple-store.c
 create mode 100644 lib/ntdb/test/run-11-simple-fetch.c
 create mode 100644 lib/ntdb/test/run-12-check.c
 create mode 100644 lib/ntdb/test/run-15-append.c
 create mode 100644 lib/ntdb/test/run-25-hashoverload.c
 create mode 100644 lib/ntdb/test/run-30-exhaust-before-expand.c
 create mode 100644 lib/ntdb/test/run-35-convert.c
 create mode 100644 lib/ntdb/test/run-50-multiple-freelists.c
 create mode 100644 lib/ntdb/test/run-56-open-during-transaction.c
 create mode 100644 lib/ntdb/test/run-57-die-during-transaction.c
 create mode 100644 lib/ntdb/test/run-64-bit-tdb.c
 create mode 100644 lib/ntdb/test/run-90-get-set-attributes.c
 create mode 100644 lib/ntdb/test/run-capabilities.c
 create mode 100644 lib/ntdb/test/run-expand-in-transaction.c
 create mode 100644 lib/ntdb/test/run-features.c
 create mode 100644 lib/ntdb/test/run-lockall.c
 create mode 100644 lib/ntdb/test/run-remap-in-read_traverse.c
 create mode 100644 lib/ntdb/test/run-seed.c
 create mode 100644 lib/ntdb/test/run-tdb_errorstr.c
 create mode 100644 lib/ntdb/test/run-tdb_foreach.c
 create mode 100644 lib/ntdb/test/run-traverse.c
 rename lib/{tdb2 => ntdb}/test/tap-interface.c (100%)
 create mode 100644 lib/ntdb/test/tap-interface.h
 create mode 100644 lib/ntdb/tools/Makefile
 create mode 100644 lib/ntdb/tools/growtdb-bench.c
 create mode 100644 lib/ntdb/tools/mkntdb.c
 create mode 100644 lib/ntdb/tools/ntdbbackup.c
 create mode 100644 lib/ntdb/tools/ntdbdump.c
 create mode 100644 lib/ntdb/tools/ntdbrestore.c
 create mode 100644 lib/ntdb/tools/ntdbtool.c
 create mode 100644 lib/ntdb/tools/ntdbtorture.c
 create mode 100644 lib/ntdb/tools/speed.c
 create mode 100644 lib/ntdb/transaction.c
 create mode 100644 lib/ntdb/traverse.c
 create mode 100644 lib/ntdb/wscript
 delete mode 100644 lib/tdb2/ABI/tdb-2.0.0.sigs
 delete mode 100644 lib/tdb2/TODO
 delete mode 100644 lib/tdb2/_info
 delete mode 100644 lib/tdb2/check.c
 delete mode 100644 lib/tdb2/doc/TDB1_porting.txt
 delete mode 100644 lib/tdb2/doc/design-1.3.txt
 delete mode 100644 lib/tdb2/doc/design.lyx
 delete mode 100644 lib/tdb2/doc/design.lyx,v
 delete mode 100644 lib/tdb2/doc/design.pdf
 delete mode 100644 lib/tdb2/doc/design.txt
 delete mode 100644 lib/tdb2/free.c
 delete mode 100644 lib/tdb2/hash.c
 delete mode 100644 lib/tdb2/io.c
 delete mode 100644 lib/tdb2/lock.c
 delete mode 100644 lib/tdb2/open.c
 delete mode 100644 lib/tdb2/private.h
 delete mode 100644 lib/tdb2/pytdb.c
 delete mode 100644 lib/tdb2/summary.c
 delete mode 100644 lib/tdb2/tdb.c
 delete mode 100644 lib/tdb2/tdb.pc.in
 delete mode 100644 lib/tdb2/tdb1_check.c
 delete mode 100644 lib/tdb2/tdb1_freelist.c
 delete mode 100644 lib/tdb2/tdb1_hash.c
 delete mode 100644 lib/tdb2/tdb1_io.c
 delete mode 100644 lib/tdb2/tdb1_lock.c
 delete mode 100644 lib/tdb2/tdb1_open.c
 delete mode 100644 lib/tdb2/tdb1_private.h
 delete mode 100644 lib/tdb2/tdb1_summary.c
 delete mode 100644 lib/tdb2/tdb1_tdb.c
 delete mode 100644 lib/tdb2/tdb1_transaction.c
 delete mode 100644 lib/tdb2/tdb1_traverse.c
 delete mode 100644 lib/tdb2/tdb2.h
 delete mode 100644 lib/tdb2/test/api-12-store.c
 delete mode 100644 lib/tdb2/test/api-13-delete.c
 delete mode 100644 lib/tdb2/test/api-14-exists.c
 delete mode 100644 lib/tdb2/test/api-16-wipe_all.c
 delete mode 100644 lib/tdb2/test/api-21-parse_record.c
 delete mode 100644 lib/tdb2/test/api-55-transaction.c
 delete mode 100644 lib/tdb2/test/api-80-tdb_fd.c
 delete mode 100644 lib/tdb2/test/api-81-seqnum.c
 delete mode 100644 lib/tdb2/test/api-82-lockattr.c
 delete mode 100644 lib/tdb2/test/api-83-openhook.c
 delete mode 100644 lib/tdb2/test/api-91-get-stats.c
 delete mode 100644 lib/tdb2/test/api-92-get-set-readonly.c
 delete mode 100644 lib/tdb2/test/api-93-repack.c
 delete mode 100644 lib/tdb2/test/api-add-remove-flags.c
 delete mode 100644 lib/tdb2/test/api-check-callback.c
 delete mode 100644 lib/tdb2/test/api-firstkey-nextkey.c
 delete mode 100644 lib/tdb2/test/api-fork-test.c
 delete mode 100644 lib/tdb2/test/api-locktimeout.c
 delete mode 100644 lib/tdb2/test/api-missing-entries.c
 delete mode 100644 lib/tdb2/test/api-open-multiple-times.c
 delete mode 100644 lib/tdb2/test/api-record-expand.c
 delete mode 100644 lib/tdb2/test/api-simple-delete.c
 delete mode 100644 lib/tdb2/test/api-summary.c
 delete mode 100644 lib/tdb2/test/api-tdb1-flag-removal.c
 delete mode 100644 lib/tdb2/test/external-agent.c
 delete mode 100644 lib/tdb2/test/external-agent.h
 delete mode 100644 lib/tdb2/test/failtest_helper.c
 delete mode 100644 lib/tdb2/test/failtest_helper.h
 delete mode 100644 lib/tdb2/test/helpapi-external-agent.c
 delete mode 100644 lib/tdb2/test/helprun-external-agent.c
 delete mode 100644 lib/tdb2/test/helprun-layout.c
 delete mode 100644 lib/tdb2/test/jenkins-be-hash.tdb1
 delete mode 100644 lib/tdb2/test/jenkins-le-hash.tdb1
 delete mode 100644 lib/tdb2/test/layout.h
 delete mode 100644 lib/tdb2/test/lock-tracking.c
 delete mode 100644 lib/tdb2/test/logging.c
 delete mode 100644 lib/tdb2/test/logging.h
 delete mode 100644 lib/tdb2/test/old-nohash-be.tdb1
 delete mode 100644 lib/tdb2/test/old-nohash-le.tdb1
 delete mode 100644 lib/tdb2/test/run-001-encode.c
 delete mode 100644 lib/tdb2/test/run-001-fls.c
 delete mode 100644 lib/tdb2/test/run-01-new_database.c
 delete mode 100644 lib/tdb2/test/run-02-expand.c
 delete mode 100644 lib/tdb2/test/run-03-coalesce.c
 delete mode 100644 lib/tdb2/test/run-04-basichash.c
 delete mode 100644 lib/tdb2/test/run-05-readonly-open.c
 delete mode 100644 lib/tdb2/test/run-10-simple-store.c
 delete mode 100644 lib/tdb2/test/run-11-simple-fetch.c
 delete mode 100644 lib/tdb2/test/run-12-check.c
 delete mode 100644 lib/tdb2/test/run-15-append.c
 delete mode 100644 lib/tdb2/test/run-20-growhash.c
 delete mode 100644 lib/tdb2/test/run-25-hashoverload.c
 delete mode 100644 lib/tdb2/test/run-30-exhaust-before-expand.c
 delete mode 100644 lib/tdb2/test/run-35-convert.c
 delete mode 100644 lib/tdb2/test/run-50-multiple-freelists.c
 delete mode 100644 lib/tdb2/test/run-56-open-during-transaction.c
 delete mode 100644 lib/tdb2/test/run-57-die-during-transaction.c
 delete mode 100644 lib/tdb2/test/run-64-bit-tdb.c
 delete mode 100644 lib/tdb2/test/run-90-get-set-attributes.c
 delete mode 100644 lib/tdb2/test/run-capabilities.c
 delete mode 100644 lib/tdb2/test/run-expand-in-transaction.c
 delete mode 100644 lib/tdb2/test/run-features.c
 delete mode 100644 lib/tdb2/test/run-lockall.c
 delete mode 100644 lib/tdb2/test/run-remap-in-read_traverse.c
 delete mode 100644 lib/tdb2/test/run-seed.c
 delete mode 100644 lib/tdb2/test/run-tdb1-3G-file.c
 delete mode 100644 lib/tdb2/test/run-tdb1-bad-tdb-header.c
 delete mode 100644 lib/tdb2/test/run-tdb1-check.c
 delete mode 100644 lib/tdb2/test/run-tdb1-corrupt.c
 delete mode 100644 lib/tdb2/test/run-tdb1-endian.c
 delete mode 100644 lib/tdb2/test/run-tdb1-hashsize.c
 delete mode 100644 lib/tdb2/test/run-tdb1-incompatible.c
 delete mode 100644 lib/tdb2/test/run-tdb1-nested-transactions.c
 delete mode 100644 lib/tdb2/test/run-tdb1-nested-traverse.c
 delete mode 100644 lib/tdb2/test/run-tdb1-no-lock-during-traverse.c
 delete mode 100644 lib/tdb2/test/run-tdb1-oldhash.c
 delete mode 100644 lib/tdb2/test/run-tdb1-readonly-check.c
 delete mode 100644 lib/tdb2/test/run-tdb1-rwlock-check.c
 delete mode 100644 lib/tdb2/test/run-tdb1-seqnum-wrap.c
 delete mode 100644 lib/tdb2/test/run-tdb1-summary.c
 delete mode 100644 lib/tdb2/test/run-tdb1-traverse-in-transaction.c
 delete mode 100644 lib/tdb2/test/run-tdb1-wronghash-fail.c
 delete mode 100644 lib/tdb2/test/run-tdb1-zero-append.c
 delete mode 100644 lib/tdb2/test/run-tdb1.c
 delete mode 100644 lib/tdb2/test/run-tdb_errorstr.c
 delete mode 100644 lib/tdb2/test/run-tdb_foreach.c
 delete mode 100644 lib/tdb2/test/run-traverse.c
 delete mode 100644 lib/tdb2/test/rwlock-be.tdb1
 delete mode 100644 lib/tdb2/test/rwlock-le.tdb1
 delete mode 100644 lib/tdb2/test/tap-interface.h
 delete mode 100644 lib/tdb2/test/tdb1-external-agent.c
 delete mode 100644 lib/tdb2/test/tdb1-external-agent.h
 delete mode 100644 lib/tdb2/test/tdb1-lock-tracking.c
 delete mode 100644 lib/tdb2/test/tdb1-lock-tracking.h
 delete mode 100644 lib/tdb2/test/tdb1.corrupt
 delete mode 100644 lib/tdb2/test/tdb2-source.h
 delete mode 100644 lib/tdb2/tools/Makefile
 delete mode 100644 lib/tdb2/tools/growtdb-bench.c
 delete mode 100644 lib/tdb2/tools/mktdb2.c
 delete mode 100644 lib/tdb2/tools/speed.c
 delete mode 100644 lib/tdb2/tools/tdb2backup.c
 delete mode 100644 lib/tdb2/tools/tdb2dump.c
 delete mode 100644 lib/tdb2/tools/tdb2restore.c
 delete mode 100644 lib/tdb2/tools/tdb2tool.c
 delete mode 100644 lib/tdb2/tools/tdb2torture.c
 delete mode 100644 lib/tdb2/transaction.c
 delete mode 100644 lib/tdb2/traverse.c
 delete mode 100644 lib/tdb2/wscript


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
index b6a9f1b..476d8fc 100644
--- a/buildtools/wafsamba/samba3.py
+++ b/buildtools/wafsamba/samba3.py
@@ -61,18 +61,11 @@ def s3_fix_kwargs(bld, kwargs):
                             '../source4/heimdal_build',
                             '../bin/default/source4/heimdal/lib/asn1' ]
 
-    if bld.CONFIG_SET('BUILD_TDB2'):
-        if bld.CONFIG_SET('USING_SYSTEM_TDB2'):
-            (tdb2_includes, tdb2_ldflags, tdb2_cpppath) = library_flags(bld, 'tdb')
-            extra_includes += tdb2_cpppath
-        else:
-            extra_includes += [ '../lib/tdb2' ]
+    if bld.CONFIG_SET('USING_SYSTEM_TDB'):
+        (tdb_includes, tdb_ldflags, tdb_cpppath) = library_flags(bld, 'tdb')
+        extra_includes += tdb_cpppath
     else:
-        if bld.CONFIG_SET('USING_SYSTEM_TDB'):
-            (tdb_includes, tdb_ldflags, tdb_cpppath) = library_flags(bld, 'tdb')
-            extra_includes += tdb_cpppath
-        else:
-            extra_includes += [ '../lib/tdb/include' ]
+        extra_includes += [ '../lib/tdb/include' ]
 
     if bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
         (tevent_includes, tevent_ldflags, tevent_cpppath) = library_flags(bld, 'tevent')
diff --git a/lib/ccan/failtest/failtest.c b/lib/ccan/failtest/failtest.c
index ce92758..71fcff3 100644
--- a/lib/ccan/failtest/failtest.c
+++ b/lib/ccan/failtest/failtest.c
@@ -200,7 +200,6 @@ static int move_fd_to_high(int fd)
 
 	if (getrlimit(RLIMIT_NOFILE, &lim) == 0) {
 		max = lim.rlim_cur;
-		printf("Max is %i\n", max);
 	} else
 		max = FD_SETSIZE;
 
diff --git a/lib/ccan/libccan.m4 b/lib/ccan/libccan.m4
index 3b71d7b..0d391ad 100644
--- a/lib/ccan/libccan.m4
+++ b/lib/ccan/libccan.m4
@@ -21,6 +21,8 @@ AC_SUBST(CCAN_CFLAGS)
 # All the configuration checks.  Regrettably, the __attribute__ checks will
 # give false positives on old GCCs, since they just cause warnings.  But that's
 # fairly harmless.
+AC_CHECK_HEADERS(err.h)
+
 AC_CACHE_CHECK([whether we can compile with __attribute__((cold))],
 	       samba_cv_attribute_cold,
 	       [
diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index 8d5782a..c1dae41 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -4,6 +4,7 @@ import Logs, sys, Options
 
 def configure(conf):
     conf.DEFINE('HAVE_CCAN', 1)
+    conf.CHECK_HEADERS('err.h')
     # FIXME: if they don't have -Werror, these will all fail.  But they
     # probably will anyway...
     conf.CHECK_CODE('int __attribute__((cold)) func(int x) { return x; }',
diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h
index 41bcf35..db2cfa1 100644
--- a/lib/dbwrap/dbwrap.h
+++ b/lib/dbwrap/dbwrap.h
@@ -20,7 +20,7 @@
 #ifndef __DBWRAP_H__
 #define __DBWRAP_H__
 
-#include "tdb_compat.h"
+#include "tdb.h"
 
 struct db_record;
 struct db_context;
diff --git a/lib/ldb-samba/ldb_wrap.c b/lib/ldb-samba/ldb_wrap.c
index b8af8c1..83a0674 100644
--- a/lib/ldb-samba/ldb_wrap.c
+++ b/lib/ldb-samba/ldb_wrap.c
@@ -35,7 +35,7 @@
 #include "dsdb/samdb/samdb.h"
 #include "param/param.h"
 #include "../lib/util/dlinklist.h"
-#include "../lib/tdb_compat/tdb_compat.h"
+#include <tdb.h>
 
 /*
   this is used to catch debug messages from ldb
@@ -320,7 +320,8 @@ int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx,
 
 /*
   when we fork() we need to make sure that any open ldb contexts have
-  any open transactions cancelled
+  any open transactions cancelled (ntdb databases doesn't need reopening,
+  as we don't use clear_if_first).
  */
  void ldb_wrap_fork_hook(void)
 {
diff --git a/lib/ldb-samba/wscript_build b/lib/ldb-samba/wscript_build
index 85eb66c..b0d2dca 100644
--- a/lib/ldb-samba/wscript_build
+++ b/lib/ldb-samba/wscript_build
@@ -8,7 +8,7 @@ bld.SAMBA_LIBRARY('ldbsamba',
                   source='ldif_handlers.c',
                   autoproto='ldif_handlers_proto.h',
                   public_deps='ldb',
-                  deps='security ndr NDR_DRSBLOBS NDR_DNSP ldbwrap samdb-common SAMDB_SCHEMA tdb_compat pyldb-util errors',
+                  deps='security ndr NDR_DRSBLOBS NDR_DNSP ldbwrap samdb-common SAMDB_SCHEMA tdb pyldb-util errors',
                   private_library=True
                   )
 
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
index a3848ed..d2ef4b8 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -155,7 +155,7 @@ static int ltdb_dn_list_load(struct ldb_module *module,
 	key.dptr = discard_const_p(unsigned char, ldb_dn_get_linearized(dn));
 	key.dsize = strlen((char *)key.dptr);
 
-	rec = tdb_fetch_compat(ltdb->idxptr->itdb, key);
+	rec = tdb_fetch(ltdb->idxptr->itdb, key);
 	if (rec.dptr == NULL) {
 		goto normal_index;
 	}
@@ -261,7 +261,7 @@ static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
 	}
 
 	if (ltdb->idxptr->itdb == NULL) {
-		ltdb->idxptr->itdb = tdb_open_compat(NULL, 1000, TDB_INTERNAL, O_RDWR, 0, NULL, NULL);
+		ltdb->idxptr->itdb = tdb_open(NULL, 1000, TDB_INTERNAL, O_RDWR, 0);
 		if (ltdb->idxptr->itdb == NULL) {
 			return LDB_ERR_OPERATIONS_ERROR;
 		}
@@ -270,7 +270,7 @@ static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
 	key.dptr = discard_const_p(unsigned char, ldb_dn_get_linearized(dn));
 	key.dsize = strlen((char *)key.dptr);
 
-	rec = tdb_fetch_compat(ltdb->idxptr->itdb, key);
+	rec = tdb_fetch(ltdb->idxptr->itdb, key);
 	if (rec.dptr != NULL) {
 		list2 = ltdb_index_idxptr(module, rec, false);
 		if (list2 == NULL) {
diff --git a/lib/ldb/ldb_tdb/ldb_search.c b/lib/ldb/ldb_tdb/ldb_search.c
index 46e2d74..5e20500 100644
--- a/lib/ldb/ldb_tdb/ldb_search.c
+++ b/lib/ldb/ldb_tdb/ldb_search.c
@@ -32,7 +32,7 @@
  */
 
 #include "ldb_tdb.h"
-#include <lib/tdb_compat/tdb_compat.h>
+#include <tdb.h>
 
 /*
   add one element to a message
@@ -224,7 +224,7 @@ static int ltdb_search_base(struct ldb_module *module, struct ldb_dn *dn)
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
-	tdb_data = tdb_fetch_compat(ltdb->tdb, tdb_key);
+	tdb_data = tdb_fetch(ltdb->tdb, tdb_key);
 	talloc_free(tdb_key.dptr);
 	if (!tdb_data.dptr) {
 		return LDB_ERR_NO_SUCH_OBJECT;
@@ -256,7 +256,7 @@ int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_mes
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
-	tdb_data = tdb_fetch_compat(ltdb->tdb, tdb_key);
+	tdb_data = tdb_fetch(ltdb->tdb, tdb_key);
 	talloc_free(tdb_key.dptr);
 	if (!tdb_data.dptr) {
 		return LDB_ERR_NO_SUCH_OBJECT;
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
index 5324c9b..14ffcf4 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -50,7 +50,7 @@
  */
 
 #include "ldb_tdb.h"
-#include <lib/tdb_compat/tdb_compat.h>
+#include <tdb.h>
 
 /*
   prevent memory errors on callbacks
@@ -74,13 +74,9 @@ int ltdb_err_map(enum TDB_ERROR tdb_code)
 	case TDB_ERR_IO:
 		return LDB_ERR_PROTOCOL_ERROR;
 	case TDB_ERR_LOCK:
-#ifndef BUILD_TDB2
 	case TDB_ERR_NOLOCK:
-#endif
 		return LDB_ERR_BUSY;
-#ifndef BUILD_TDB2
 	case TDB_ERR_LOCK_TIMEOUT:
-#endif
 		return LDB_ERR_TIME_LIMIT_EXCEEDED;
 	case TDB_ERR_EXISTS:
 		return LDB_ERR_ENTRY_ALREADY_EXISTS;
@@ -668,7 +664,7 @@ int ltdb_modify_internal(struct ldb_module *module,
 		return LDB_ERR_OTHER;
 	}
 
-	tdb_data = tdb_fetch_compat(ltdb->tdb, tdb_key);
+	tdb_data = tdb_fetch(ltdb->tdb, tdb_key);
 	if (!tdb_data.dptr) {
 		talloc_free(tdb_key.dptr);
 		return ltdb_err_map(tdb_error(ltdb->tdb));
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.h b/lib/ldb/ldb_tdb/ldb_tdb.h
index 3b87b56..c89dd7f 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -1,7 +1,7 @@
 #include "replace.h"
 #include "system/filesys.h"
 #include "system/time.h"
-#include "tdb_compat.h"
+#include "tdb.h"
 #include "ldb_module.h"
 
 /* this private structure is used by the ltdb backend in the
diff --git a/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
index 3ddcba5..eb16809 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
@@ -24,32 +24,6 @@
 #include "ldb_tdb.h"
 #include "dlinklist.h"
 
-/* FIXME: TDB2 does this internally, so no need to wrap multiple opens! */
-#if BUILD_TDB2
-static void ltdb_log_fn(struct tdb_context *tdb,
-			enum tdb_log_level level,
-			enum TDB_ERROR ecode,
-			const char *message,
-			struct ldb_context *ldb)
-{
-	enum ldb_debug_level ldb_level;
-	const char *name = tdb_name(tdb);
-
-	switch (level) {
-	case TDB_LOG_WARNING:
-		ldb_level = LDB_DEBUG_WARNING;
-	case TDB_LOG_USE_ERROR:
-	case TDB_LOG_ERROR:
-		ldb_level = LDB_DEBUG_FATAL;
-		break;
-	default:
-		ldb_level = LDB_DEBUG_FATAL;
-	}
-
-	ldb_debug(ldb, ldb_level, "ltdb: tdb(%s): %s: %s", name,
-		  tdb_errorstr(ecode), message);
-}
-#else /* !TDB2 */
 static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
 static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...)
 {
@@ -86,7 +60,6 @@ static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, con
 	ldb_debug(ldb, ldb_level, "ltdb: tdb(%s): %s", name, message);
 	talloc_free(message);
 }
-#endif
 
 /*
   the purpose of this code is to work around the braindead posix locking
@@ -126,6 +99,7 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
 				   struct ldb_context *ldb)
 {
 	struct ltdb_wrap *w;
+	struct tdb_logging_context lctx;
 	struct stat st;
 
 	if (stat(path, &st) == 0) {
@@ -144,7 +118,10 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 
-	w->tdb = tdb_open_compat(path, hash_size, tdb_flags, open_flags, mode, ltdb_log_fn, ldb);
+	lctx.log_fn = ltdb_log_fn;
+	lctx.log_private = ldb;
+	w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode,
+			     &lctx, NULL);
 	if (w->tdb == NULL) {
 		talloc_free(w);
 		return NULL;
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index f62bdec..94a9682 100755
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -16,24 +16,23 @@ sys.path.insert(0, srcdir + '/buildtools/wafsamba')
 import wafsamba, samba_dist, Options
 
 samba_dist.DIST_DIRS('''lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
-                        lib/tdb:lib/tdb lib/tdb2:lib/tdb2 lib/tdb_compat:lib/tdb_compat lib/ccan:lib/ccan lib/tevent:lib/tevent lib/popt:lib/popt
+                        lib/tdb:lib/tdb lib/tdb2:lib/tdb2 lib/tdb:lib/tdb lib/ccan:lib/ccan lib/tevent:lib/tevent lib/popt:lib/popt
                         buildtools:buildtools''')
 
 
 def set_options(opt):
     opt.BUILTIN_DEFAULT('replace')
     opt.PRIVATE_EXTENSION_DEFAULT('ldb', noextension='ldb')
-    opt.RECURSE('lib/tdb_compat')
+    opt.RECURSE('lib/tdb')
     opt.RECURSE('lib/tevent')
     opt.RECURSE('lib/replace')
     opt.tool_options('python') # options for disabling pyc or pyo compilation
 
 def configure(conf):
-    conf.RECURSE('lib/tdb_compat')
+    conf.RECURSE('lib/tdb')
     conf.RECURSE('lib/tevent')
     conf.RECURSE('lib/popt')
     conf.RECURSE('lib/replace')
-    conf.RECURSE('lib/tdb_compat')
     conf.find_program('python', var='PYTHON')
     conf.find_program('xsltproc', var='XSLTPROC')
     conf.check_tool('python')
@@ -78,11 +77,10 @@ def configure(conf):
     conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
 
 def build(bld):
-    bld.RECURSE('lib/tdb_compat')
     bld.RECURSE('lib/tevent')
     bld.RECURSE('lib/popt')
     bld.RECURSE('lib/replace')
-    bld.RECURSE('lib/tdb_compat')
+    bld.RECURSE('lib/tdb')
 
     if bld.env.standalone_ldb:
         private_library = False
@@ -238,14 +236,14 @@ def build(bld):
                          init_function='ldb_tdb_init',
                          module_init_name='ldb_init_module',
                          internal_module=False,
-                         deps='tdb_compat ldb',
+                         deps='tdb ldb',
                          subsystem='ldb')
 
         # have a separate subsystem for common/ldb.c, so it can rebuild
         # for install with a different -DLDB_MODULESDIR=
         bld.SAMBA_SUBSYSTEM('LIBLDB_MAIN',
                             'common/ldb.c',
-                            deps='tevent tdb_compat',
+                            deps='tevent tdb',
                             includes='include',
                             cflags=['-DLDB_MODULESDIR=\"%s\"' % modules_dir])
 
diff --git a/lib/ntdb/ABI/ntdb-0.9.sigs b/lib/ntdb/ABI/ntdb-0.9.sigs
new file mode 100644
index 0000000..6b12ddb
--- /dev/null
+++ b/lib/ntdb/ABI/ntdb-0.9.sigs
@@ -0,0 +1,38 @@
+ntdb_add_flag: void (struct ntdb_context *, unsigned int)
+ntdb_append: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA, NTDB_DATA)
+ntdb_chainlock: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA)
+ntdb_chainlock_read: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA)
+ntdb_chainunlock: void (struct ntdb_context *, NTDB_DATA)
+ntdb_chainunlock_read: void (struct ntdb_context *, NTDB_DATA)
+ntdb_check_: enum NTDB_ERROR (struct ntdb_context *, enum NTDB_ERROR (*)(NTDB_DATA, NTDB_DATA, void *), void *)
+ntdb_close: int (struct ntdb_context *)
+ntdb_delete: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA)
+ntdb_errorstr: const char *(enum NTDB_ERROR)
+ntdb_exists: bool (struct ntdb_context *, NTDB_DATA)
+ntdb_fd: int (const struct ntdb_context *)
+ntdb_fetch: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA, NTDB_DATA *)
+ntdb_firstkey: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA *)
+ntdb_foreach_: void (int (*)(struct ntdb_context *, void *), void *)
+ntdb_get_attribute: enum NTDB_ERROR (struct ntdb_context *, union ntdb_attribute *)
+ntdb_get_flags: unsigned int (struct ntdb_context *)
+ntdb_get_seqnum: int64_t (struct ntdb_context *)
+ntdb_lockall: enum NTDB_ERROR (struct ntdb_context *)
+ntdb_lockall_read: enum NTDB_ERROR (struct ntdb_context *)
+ntdb_name: const char *(const struct ntdb_context *)
+ntdb_nextkey: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA *)
+ntdb_open: struct ntdb_context *(const char *, int, int, mode_t, union ntdb_attribute *)
+ntdb_parse_record_: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA, enum NTDB_ERROR (*)(NTDB_DATA, NTDB_DATA, void *), void *)
+ntdb_remove_flag: void (struct ntdb_context *, unsigned int)
+ntdb_repack: enum NTDB_ERROR (struct ntdb_context *)
+ntdb_set_attribute: enum NTDB_ERROR (struct ntdb_context *, const union ntdb_attribute *)
+ntdb_store: enum NTDB_ERROR (struct ntdb_context *, NTDB_DATA, NTDB_DATA, int)
+ntdb_summary: enum NTDB_ERROR (struct ntdb_context *, enum ntdb_summary_flags, char **)
+ntdb_transaction_cancel: void (struct ntdb_context *)
+ntdb_transaction_commit: enum NTDB_ERROR (struct ntdb_context *)
+ntdb_transaction_prepare_commit: enum NTDB_ERROR (struct ntdb_context *)
+ntdb_transaction_start: enum NTDB_ERROR (struct ntdb_context *)
+ntdb_traverse_: int64_t (struct ntdb_context *, int (*)(struct ntdb_context *, NTDB_DATA, NTDB_DATA, void *), void *)
+ntdb_unlockall: void (struct ntdb_context *)
+ntdb_unlockall_read: void (struct ntdb_context *)
+ntdb_unset_attribute: void (struct ntdb_context *, enum ntdb_attribute_type)
+ntdb_wipe_all: enum NTDB_ERROR (struct ntdb_context *)
diff --git a/lib/tdb2/LICENSE b/lib/ntdb/LICENSE
similarity index 100%
rename from lib/tdb2/LICENSE
rename to lib/ntdb/LICENSE
diff --git a/lib/tdb2/Makefile b/lib/ntdb/Makefile
similarity index 100%
rename from lib/tdb2/Makefile
rename to lib/ntdb/Makefile
diff --git a/lib/ntdb/check.c b/lib/ntdb/check.c
new file mode 100644
index 0000000..2790c68
--- /dev/null
+++ b/lib/ntdb/check.c
@@ -0,0 +1,725 @@
+ /*
+   Trivial Database 2: free list/block handling
+   Copyright (C) Rusty Russell 2010
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#include "private.h"
+#include <ccan/likely/likely.h>
+#include <ccan/asearch/asearch.h>
+
+/* We keep an ordered array of offsets. */
+static bool append(struct ntdb_context *ntdb,
+		   ntdb_off_t **arr, size_t *num, ntdb_off_t off)
+{
+	ntdb_off_t *new;
+
+	if (*num == 0) {
+		new = ntdb->alloc_fn(ntdb, sizeof(ntdb_off_t), ntdb->alloc_data);
+	} else {
+		new = ntdb->expand_fn(*arr, (*num + 1) * sizeof(ntdb_off_t),
+				  ntdb->alloc_data);
+	}
+	if (!new)
+		return false;
+	new[(*num)++] = off;
+	*arr = new;
+	return true;
+}
+
+static enum NTDB_ERROR check_header(struct ntdb_context *ntdb,
+				    ntdb_off_t *recovery,
+				    uint64_t *features,
+				    size_t *num_capabilities)
+{
+	uint64_t hash_test;
+	struct ntdb_header hdr;
+	enum NTDB_ERROR ecode;
+	ntdb_off_t off, next;
+
+	ecode = ntdb_read_convert(ntdb, 0, &hdr, sizeof(hdr));
+	if (ecode != NTDB_SUCCESS) {
+		return ecode;
+	}
+	/* magic food should not be converted, so convert back. */
+	ntdb_convert(ntdb, hdr.magic_food, sizeof(hdr.magic_food));
+
+	hash_test = NTDB_HASH_MAGIC;
+	hash_test = ntdb_hash(ntdb, &hash_test, sizeof(hash_test));
+	if (hdr.hash_test != hash_test) {
+		return ntdb_logerr(ntdb, NTDB_ERR_CORRUPT, NTDB_LOG_ERROR,
+				  "check: hash test %llu should be %llu",
+				  (long long)hdr.hash_test,
+				  (long long)hash_test);
+	}
+
+	if (strcmp(hdr.magic_food, NTDB_MAGIC_FOOD) != 0) {
+		return ntdb_logerr(ntdb, NTDB_ERR_CORRUPT, NTDB_LOG_ERROR,
+				  "check: bad magic '%.*s'",
+				  (unsigned)sizeof(hdr.magic_food),
+				  hdr.magic_food);
+	}
+
+	/* Features which are used must be a subset of features offered. */
+	if (hdr.features_used & ~hdr.features_offered) {
+		return ntdb_logerr(ntdb, NTDB_ERR_CORRUPT, NTDB_LOG_ERROR,
+				  "check: features used (0x%llx) which"
+				  " are not offered (0x%llx)",
+				  (long long)hdr.features_used,
+				  (long long)hdr.features_offered);
+	}
+
+	*features = hdr.features_offered;
+	*recovery = hdr.recovery;
+	if (*recovery) {
+		if (*recovery < sizeof(hdr)
+		    || *recovery > ntdb->file->map_size) {
+			return ntdb_logerr(ntdb, NTDB_ERR_CORRUPT, NTDB_LOG_ERROR,
+					  "ntdb_check:"
+					  " invalid recovery offset %zu",
+					  (size_t)*recovery);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list