svn commit: samba r18831 - in branches/SAMBA_4_0/source/lib/ldb:
common include ldb_tdb
tridge at samba.org
tridge at samba.org
Fri Sep 22 23:22:40 GMT 2006
Author: tridge
Date: 2006-09-22 23:22:39 +0000 (Fri, 22 Sep 2006)
New Revision: 18831
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18831
Log:
minor build changes for samba3. The logging changes will be removed
when the tdb api is updated
Modified:
branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c
branches/SAMBA_4_0/source/lib/ldb/include/dlinklist.h
branches/SAMBA_4_0/source/lib/ldb/include/includes.h
branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h
branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c 2006-09-22 23:21:36 UTC (rev 18830)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c 2006-09-22 23:22:39 UTC (rev 18831)
@@ -36,7 +36,7 @@
#include "includes.h"
#include "ldb/include/includes.h"
-#ifdef _SAMBA_BUILD_
+#if (_SAMBA_BUILD_ >= 4)
#include "build.h"
#include "dynconfig.h"
#endif
Modified: branches/SAMBA_4_0/source/lib/ldb/include/dlinklist.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/dlinklist.h 2006-09-22 23:21:36 UTC (rev 18830)
+++ branches/SAMBA_4_0/source/lib/ldb/include/dlinklist.h 2006-09-22 23:22:39 UTC (rev 18831)
@@ -37,6 +37,7 @@
} while (0)
/* remove an element from a list - element doesn't have to be in list. */
+#ifndef DLIST_REMOVE
#define DLIST_REMOVE(list, p) \
do { \
if ((p) == (list)) { \
@@ -48,6 +49,7 @@
} \
if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \
} while (0)
+#endif
/* promote an element to the top of the list */
#define DLIST_PROMOTE(list, p) \
Modified: branches/SAMBA_4_0/source/lib/ldb/include/includes.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/includes.h 2006-09-22 23:21:36 UTC (rev 18830)
+++ branches/SAMBA_4_0/source/lib/ldb/include/includes.h 2006-09-22 23:22:39 UTC (rev 18831)
@@ -4,11 +4,20 @@
a temporary includes file until I work on the ldb build system
*/
-#ifdef _SAMBA_BUILD_
+#if (_SAMBA_BUILD_ >= 4)
/* tell ldb we have the internal ldap code */
#define HAVE_ILDAP 1
#endif
+#if (_SAMBA_BUILD_ <= 3)
+/* allow forbidden string functions - should be replaced with _m functions */
+#undef strcasecmp
+#undef strncasecmp
+#define dyn_MODULESDIR dyn_LIBDIR
+#endif
+
+
+
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h 2006-09-22 23:21:36 UTC (rev 18830)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h 2006-09-22 23:22:39 UTC (rev 18831)
@@ -1,7 +1,12 @@
#ifdef _SAMBA_BUILD_
#include "system/filesys.h"
+#endif
+
+#if (_SAMBA_BUILD_ >= 4)
#include "lib/tdb/include/tdb.h"
+#elif defined(_SAMBA_BUILD_)
+#include "tdb/include/tdb.h"
#else
#include "tdb.h"
#endif
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb_wrap.c 2006-09-22 23:21:36 UTC (rev 18830)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb_wrap.c 2006-09-22 23:22:39 UTC (rev 18831)
@@ -58,6 +58,7 @@
return 0;
}
+#if (_SAMBA_BUILD_ >= 4)
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, ...)
{
@@ -90,8 +91,23 @@
ldb_debug(ldb, ldb_level, "ltdb: tdb(%s): %s", name, message);
talloc_free(message);
}
+#else
+static void ltdb_log_fn(struct tdb_context *tdb, int level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
+static void ltdb_log_fn(struct tdb_context *tdb, int level, const char *fmt, ...)
+{
+ /* until we merge the tdb debug changes into samba3, we don't know
+ how serious the error is, and we can't go via the ldb loggin code */
+ va_list ap;
+ const char *name = tdb_name(tdb);
+ char *message;
+ va_start(ap, fmt);
+ message = talloc_vasprintf(NULL, fmt, ap);
+ va_end(ap);
+ DEBUG(3, ("ltdb: tdb(%s): %s", name, message));
+ talloc_free(message);
+}
+#endif
-
/*
wrapped connection to a tdb database. The caller should _not_ free
this as it is not a talloc structure (as tdb does not use talloc
@@ -106,9 +122,14 @@
{
struct ltdb_wrap *w;
struct stat st;
+#if (_SAMBA_BUILD_ >= 4)
struct tdb_logging_context log_ctx;
+ struct tdb_logging_context log_ctx_p = &log_ctx;
log_ctx.log_fn = ltdb_log_fn;
log_ctx.log_private = ldb;
+#else
+ tdb_log_func log_ctx_p = ltdb_log_fn;
+#endif
if (stat(path, &st) == 0) {
for (w=tdb_list;w;w=w->next) {
@@ -124,7 +145,7 @@
return NULL;
}
- w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode, &log_ctx, NULL);
+ w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode, log_ctx_p, NULL);
if (w->tdb == NULL) {
talloc_free(w);
return NULL;
More information about the samba-cvs
mailing list