From 66e6ffd666f96ebd3be956a57f23f3436512b4c9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 26 Mar 2014 13:36:48 +0000 Subject: [PATCH] lib: Add interim tdb_wrap_open_ without lp_ctx Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- lib/tdb_wrap/tdb_wrap.c | 49 ++++++++++++++++++++++++++++--------------------- lib/tdb_wrap/tdb_wrap.h | 3 +++ 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/lib/tdb_wrap/tdb_wrap.c b/lib/tdb_wrap/tdb_wrap.c index 4b5b8f2b608..cf24b97e796 100644 --- a/lib/tdb_wrap/tdb_wrap.c +++ b/lib/tdb_wrap/tdb_wrap.c @@ -123,10 +123,9 @@ fail: wrapped connection to a tdb database to close just talloc_free() the tdb_wrap pointer */ -struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, - const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode, - struct loadparm_context *lp_ctx) +struct tdb_wrap *tdb_wrap_open_(TALLOC_CTX *mem_ctx, + const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode) { struct tdb_wrap *result; struct tdb_wrap_private *w; @@ -150,23 +149,6 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, } if (w == NULL) { - if (!lpcfg_use_mmap(lp_ctx)) { - tdb_flags |= TDB_NOMMAP; - } - - if ((hash_size == 0) && (name != NULL)) { - const char *base; - base = strrchr_m(name, '/'); - - if (base != NULL) { - base += 1; - } else { - base = name; - } - hash_size = lpcfg_parm_int(lp_ctx, NULL, - "tdb_hashsize", base, 0); - } - w = tdb_wrap_private_open(result, name, hash_size, tdb_flags, open_flags, mode); } else { @@ -194,3 +176,28 @@ fail: return NULL; } +struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, + const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode, + struct loadparm_context *lp_ctx) +{ + if (!lpcfg_use_mmap(lp_ctx)) { + tdb_flags |= TDB_NOMMAP; + } + + if ((hash_size == 0) && (name != NULL)) { + const char *base; + base = strrchr_m(name, '/'); + + if (base != NULL) { + base += 1; + } else { + base = name; + } + hash_size = lpcfg_parm_int(lp_ctx, NULL, + "tdb_hashsize", base, 0); + } + + return tdb_wrap_open_(mem_ctx, name, hash_size, tdb_flags, open_flags, + mode); +} diff --git a/lib/tdb_wrap/tdb_wrap.h b/lib/tdb_wrap/tdb_wrap.h index 3e1fb83734b..54d9a0a72e6 100644 --- a/lib/tdb_wrap/tdb_wrap.h +++ b/lib/tdb_wrap/tdb_wrap.h @@ -37,6 +37,9 @@ struct tdb_wrap { struct loadparm_context; +struct tdb_wrap *tdb_wrap_open_(TALLOC_CTX *mem_ctx, + const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode); struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode, -- 2.11.4.GIT