summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-18 22:30:04 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-19 05:38:05 +0200
commit6244f668a34279e6da62213333dfb32c3ccdb17d (patch)
tree0dd495f4d03e57e8a5710d2edea84c137d4b4aee /source3
parent5bad913938daca4ae3020653690701db83826954 (diff)
downloadsamba-6244f668a34279e6da62213333dfb32c3ccdb17d.tar.gz
samba-6244f668a34279e6da62213333dfb32c3ccdb17d.tar.bz2
samba-6244f668a34279e6da62213333dfb32c3ccdb17d.zip
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>
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile-smbtorture42
-rw-r--r--source3/lib/gencache.c5
-rw-r--r--source3/lib/tdb_validate.c4
-rw-r--r--source3/lib/util_tdb.c106
-rw-r--r--source3/smbd/mangle_hash.c5
-rw-r--r--source3/smbd/proto.h5
-rw-r--r--source3/winbindd/idmap_tdb.c4
7 files changed, 1 insertions, 130 deletions
diff --git a/source3/Makefile-smbtorture4 b/source3/Makefile-smbtorture4
index 1b0c921025..faf9719cc4 100644
--- a/source3/Makefile-smbtorture4
+++ b/source3/Makefile-smbtorture4
@@ -6,7 +6,7 @@ SAMBA4_BINARIES="smbtorture,ndrdump"
samba4-configure:
@(cd .. && \
CFLAGS='' $(WAF) reconfigure || \
- CFLAGS='' $(WAF) configure --enable-socket-wrapper --enable-nss-wrapper --enable-uid-wrapper --nonshared-binary=$(SAMBA4_BINARIES) --enable-auto-reconfigure --enable-debug --disable-tdb2)
+ CFLAGS='' $(WAF) configure --enable-socket-wrapper --enable-nss-wrapper --enable-uid-wrapper --nonshared-binary=$(SAMBA4_BINARIES) --enable-auto-reconfigure --enable-debug)
.PHONY: samba4-configure
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 31ead7be7e..95b4811acd 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -462,12 +462,7 @@ bool gencache_stabilize(void)
res = tdb_transaction_start_nonblock(cache);
if (res != 0) {
-
-#if BUILD_TDB2
- if (res == TDB_ERR_LOCK)
-#else
if (tdb_error(cache) == TDB_ERR_NOLOCK)
-#endif
{
/*
* Someone else already does the stabilize,
diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c
index e4f752023d..2592402afd 100644
--- a/source3/lib/tdb_validate.c
+++ b/source3/lib/tdb_validate.c
@@ -57,7 +57,6 @@ static int tdb_validate_child(struct tdb_context *tdb,
goto out;
}
-#ifndef BUILD_TDB2
/* Check if the tdb's freelist is good. */
if (tdb_validate_freelist(tdb, &num_entries) == -1) {
v_status.bad_freelist = True;
@@ -67,7 +66,6 @@ static int tdb_validate_child(struct tdb_context *tdb,
DEBUG(10,("tdb_validate_child: tdb %s freelist has %d entries\n",
tdb_name(tdb), num_entries));
-#endif
/* Now traverse the tdb to validate it. */
num_entries = tdb_traverse(tdb, validate_fn, (void *)&v_status);
@@ -292,11 +290,9 @@ static int tdb_backup(TALLOC_CTX *ctx, const char *src_path,
unlink(tmp_path);
-#ifndef BUILD_TDB2
if (!hash_size) {
hash_size = tdb_hash_size(src_tdb);
}
-#endif
dst_tdb = tdb_open_log(tmp_path, hash_size,
TDB_DEFAULT, O_RDWR | O_CREAT | O_EXCL,
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index e9965ed838..552a914eb4 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -28,101 +28,6 @@
#undef calloc
#undef strdup
-#ifdef BUILD_TDB2
-static struct flock flock_struct;
-
-/* Return a value which is none of v1, v2 or v3. */
-static inline short int invalid_value(short int v1, short int v2, short int v3)
-{
- short int try = (v1+v2+v3)^((v1+v2+v3) << 16);
- while (try == v1 || try == v2 || try == v3)
- try++;
- return try;
-}
-
-/* We invalidate in as many ways as we can, so the OS rejects it */
-static void invalidate_flock_struct(int signum)
-{
- flock_struct.l_type = invalid_value(F_RDLCK, F_WRLCK, F_UNLCK);
- flock_struct.l_whence = invalid_value(SEEK_SET, SEEK_CUR, SEEK_END);
- flock_struct.l_start = -1;
- /* A large negative. */
- flock_struct.l_len = (((off_t)1 << (sizeof(off_t)*CHAR_BIT - 1)) + 1);
-}
-
-static int timeout_lock(int fd, int rw, off_t off, off_t len, bool waitflag,
- void *_timeout)
-{
- int ret, saved_errno;
- unsigned int timeout = *(unsigned int *)_timeout;
-
- flock_struct.l_type = rw;
- flock_struct.l_whence = SEEK_SET;
- flock_struct.l_start = off;
- flock_struct.l_len = len;
-
- CatchSignal(SIGALRM, invalidate_flock_struct);
- alarm(timeout);
-
- for (;;) {
- if (waitflag)
- ret = fcntl(fd, F_SETLKW, &flock_struct);
- else
- ret = fcntl(fd, F_SETLK, &flock_struct);
-
- if (ret == 0)
- break;
-
- /* Not signalled? Something else went wrong. */
- if (flock_struct.l_len == len) {
- if (errno == EAGAIN || errno == EINTR)
- continue;
- saved_errno = errno;
- break;
- } else {
- saved_errno = EINTR;
- break;
- }
- }
-
- alarm(0);
- errno = saved_errno;
- return ret;
-}
-
-static int tdb_chainlock_with_timeout_internal(struct tdb_context *tdb,
- TDB_DATA key,
- unsigned int timeout,
- int rw_type)
-{
- union tdb_attribute locking;
- enum TDB_ERROR ecode;
-
- if (timeout) {
- locking.base.attr = TDB_ATTRIBUTE_FLOCK;
- ecode = tdb_get_attribute(tdb, &locking);
- if (ecode != TDB_SUCCESS)
- return -1;
-
- /* Replace locking function with our own. */
- locking.flock.data = &timeout;
- locking.flock.lock = timeout_lock;
-
- ecode = tdb_set_attribute(tdb, &locking);
- if (ecode != TDB_SUCCESS)
- return -1;
- }
- if (rw_type == F_RDLCK)
- ecode = tdb_chainlock_read(tdb, key);
- else
- ecode = tdb_chainlock(tdb, key);
-
- if (timeout) {
- tdb_unset_attribute(tdb, TDB_ATTRIBUTE_FLOCK);
- }
- return ecode == TDB_SUCCESS ? 0 : -1;
-}
-#else
/* these are little tdb utility functions that are meant to make
dealing with a tdb database a little less cumbersome in Samba */
@@ -175,7 +80,6 @@ static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key,
return ret == 0 ? 0 : -1;
}
-#endif /* TDB1 */
/****************************************************************************
Write lock a chain. Return non-zero if timeout or lock failed.
@@ -470,15 +374,6 @@ int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...)
Log tdb messages via DEBUG().
****************************************************************************/
-#ifdef BUILD_TDB2
-static void tdb_log(TDB_CONTEXT *tdb, enum tdb_log_level level,
- enum TDB_ERROR ecode, const char *message, void *unused)
-{
- DEBUG((int)level, ("tdb(%s):%s: %s",
- tdb_name(tdb) ? tdb_name(tdb) : "unnamed",
- tdb_errorstr(ecode), message));
-}
-#else
static void tdb_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, const char *format, ...)
{
va_list ap;
@@ -495,7 +390,6 @@ static void tdb_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, const char *fo
DEBUG((int)level, ("tdb(%s): %s", tdb_name(tdb) ? tdb_name(tdb) : "unnamed", ptr));
SAFE_FREE(ptr);
}
-#endif /* TDB1 */
/****************************************************************************
Like tdb_open() but also setup a logging function that redirects to
diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c
index 0238083e38..8b1b6bf915 100644
--- a/source3/smbd/mangle_hash.c
+++ b/source3/smbd/mangle_hash.c
@@ -764,13 +764,8 @@ const struct mangle_fns *mangle_hash_init(void)
mangle_reset();
/* Create the in-memory tdb using our custom hash function. */
-#ifndef BUILD_TDB2
tdb_mangled_cache = tdb_open_ex("mangled_cache", 1031, TDB_INTERNAL,
(O_RDWR|O_CREAT), 0644, NULL, fast_string_hash);
-#else
- /* FIXME: We should *never* open a tdb without logging! */
- tdb_mangled_cache = tdb_open("mangled_cache", TDB_INTERNAL, 0, 0, NULL);
-#endif
return &mangle_hash_fns;
}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 4d035179c5..8196e69634 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1047,13 +1047,8 @@ void smbd_send_stat_cache_delete_message(struct messaging_context *msg_ctx,
void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
const char *name);
void stat_cache_delete(const char *name);
-#if BUILD_TDB2
-struct tdb_data;
-unsigned int fast_string_hash(struct tdb_data *key);
-#else
struct TDB_DATA;
unsigned int fast_string_hash(struct TDB_DATA *key);
-#endif
bool reset_stat_cache( void );
/* The following definitions come from smbd/statvfs.c */
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c
index 365d78cafc..d3e1d2b64b 100644
--- a/source3/winbindd/idmap_tdb.c
+++ b/source3/winbindd/idmap_tdb.c
@@ -150,7 +150,6 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db)
struct convert_fn_state s;
NTSTATUS status;
-#if BUILD_TDB2
/* If we are bigendian, tdb is bigendian if NOT converted. */
union {
uint16 large;
@@ -163,9 +162,6 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db)
assert(u.small[0] == 0x02);
bigendianheader = (dbwrap_get_flags(db) & TDB_CONVERT);
}
-#else
- bigendianheader = (dbwrap_get_flags(db) & TDB_BIGENDIAN) ? True : False;
-#endif
DEBUG(0, ("Upgrading winbindd_idmap.tdb from an old version\n"));
status = dbwrap_fetch_int32_bystring(db, "IDMAP_VERSION", &vers);