From d8c070a550736ccfa09c9babfd477d362a74decf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 9 Aug 2007 06:34:20 +0000 Subject: r24283: added a dbwrap API for temporary databases, based on the one from the s3 clustering code. This commit just establishes the API. The ctdb backend for this will come soon. (This used to be commit 3767e755db7b58aee4ff375896beb00b133cc413) --- source4/lib/dbwrap/dbwrap.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 source4/lib/dbwrap/dbwrap.c (limited to 'source4/lib/dbwrap/dbwrap.c') diff --git a/source4/lib/dbwrap/dbwrap.c b/source4/lib/dbwrap/dbwrap.c new file mode 100644 index 0000000000..e853967aa2 --- /dev/null +++ b/source4/lib/dbwrap/dbwrap.c @@ -0,0 +1,33 @@ +/* + Unix SMB/CIFS implementation. + + database wrapper code + + Copyright (C) Andrew Tridgell 2007 + Copyright (C) Volker Lendecke 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include "lib/tdb/include/tdb.h" +#include "lib/dbwrap/dbwrap.h" + +/* + open a temporary database + */ +struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags) +{ + return db_tmp_open_tdb(mem_ctx, name, tdb_flags); +} -- cgit From 09672f7e4ab15d20fe5702bef8d0550464e44cab Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 24 Aug 2007 02:38:51 +0000 Subject: r24645: add in the ctdb dbwrap backend (This used to be commit e2d173fde17ab903bddf2139d8100785280856bd) --- source4/lib/dbwrap/dbwrap.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/lib/dbwrap/dbwrap.c') diff --git a/source4/lib/dbwrap/dbwrap.c b/source4/lib/dbwrap/dbwrap.c index e853967aa2..c0bac672aa 100644 --- a/source4/lib/dbwrap/dbwrap.c +++ b/source4/lib/dbwrap/dbwrap.c @@ -29,5 +29,10 @@ */ struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags) { + if (lp_parm_bool(-1, "ctdb", "enable", False) && + lp_parm_bool(-1, "ctdb", name, True)) { + return db_tmp_open_ctdb(mem_ctx, name, tdb_flags); + } + return db_tmp_open_tdb(mem_ctx, name, tdb_flags); } -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/lib/dbwrap/dbwrap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/dbwrap/dbwrap.c') diff --git a/source4/lib/dbwrap/dbwrap.c b/source4/lib/dbwrap/dbwrap.c index c0bac672aa..02e82c77a7 100644 --- a/source4/lib/dbwrap/dbwrap.c +++ b/source4/lib/dbwrap/dbwrap.c @@ -23,6 +23,7 @@ #include "includes.h" #include "lib/tdb/include/tdb.h" #include "lib/dbwrap/dbwrap.h" +#include "param/param.h" /* open a temporary database -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/lib/dbwrap/dbwrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib/dbwrap/dbwrap.c') diff --git a/source4/lib/dbwrap/dbwrap.c b/source4/lib/dbwrap/dbwrap.c index 02e82c77a7..057a6f0057 100644 --- a/source4/lib/dbwrap/dbwrap.c +++ b/source4/lib/dbwrap/dbwrap.c @@ -30,8 +30,8 @@ */ struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags) { - if (lp_parm_bool(-1, "ctdb", "enable", False) && - lp_parm_bool(-1, "ctdb", name, True)) { + if (lp_parm_bool(NULL, "ctdb", "enable", false) && + lp_parm_bool(NULL, "ctdb", name, true)) { return db_tmp_open_ctdb(mem_ctx, name, tdb_flags); } -- cgit From 60a1046c5c5783799bd64fe18e03534670f83d82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Sep 2007 18:00:19 +0000 Subject: r25430: Add the loadparm context to all parametric options. (This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58) --- source4/lib/dbwrap/dbwrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib/dbwrap/dbwrap.c') diff --git a/source4/lib/dbwrap/dbwrap.c b/source4/lib/dbwrap/dbwrap.c index 057a6f0057..9e893b1243 100644 --- a/source4/lib/dbwrap/dbwrap.c +++ b/source4/lib/dbwrap/dbwrap.c @@ -30,8 +30,8 @@ */ struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags) { - if (lp_parm_bool(NULL, "ctdb", "enable", false) && - lp_parm_bool(NULL, "ctdb", name, true)) { + if (lp_parm_bool(global_loadparm, NULL, "ctdb", "enable", false) && + lp_parm_bool(global_loadparm, NULL, "ctdb", name, true)) { return db_tmp_open_ctdb(mem_ctx, name, tdb_flags); } -- cgit From 51db4c3f3d81d1ed03beae6426786c843ac59807 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Dec 2007 17:56:09 +0100 Subject: r26228: Store loadparm context in auth context, move more loadparm_contexts up the call stack. (This used to be commit ba75f1613a9aac69dd5df94dd8a2b37820acd166) --- source4/lib/dbwrap/dbwrap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/lib/dbwrap/dbwrap.c') diff --git a/source4/lib/dbwrap/dbwrap.c b/source4/lib/dbwrap/dbwrap.c index 9e893b1243..791d0adee6 100644 --- a/source4/lib/dbwrap/dbwrap.c +++ b/source4/lib/dbwrap/dbwrap.c @@ -25,15 +25,15 @@ #include "lib/dbwrap/dbwrap.h" #include "param/param.h" -/* +/** open a temporary database */ -struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags) +struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags) { - if (lp_parm_bool(global_loadparm, NULL, "ctdb", "enable", false) && - lp_parm_bool(global_loadparm, NULL, "ctdb", name, true)) { + if (lp_parm_bool(lp_ctx, NULL, "ctdb", "enable", false) && + lp_parm_bool(lp_ctx, NULL, "ctdb", name, true)) { return db_tmp_open_ctdb(mem_ctx, name, tdb_flags); } - return db_tmp_open_tdb(mem_ctx, name, tdb_flags); + return db_tmp_open_tdb(mem_ctx, lp_ctx, name, tdb_flags); } -- cgit From a72c5053c587f0ed6113ef514fe3739cb81e7abf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Dec 2007 23:32:43 +0100 Subject: r26353: Remove use of global_loadparm. (This used to be commit 17637e4490e42db6cdef619286c4d5a0982e9d1a) --- source4/lib/dbwrap/dbwrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/dbwrap/dbwrap.c') diff --git a/source4/lib/dbwrap/dbwrap.c b/source4/lib/dbwrap/dbwrap.c index 791d0adee6..be48e97b5a 100644 --- a/source4/lib/dbwrap/dbwrap.c +++ b/source4/lib/dbwrap/dbwrap.c @@ -32,7 +32,7 @@ struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ { if (lp_parm_bool(lp_ctx, NULL, "ctdb", "enable", false) && lp_parm_bool(lp_ctx, NULL, "ctdb", name, true)) { - return db_tmp_open_ctdb(mem_ctx, name, tdb_flags); + return db_tmp_open_ctdb(mem_ctx, lp_ctx, name, tdb_flags); } return db_tmp_open_tdb(mem_ctx, lp_ctx, name, tdb_flags); -- cgit