s3:build: remove global CLUSTER_SUPPORT define
authorStefan Metzmacher <metze@samba.org>
Tue, 21 Jan 2014 13:34:48 +0000 (14:34 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 24 Mar 2014 18:08:44 +0000 (19:08 +0100)
All ctdb specific code is isolated in samba-cluster-support.so now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Mar 24 19:08:44 CET 2014 on sn-devel-104

source3/include/messages.h
source3/lib/cluster_support.c
source3/lib/dbwrap/dbwrap_open.c
source3/lib/messages.c
source3/lib/serverid.c
source3/lib/smbconf/smbconf_reg.c
source3/smbd/process.c
source3/smbd/server.c
source3/wscript

index 566691157b8646545a33432057a20793a3d04fc7..d7a28538cddb871dafbb6fbbcf3eb0bc9240a520 100644 (file)
 
 #include "librpc/gen_ndr/server_id.h"
 
-#ifdef CLUSTER_SUPPORT
 #define MSG_BROADCAST_PID_STR  "0:0"
-#else
-#define MSG_BROADCAST_PID_STR  "0"
-#endif
 
 struct messaging_context;
 struct messaging_rec;
index 464236748b423c0b9542ed17791ed24d5f1d4df0..d6605fd3e21dc9fb9a186324b828079786559deb 100644 (file)
@@ -22,6 +22,7 @@
 
 #ifdef HAVE_CTDB_H
 #include <ctdb.h>
+#define CLUSTER_SUPPORT 1
 #endif
 
 #ifdef HAVE_CTDB_PROTOCOL_H
index 021ebc3980f7b071cc978d68d60831038ec97211..81f20b048d5390460d7658a73ab9a3b29de2596b 100644 (file)
@@ -30,7 +30,6 @@
 
 bool db_is_local(const char *name)
 {
-#ifdef CLUSTER_SUPPORT
        const char *sockname = lp_ctdbd_socket();
 
        if (lp_clustering() && socket_exist(sockname)) {
@@ -47,7 +46,7 @@ bool db_is_local(const char *name)
                        return false;
                }
        }
-#endif
+
        return true;
 }
 
@@ -62,9 +61,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                           uint64_t dbwrap_flags)
 {
        struct db_context *result = NULL;
-#ifdef CLUSTER_SUPPORT
        const char *sockname;
-#endif
 
        if (!DBWRAP_LOCK_ORDER_VALID(lock_order)) {
                errno = EINVAL;
@@ -96,7 +93,6 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                }
        }
 
-#ifdef CLUSTER_SUPPORT
        sockname = lp_ctdbd_socket();
 
        if (lp_clustering()) {
@@ -131,8 +127,6 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                }
        }
 
-#endif
-
        if (result == NULL) {
                struct loadparm_context *lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
                result = dbwrap_local_open(mem_ctx, lp_ctx, name, hash_size,
index 58f45d3b1cf03617094d4692ae8867b80b24388d..96b6b88a808e76c85fc35b395346c0e1496b8e48 100644 (file)
@@ -206,7 +206,6 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-#ifdef CLUSTER_SUPPORT
        if (lp_clustering()) {
                status = messaging_ctdbd_init(ctx, ctx, &ctx->remote);
 
@@ -218,7 +217,6 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
                }
        }
        ctx->id.vnn = get_my_vnn();
-#endif
 
        messaging_register(ctx, NULL, MSG_PING, ping_message);
 
@@ -254,7 +252,6 @@ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
                return status;
        }
 
-#ifdef CLUSTER_SUPPORT
        TALLOC_FREE(msg_ctx->remote);
 
        if (lp_clustering()) {
@@ -268,8 +265,6 @@ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
                }
        }
 
-#endif
-
        return NT_STATUS_OK;
 }
 
@@ -365,13 +360,11 @@ NTSTATUS messaging_send(struct messaging_context *msg_ctx,
                return NT_STATUS_INVALID_PARAMETER_MIX;
        }
 
-#ifdef CLUSTER_SUPPORT
        if (!procid_is_local(&server)) {
                return msg_ctx->remote->send_fn(msg_ctx, server,
                                                msg_type, data,
                                                msg_ctx->remote);
        }
-#endif
 
        if (server_id_equal(&msg_ctx->id, &server)) {
                struct messaging_selfsend_state *state;
index b69671e4221a9f80fa3dcbd9fa010f3a2ccb6ed1..5d5981825d0e07485e6dfb2963aeface9bd3e37c 100644 (file)
@@ -343,7 +343,6 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results)
                remote_num += 1;
        }
 
-#ifdef CLUSTER_SUPPORT
        if (remote_num != 0 &&
            ctdb_serverids_exist_supported(messaging_ctdbd_connection()))
        {
@@ -388,7 +387,6 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results)
                        results[idx] = todo_results[t];
                }
        }
-#endif
 
        if (remote_num != 0) {
                todo_num = 0;
@@ -401,13 +399,11 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results)
                        todo_num += 1;
                }
 
-#ifdef CLUSTER_SUPPORT
                if (!ctdb_processes_exist(messaging_ctdbd_connection(),
                                          todo_ids, todo_num,
                                          todo_results)) {
                        goto fail;
                }
-#endif
 
                for (t=0; t<todo_num; t++) {
                        idx = todo_idx[t];
index ac6b84d1f58873e7cde0fea01238ef734140bebf..bc878cc5d210c424f381707a57809f082451a6d1 100644 (file)
@@ -657,11 +657,10 @@ static int smbconf_reg_shutdown(struct smbconf_ctx *ctx)
 
 static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx)
 {
-#ifdef CLUSTER_SUPPORT
        if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) {
                return true;
        }
-#endif
+
        return false;
 }
 
index 9457000f4059a7afe2b405c05e24b9ffdcc50d53..df64c8270cb11d78518fccd870f751f2569dfeb3 100644 (file)
@@ -2499,8 +2499,6 @@ static void smbd_server_echo_handler(struct tevent_context *ev,
        }
 }
 
-#ifdef CLUSTER_SUPPORT
-
 struct smbd_release_ip_state {
        struct smbd_server_connection *sconn;
        struct tevent_immediate *im;
@@ -2627,7 +2625,6 @@ static int client_get_tcp_info(int sock, struct sockaddr_storage *server,
        }
        return 0;
 }
-#endif
 
 static void msg_kill_client_ip(struct messaging_context *msg_ctx,
                                  void *private_data, uint32_t msg_type,
@@ -3661,8 +3658,6 @@ void smbd_process(struct tevent_context *ev_ctx,
                exit(1);
        }
 
-#ifdef CLUSTER_SUPPORT
-
        if (lp_clustering()) {
                /*
                 * We need to tell ctdb about our client's TCP
@@ -3689,8 +3684,6 @@ void smbd_process(struct tevent_context *ev_ctx,
                }
        }
 
-#endif
-
        sconn->nbt.got_session = false;
 
        tmp = lp_max_xmit();
index 61ea17c825fe2826ddf813d6db640535bd7e579e..9d6a250752ba92d2d652b8ff9b7d248e737c1f79 100644 (file)
@@ -912,11 +912,9 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
        messaging_register(msg_ctx, NULL,
                           ID_CACHE_KILL, smbd_parent_id_cache_kill);
 
-#ifdef CLUSTER_SUPPORT
        if (lp_clustering()) {
                ctdbd_register_reconfigure(messaging_ctdbd_connection());
        }
-#endif
 
 #ifdef DEVELOPER
        messaging_register(msg_ctx, NULL, MSG_SMB_INJECT_FAULT,
index e6d2bb32357e75bfce7c43d2fe17b082b9dd97ae..4fe49fabb769b09561a2b3b2ae9aca72b3317aa7 100644 (file)
@@ -1713,7 +1713,6 @@ main() {
     conf.undefine('HAVE_CTDB_CHECK_CODE')
     if have_cluster_support:
         Logs.info("building with cluster support")
-        conf.DEFINE('CLUSTER_SUPPORT', 1);
         conf.env['CTDB_CFLAGS'] = CTDB_CFLAGS
     else:
         if Options.options.with_cluster_support == False:
@@ -1724,7 +1723,6 @@ main() {
         else:
             Logs.info("building without cluster support: " + ctdb_broken)
         conf.env['CTDB_CFLAGS'] = ''
-        conf.undefine('CLUSTER_SUPPORT')
 
 
     conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',