From 28202631fecbc3b20a55cfc5fa339663db37e955 Mon Sep 17 00:00:00 2001 From: Zhang Huan Date: Tue, 5 Dec 2017 12:45:46 +0800 Subject: libglusterfs: specify ctx in gf_log_set_loglevel specify ctx in gf_log_set_loglevel, instead of getting it from a thread specific variable. Change-Id: I498f826e8e32231235a6b0005026a27c327727fd BUG: 1521213 Signed-off-by: Zhang Huan --- libglusterfs/src/logging.c | 6 +----- libglusterfs/src/logging.h | 6 +++--- libglusterfs/src/xlator.c | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 0f238d00738..6768082b6e6 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -131,12 +131,8 @@ gf_log_get_loglevel (void) } void -gf_log_set_loglevel (gf_loglevel_t level) +gf_log_set_loglevel (glusterfs_ctx_t *ctx, gf_loglevel_t level) { - glusterfs_ctx_t *ctx = NULL; - - ctx = THIS->ctx; - if (ctx) ctx->log.loglevel = level; } diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h index 6e433e203f9..665ab268dc6 100644 --- a/libglusterfs/src/logging.h +++ b/libglusterfs/src/logging.h @@ -279,10 +279,12 @@ int _gf_log_eh (const char *function, const char *fmt, ...); gf_log (args); \ } +struct _glusterfs_ctx; + void gf_log_disable_syslog (void); void gf_log_enable_syslog (void); gf_loglevel_t gf_log_get_loglevel (void); -void gf_log_set_loglevel (gf_loglevel_t level); +void gf_log_set_loglevel (struct _glusterfs_ctx *ctx, gf_loglevel_t level); int gf_log_get_localtime (void); void gf_log_set_localtime (int); void gf_log_flush (void); @@ -310,8 +312,6 @@ gf_log_set_log_buf_size (uint32_t buf_size); void gf_log_set_log_flush_timeout (uint32_t timeout); -struct _glusterfs_ctx; - void gf_log_flush_msgs (struct _glusterfs_ctx *ctx); diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 03495463a53..a342bbd7f33 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -1294,7 +1294,7 @@ is_gf_log_command (xlator_t *this, const char *name, char *value) LG_MSG_SET_LOG_LEVEL, "setting log level to %d (old-value=%d)", log_level, gf_log_get_loglevel()); - gf_log_set_loglevel (log_level); + gf_log_set_loglevel (this->ctx, log_level); ret = 0; goto out; } -- cgit