summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/dbwrap.h2
-rw-r--r--source3/lib/dbwrap.c32
-rw-r--r--source3/lib/dbwrap/dbwrap_open.c27
-rw-r--r--source3/lib/dbwrap/dbwrap_open.h6
4 files changed, 33 insertions, 34 deletions
diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h
index 194692ca60..9084f87d30 100644
--- a/source3/include/dbwrap.h
+++ b/source3/include/dbwrap.h
@@ -56,8 +56,6 @@ struct db_context {
bool persistent;
};
-bool db_is_local(const char *name);
-
struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx);
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c
index 0774974ced..3d70fcdcd6 100644
--- a/source3/lib/dbwrap.c
+++ b/source3/lib/dbwrap.c
@@ -22,11 +22,6 @@
#include "includes.h"
#include "dbwrap.h"
#include "dbwrap/dbwrap_private.h"
-#include "util_tdb.h"
-#ifdef CLUSTER_SUPPORT
-#include "ctdb_private.h"
-#endif
-
/*
* Fall back using fetch_locked if no genuine fetch operation is provided
@@ -69,30 +64,3 @@ int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
TALLOC_FREE(data.dptr);
return res;
}
-
-bool db_is_local(const char *name)
-{
-#ifdef CLUSTER_SUPPORT
- const char *sockname = lp_ctdbd_socket();
-
- if(!sockname || !*sockname) {
- sockname = CTDB_PATH;
- }
-
- if (lp_clustering() && socket_exist(sockname)) {
- const char *partname;
- /* ctdb only wants the file part of the name */
- partname = strrchr(name, '/');
- if (partname) {
- partname++;
- } else {
- partname = name;
- }
- /* allow ctdb for individual databases to be disabled */
- if (lp_parm_bool(-1, "ctdb", partname, True)) {
- return false;
- }
- }
-#endif
- return true;
-}
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index d6b2f30ef6..8721b1b0f9 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -27,6 +27,33 @@
#include "ctdb_private.h"
#endif
+bool db_is_local(const char *name)
+{
+#ifdef CLUSTER_SUPPORT
+ const char *sockname = lp_ctdbd_socket();
+
+ if(!sockname || !*sockname) {
+ sockname = CTDB_PATH;
+ }
+
+ if (lp_clustering() && socket_exist(sockname)) {
+ const char *partname;
+ /* ctdb only wants the file part of the name */
+ partname = strrchr(name, '/');
+ if (partname) {
+ partname++;
+ } else {
+ partname = name;
+ }
+ /* allow ctdb for individual databases to be disabled */
+ if (lp_parm_bool(-1, "ctdb", partname, True)) {
+ return false;
+ }
+ }
+#endif
+ return true;
+}
+
/**
* open a database
*/
diff --git a/source3/lib/dbwrap/dbwrap_open.h b/source3/lib/dbwrap/dbwrap_open.h
index 153e91ad5d..5a172a4a2a 100644
--- a/source3/lib/dbwrap/dbwrap_open.h
+++ b/source3/lib/dbwrap/dbwrap_open.h
@@ -24,6 +24,12 @@
struct db_context;
/**
+ * Convenience function to check whether a tdb database
+ * is local or clustered (ctdb) in a clustered environment.
+ */
+bool db_is_local(const char *name);
+
+/**
* Convenience function that will determine whether to
* open a tdb database via the tdb backend or via the ctdb
* backend, based on lp_clustering() and a db-specific