From d9d572a23cf527780caae9d7ff143376e9057f6a Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Thu, 16 Oct 2014 20:03:51 +1100 Subject: [PATCH] ctdb-logging: Remove ctdb element from struct ctdb_log_state This is set but otherwise not used. This allows the 1st argument to ctdb_set_logfile() to be generalised to a TALLOC_CTX. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/include/ctdb_client.h | 2 +- ctdb/server/ctdb_logging.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h index 1370ce97504..aa1145bcfa0 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -367,7 +367,7 @@ uint32_t *ctdb_get_connected_nodes(struct ctdb_context *ctdb, int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode); -int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile, bool use_syslog); +int ctdb_set_logfile(TALLOC_CTX *mem_ctx, const char *logfile, bool use_syslog); typedef int (*ctdb_traverse_func)(struct ctdb_context *, TDB_DATA, TDB_DATA, void *); int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *private_data); diff --git a/ctdb/server/ctdb_logging.c b/ctdb/server/ctdb_logging.c index 746f79a99a5..d7e10ee4151 100644 --- a/ctdb/server/ctdb_logging.c +++ b/ctdb/server/ctdb_logging.c @@ -193,7 +193,6 @@ int start_syslog_daemon(struct ctdb_context *ctdb) } struct ctdb_log_state { - struct ctdb_context *ctdb; const char *prefix; int fd, pfd; char buf[1024]; @@ -304,19 +303,17 @@ static void ctdb_logfile_log(void *private_ptr, int dbglevel, const char *s) /* choose the logfile location */ -int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile, bool use_syslog) +int ctdb_set_logfile(TALLOC_CTX *mem_ctx, const char *logfile, bool use_syslog) { debug_callback_fn callback; int ret; - log_state = talloc_zero(ctdb, struct ctdb_log_state); + log_state = talloc_zero(mem_ctx, struct ctdb_log_state); if (log_state == NULL) { printf("talloc_zero failed\n"); abort(); } - log_state->ctdb = ctdb; - if (use_syslog) { callback = ctdb_syslog_log; log_state->use_syslog = true; @@ -438,7 +435,6 @@ struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx, log = talloc_zero(mem_ctx, struct ctdb_log_state); CTDB_NO_MEMORY_NULL(ctdb, log); - log->ctdb = ctdb; log->prefix = log_prefix; log->logfn = logfn; log->logfn_private = logfn_private; -- 2.11.4.GIT