[s3]libsmbconf: add backend_requires_messaging() method to libsmbconf.
authorMichael Adam <obnox@samba.org>
Mon, 20 Oct 2008 21:52:02 +0000 (23:52 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 27 Oct 2008 12:02:38 +0000 (13:02 +0100)
In a clustered environment, the registry backend needs messaging
to be set up since ctdb requires this.

Michael

source3/lib/smbconf/smbconf.c
source3/lib/smbconf/smbconf.h
source3/lib/smbconf/smbconf_private.h
source3/lib/smbconf/smbconf_reg.c
source3/lib/smbconf/smbconf_txt.c

index 77a438048fd790c83f74f7496107c6a890ac8322..f0188380a0368598a01f291e68cc7f7876ea91e9 100644 (file)
@@ -42,6 +42,15 @@ static WERROR smbconf_global_check(struct smbconf_ctx *ctx)
  *
  **********************************************************************/
 
+/**
+ * Tell whether the backend requires messaging to be set up
+ * for the backend to work correctly.
+ */
+bool smbconf_backend_requires_messaging(struct smbconf_ctx *ctx)
+{
+       return ctx->ops->requires_messaging(ctx);
+}
+
 /**
  * Close the configuration.
  */
index e3374766652550dd86daeaff28d118267e89cee5..3f3435ea0092a6daebdd99bb52381c62ecc130d1 100644 (file)
@@ -56,6 +56,7 @@ WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx,
 /*
  * the smbconf API functions
  */
+bool smbconf_backend_requires_messaging(struct smbconf_ctx *ctx);
 void smbconf_shutdown(struct smbconf_ctx *ctx);
 bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
                     const char *service, const char *param);
index 8e7d6a9983e7c9c832e53f6744c27b25c022ee1b..a47d81fa256c64fa672556b300af4e029fcf5e7d 100644 (file)
@@ -23,6 +23,7 @@
 struct smbconf_ops {
        WERROR (*init)(struct smbconf_ctx *ctx, const char *path);
        int (*shutdown)(struct smbconf_ctx *ctx);
+       bool (*requires_messaging)(struct smbconf_ctx *ctx);
        WERROR (*open_conf)(struct smbconf_ctx *ctx);
        int (*close_conf)(struct smbconf_ctx *ctx);
        void (*get_csn)(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
index 1aa345da3c668dcdb6da5d8b9d735172802faa26..6edb9ed22e8a998e6cfb483c17e37e86a6d44105 100644 (file)
@@ -642,6 +642,16 @@ static int smbconf_reg_shutdown(struct smbconf_ctx *ctx)
        return ctx->ops->close_conf(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;
+}
+
 static WERROR smbconf_reg_open(struct smbconf_ctx *ctx)
 {
        WERROR werr;
@@ -1119,6 +1129,7 @@ done:
 struct smbconf_ops smbconf_ops_reg = {
        .init                   = smbconf_reg_init,
        .shutdown               = smbconf_reg_shutdown,
+       .requires_messaging     = smbconf_reg_requires_messaging,
        .open_conf              = smbconf_reg_open,
        .close_conf             = smbconf_reg_close,
        .get_csn                = smbconf_reg_get_csn,
index 1393a098d5d6c51c037ba37febcc2fe0404d02cf..7661c0dceb718e56db3a8de02b27cbc0be45ea4a 100644 (file)
@@ -243,6 +243,11 @@ static int smbconf_txt_shutdown(struct smbconf_ctx *ctx)
        return ctx->ops->close_conf(ctx);
 }
 
+static bool smbconf_txt_requires_messaging(struct smbconf_ctx *ctx)
+{
+       return false;
+}
+
 static WERROR smbconf_txt_open(struct smbconf_ctx *ctx)
 {
        return smbconf_txt_load_file(ctx);
@@ -604,6 +609,7 @@ static WERROR smbconf_txt_delete_includes(struct smbconf_ctx *ctx,
 static struct smbconf_ops smbconf_ops_txt = {
        .init                   = smbconf_txt_init,
        .shutdown               = smbconf_txt_shutdown,
+       .requires_messaging     = smbconf_txt_requires_messaging,
        .open_conf              = smbconf_txt_open,
        .close_conf             = smbconf_txt_close,
        .get_csn                = smbconf_txt_get_csn,