1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

17 Commits

Author SHA1 Message Date
Rusty Russell
f3862b9171 ccan: we're subsystems, not a library.
Don't expose a libccan.so; it would produce clashes if someone else
does the same thing.  Unfortunately, if we just change it from a
SAMBA_LIBRARY to a SAMBA_SUBSYSTEM, it doesn't create a static library
as we'd like, but links all the object files in.  This means we get
many duplicates (eg. everyone gets a copy of tally, even though only
ntdb wants it).

So, the solution is twofold:
1) Make the ccan modules separate.
2) Make the ccan modules SAMBA_SUBSYSTEMs not SAMBA_LIBRARYs so we don't
   build shared libraries which we can't share.
3) Make the places which uses ccan explicit.

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

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Fri Jun 29 06:22:44 CEST 2012 on sn-devel-104
2012-06-29 06:22:44 +02:00
Rusty Russell
6244f668a3 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@rustcorp.com.au>
2012-06-19 05:38:05 +02:00
Volker Lendecke
6235b761f6 tdb-compat: Add tdb_chainlock_nonblock 2012-04-17 10:20:59 +02:00
Andrew Bartlett
d271bf8dc2 lib/tdb_compat: Do not define BUILD_TDB2 if we are not building tdb2
The simple fact that this was defined at all, even to false, caused some
of the tdb2 build code to run.

Andrew Bartlett
2012-04-11 16:00:38 +02:00
Rusty Russell
dd1d57370d tdb_compat: only use hashsize attribute when O_CREAT
tdb2 complains if you specify a tdb1 hashsize, and you're not actually
trying to create a new database.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-01-30 10:06:55 +10:30
Rusty Russell
fb41dfb77f tdb_compat: add "TDB_COMPAT_USE_TDB2" environment variable
When BUILD_TDB2 is defined, add TDB_VERSION1 flag to all tdb_open()
calls, unless this flag is set.  This means we use the tdb1 on-disk
format unless the user specifically asks for tdb2.

We'd love to do this using loadparm, but we need to work with both
Samba 3 and Samba 4's loadparm, and they're not unified yet.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-21 12:58:59 +09:30
Rusty Russell
f08b323a88 tdb_compat: honour hashsize arg when using tdb2 with TDB_VERSION1 flag.
We use the TDB_ATTRIBUTE_TDB1_HASHSIZE to set the hash size.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-21 12:57:59 +09:30
Rusty Russell
10e6a32820 tdb_compat: handle TDB_VOLATILE flag.
This is only meaningful when using the TDB_VERSION1 flag: we set the
attribute to control the maximum number of dead records (to 5, which is
what TDB_VOLATILE did for tdb1).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-21 12:56:59 +09:30
Rusty Russell
36b455d952 tdb_compat: handle TDB_INCOMPATIBLE_HASH flag.
This is only meaningful when using the TDB_VERSION1 flag: it is done
by using a magic hash value (which will fall back to the default hash
if that works instead).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-21 12:55:59 +09:30
Rusty Russell
84a4289b52 tdb_compat: change offset of CLEAR_IF_FIRST lock.
This makes it match tdb1, which mean it will Just Work as TDB2 gets
tdb1 format support.

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

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Wed Sep 14 02:21:29 CEST 2011 on sn-devel-104
2011-09-14 02:21:29 +02:00
Rusty Russell
72c4074c65 tdb_compat: support tdb_reopen/tdb_reopen_all for TDB2
This matters with the clear-if-first support: we need to re-establish
those locks at this point.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 08:13:28 +09:30
Rusty Russell
73e4f35e3d tdb_compat: make tdb2s temporarily read-only for tdb_traverse_read()
It doesn't make a difference unless the tdb2 opens a TDB1 on disk, in
which case tdb1_traverse() takes a write lock on the entire file.  By
setting the tdb to read-only first, we simulate the old behaviour.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 07:17:13 +09:30
Rusty Russell
376511ed4d tdb_compat: adapt to tdb2 API change.
Add the ecode arg to all the log functions, and log it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 07:13:13 +09:30
Rusty Russell
580fedc321 tdb_compat: respect TDB_NO_FSYNC environment variable for tdb2.
I don't think this kind of hack belongs in the tdb2 source, but SAMBA uses
it to speed testing, so we should respect it: handle it in our compat
open wrapper.

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

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Mon Jun 20 12:32:08 CEST 2011 on sn-devel-104
2011-06-20 12:32:08 +02:00
Rusty Russell
985e83ef52 tdb2: tie it into build process if --enable-tdb2-breaks-compat
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>
2011-06-20 11:18:36 +02:00
Rusty Russell
0e4c358e27 tdb_compat.h: divert every tdb build and includes to tdb_compat
We change all the headers and wscript files to use tdb_compat; this
means we have one place to decide whether to use TDB1 or TDB2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:34 +02:00
Rusty Russell
61bf43f5d1 lib/tdb_compat: header for tdb1 vs tdb2.
TDB2's API is slightly different from TDB1.  In particular, all functions
return 0 (TDB_SUCCESS) or a negative error number, rather than -1 or tdb_null
and storing the error in tdb_error() (though TDB2 does that as well).

The simplest fix is to replace all the different functions with a wrapper,
and that is done here.

Compatibility functions:

tdb_null: not used as an error return, so not defined by tdb2.
tdb_fetch_compat: TDB1-style data-returning tdb_fetch.
tdb_firstkey_compat: TDB1-style data-returning tdb_firstkey
tdb_nextkey_compat: TDB1-style data-returning tdb_nextkey, with
	TDB2-style free of old key.
tdb_errorstr_compat: TDB1-style tdb_errorstr() which takes TDB instead of ecode.
TDB_CONTEXT: TDB1-style typedef for struct tdb_context.
tdb_open_compat: Simplified open routine which takes log function, sets
	TDB_ALLOW_NESTING as Samba expects, and adds TDB_CLEAR_IF_FIRST support.

Things defined away in TDB2 wrappers:

tdb_traverse_read: TDB2's tdb_traverse only uses read-locks anyway.
tdb_reopen/tdb_reopen_all: TDB2 detects this error itself.
TDB_INCOMPATIBLE_HASH: TDB2 uses the Jenkins hash already.
TDB_VOLATILE: TDB2 shouldn't have freelist scaling issues.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:34 +02:00