[PATCH] CTDB configuration clean-ups

Jeremy Allison jra at samba.org
Tue Nov 6 01:00:19 UTC 2018


On Tue, Nov 06, 2018 at 11:50:01AM +1100, Martin Schwenke wrote:
> On Mon, 5 Nov 2018 15:16:52 -0800, Jeremy Allison <jra at samba.org> wrote:
> 
> > On Tue, Nov 06, 2018 at 10:05:10AM +1100, Amitay Isaacs via samba-technical wrote:
> > > On Mon, Nov 5, 2018 at 11:25 AM Martin Schwenke via samba-technical
> > > <samba-technical at lists.samba.org> wrote:
> > > >
> > > > This patch set drops ad hoc usage of CTDB_SOCKET and CTDB_PIDFILE
> > > > environment variables.  Instead, common path handling is now used
> > > > throughout the code.  As documented in tests/README, this
> > > > means that compile-time defaults are used unless CTDB_TEST_MODE and
> > > > CTDB_BASE are set, in which case locations relative to CTDB_BASE are
> > > > used.
> > > >
> > > > However, note that the first commit adds an exception for CTDB_SOCKET to
> > > > the common path handling.  This is used when the caller asks for the
> > > > socket path for "ctdbd" (and when CTDB_SOCKET is set).
> > > >
> > > > Please review and maybe push...
> > > 
> > > In the patch "ctdb-tests: Use path_socket() in dummy client",  there
> > > is no need to set default options.sockpath using
> > > talloc_autofree_context().
> > > Let the default be NULL.  If there is no socket argument, use existing
> > > mem_ctx to set up the default sockpath.
> > 
> > Oh yes ! I've managed to remove  all uses of talloc_autofree_context()
> > from Samba proper (although I have noticed it has crept back into:
> > lib/ldb/tests/ldb_kv_ops_test.c
> > I'll have to kill that :-).
> > 
> > Please do not use this function for *anything* !
> 
> Can we please mark talloc_autofree_context() as deprecated?
> 
> I tried doing it but I couldn't figure out how to make the compiler
> complain...  ;-)

Does this work ? Please review and push if happy :-).

Cheers,

	Jeremy.
-------------- next part --------------
From 86621585ac1a8c6beb0541e6ff8d9353f3c2ce95 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Mon, 5 Nov 2018 16:56:05 -0800
Subject: [PATCH 1/2] lib: talloc: Mark talloc_autofree_context() as
 deprecated.

Signed-off-by: Jeremy Allison <jra at samba.org>
---
 lib/talloc/talloc.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index ba3dee8de97..498bad3b533 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -101,7 +101,15 @@ typedef void TALLOC_CTX;
 #endif
 #endif
 
+#ifndef _DEPRECATED_
+#ifdef HAVE___ATTRIBUTE__
+#define _DEPRECATED_ __attribute__ ((deprecated))
+#else
+#define _DEPRECATED_
+#endif
+#endif
 #ifdef DOXYGEN
+
 /**
  * @brief Create a new talloc context.
  *
@@ -1047,7 +1055,7 @@ int talloc_unlink(const void *context, void *ptr);
  *
  * @return              A talloc context, NULL on error.
  */
-void *talloc_autofree_context(void);
+void *talloc_autofree_context(void) _DEPRECATED_;
 
 /**
  * @brief Get the size of a talloc chunk.
@@ -1893,13 +1901,6 @@ void talloc_set_log_fn(void (*log_fn)(const char *message));
  */
 void talloc_set_log_stderr(void);
 
-#ifndef _DEPRECATED_
-#ifdef HAVE___ATTRIBUTE__
-#define _DEPRECATED_ __attribute__ ((deprecated))
-#else
-#define _DEPRECATED_
-#endif
-#endif
 /**
  * @brief Set a max memory limit for the current context hierarchy
  *	  This affects all children of this context and constrain any
-- 
2.19.1.930.g4563a0d9d0-goog


From 1d1e8649ac1355af0273bd6649a29e4361285b59 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Mon, 5 Nov 2018 16:57:51 -0800
Subject: [PATCH 2/2] lib: ldb: Remove use of talloc_autofree_context().

Just use NULL in test case. talloc_autofree_context() is deprecated.

Signed-off-by: Jeremy Allison <jra at samba.org>
---
 lib/ldb/tests/ldb_kv_ops_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ldb/tests/ldb_kv_ops_test.c b/lib/ldb/tests/ldb_kv_ops_test.c
index 68c04863db6..d6a4dc058e5 100644
--- a/lib/ldb/tests/ldb_kv_ops_test.c
+++ b/lib/ldb/tests/ldb_kv_ops_test.c
@@ -192,8 +192,8 @@ static int parse(struct ldb_val key,
 {
 	struct ldb_val* read = private_data;
 
-	/* Yes, we essentially leak this.  That is OK */
-	read->data = talloc_size(talloc_autofree_context(),
+	/* Yes, we leak this.  That is OK */
+	read->data = talloc_size(NULL,
 				 data.length);
 	assert_non_null(read->data);
 
-- 
2.19.1.930.g4563a0d9d0-goog



More information about the samba-technical mailing list