From 24054b5f8b196befb454f48a0da0600afac2c7a1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 13:33:49 +0200 Subject: [PATCH] s3:param: move lp_ctdbd_socket() to ctdbd_conn.c This allows us to use CTDB_PATH only in ctdbd_conn.c Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- docs-xml/smbdotconf/misc/ctdbdsocket.xml | 3 ++- lib/param/param_table.c | 2 +- source3/include/ctdbd_conn.h | 1 + source3/lib/ctdb_dummy.c | 5 +++++ source3/lib/ctdbd_conn.c | 12 ++++++++++++ source3/lib/dbwrap/dbwrap_open.c | 4 +--- source3/param/loadparm.c | 10 +--------- source3/torture/test_ctdbconn.c | 1 + 8 files changed, 24 insertions(+), 14 deletions(-) diff --git a/docs-xml/smbdotconf/misc/ctdbdsocket.xml b/docs-xml/smbdotconf/misc/ctdbdsocket.xml index 378d6e24c56..27e8121bd6f 100644 --- a/docs-xml/smbdotconf/misc/ctdbdsocket.xml +++ b/docs-xml/smbdotconf/misc/ctdbdsocket.xml @@ -1,8 +1,9 @@ If you set clustering=yes, diff --git a/lib/param/param_table.c b/lib/param/param_table.c index ad929ec16b2..40f8eb50d88 100644 --- a/lib/param/param_table.c +++ b/lib/param/param_table.c @@ -1938,7 +1938,7 @@ static struct parm_struct parm_table[] = { .label = "ctdbd socket", .type = P_STRING, .p_class = P_GLOBAL, - .offset = GLOBAL_VAR(ctdbd_socket), + .offset = GLOBAL_VAR(_ctdbd_socket), .special = NULL, .enum_list = NULL, .flags = FLAG_ADVANCED | FLAG_GLOBAL, diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h index e250925a755..49445d91b2e 100644 --- a/source3/include/ctdbd_conn.h +++ b/source3/include/ctdbd_conn.h @@ -30,6 +30,7 @@ NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx, struct ctdbd_connection **pconn); uint32_t ctdbd_vnn(const struct ctdbd_connection *conn); +const char *lp_ctdbd_socket(void); NTSTATUS ctdbd_register_msg_ctx(struct ctdbd_connection *conn, struct messaging_context *msg_ctx); diff --git a/source3/lib/ctdb_dummy.c b/source3/lib/ctdb_dummy.c index 9f32d1353c6..e2b7c17e4c6 100644 --- a/source3/lib/ctdb_dummy.c +++ b/source3/lib/ctdb_dummy.c @@ -59,6 +59,11 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn, return NT_STATUS_NOT_IMPLEMENTED; } +const char *lp_ctdbd_socket(void) +{ + return ""; +} + bool ctdb_serverids_exist_supported(struct ctdbd_connection *conn) { return false; diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 94d19c744d1..ae4f7bbfba3 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -194,6 +194,18 @@ uint32_t ctdbd_vnn(const struct ctdbd_connection *conn) return conn->our_vnn; } +const char *lp_ctdbd_socket(void) +{ + const char *ret; + + ret = lp__ctdbd_socket(); + if (ret != NULL && strlen(ret) > 0) { + return ret; + } + + return CTDB_PATH; +} + /* * Get us a ctdb connection */ diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c index 3c8756b0bce..021ebc3980f 100644 --- a/source3/lib/dbwrap/dbwrap_open.c +++ b/source3/lib/dbwrap/dbwrap_open.c @@ -26,9 +26,7 @@ #include "dbwrap/dbwrap_ctdb.h" #include "lib/param/param.h" #include "util_tdb.h" -#ifdef CLUSTER_SUPPORT -#include "ctdb_private.h" -#endif +#include "ctdbd_conn.h" bool db_is_local(const char *name) { diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 05657591e4a..ad879725b48 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -78,10 +78,6 @@ #include #endif -#ifdef CLUSTER_SUPPORT -#include "ctdb_private.h" -#endif - bool bLoaded = false; extern userdom_struct current_user_info; @@ -934,11 +930,7 @@ static void init_globals(bool reinit_globals) string_set(&Globals.cups_server, ""); string_set(&Globals.iprint_server, ""); -#ifdef CLUSTER_SUPPORT - string_set(&Globals.ctdbd_socket, CTDB_PATH); -#else - string_set(&Globals.ctdbd_socket, ""); -#endif + string_set(&Globals._ctdbd_socket, ""); Globals.cluster_addresses = NULL; Globals.clustering = false; diff --git a/source3/torture/test_ctdbconn.c b/source3/torture/test_ctdbconn.c index 7b30288acc2..d8f744c24b8 100644 --- a/source3/torture/test_ctdbconn.c +++ b/source3/torture/test_ctdbconn.c @@ -23,6 +23,7 @@ #ifdef CLUSTER_SUPPORT #include "ctdb_conn.h" +#include "ctdbd_conn.h" #include "lib/util/tevent_unix.h" #include "tdb.h" -- 2.11.4.GIT