From ae6df84a3c28d2079669971b7fdd75390f8e7aa6 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Fri, 25 Nov 2011 01:05:30 -0200 Subject: [PATCH] Make log function uppercase The worst case is the err() macro. Usually err is used as a variable, which clashes with this macro. --- libkmod/libkmod-loaded.c | 4 ++-- libkmod/libkmod-private.h | 14 +++++++------- libkmod/libkmod.c | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libkmod/libkmod-loaded.c b/libkmod/libkmod-loaded.c index f209a790..f881fb6c 100644 --- a/libkmod/libkmod-loaded.c +++ b/libkmod/libkmod-loaded.c @@ -103,7 +103,7 @@ KMOD_EXPORT struct kmod_loaded *kmod_loaded_unref(struct kmod_loaded *mod) if (--mod->refcount > 0) return mod; - dbg(mod->ctx, "kmod_loaded %p released\n", mod); + DBG(mod->ctx, "kmod_loaded %p released\n", mod); kmod_unref(mod->ctx); loaded_modules_free(mod); @@ -254,7 +254,7 @@ KMOD_EXPORT int kmod_loaded_remove_module(struct kmod_loaded *mod, err = delete_module(m->name, flags); if (err != 0) { - err(mod->ctx, "Removing '%s': %s\n", m->name, + ERR(mod->ctx, "Removing '%s': %s\n", m->name, strerror(-err)); return err; } diff --git a/libkmod/libkmod-private.h b/libkmod/libkmod-private.h index 56ada3a4..20da5610 100644 --- a/libkmod/libkmod-private.h +++ b/libkmod/libkmod-private.h @@ -18,16 +18,16 @@ static __always_inline __printf_format(2, 3) void #ifdef ENABLE_LOGGING # ifdef ENABLE_DEBUG -# define dbg(ctx, arg...) kmod_log_cond(ctx, LOG_DEBUG, ## arg) +# define DBG(ctx, arg...) kmod_log_cond(ctx, LOG_DEBUG, ## arg) # else -# define dbg(ctx, arg...) kmod_log_null(ctx, ## arg) +# define DBG(ctx, arg...) kmod_log_null(ctx, ## arg) # endif -# define info(ctx, arg...) kmod_log_cond(ctx, LOG_INFO, ## arg) -# define err(ctx, arg...) kmod_log_cond(ctx, LOG_ERR, ## arg) +# define INFO(ctx, arg...) kmod_log_cond(ctx, LOG_INFO, ## arg) +# define ERR(ctx, arg...) kmod_log_cond(ctx, LOG_ERR, ## arg) #else -# define dbg(ctx, arg...) kmod_log_null(ctx, ## arg) -# define info(ctx, arg...) kmod_log_null(ctx, ## arg) -# define err(ctx, arg...) kmod_log_null(ctx, ## arg) +# define DBG(ctx, arg...) kmod_log_null(ctx, ## arg) +# define INFO(ctx, arg...) kmod_log_null(ctx, ## arg) +# define ERR(ctx, arg...) kmod_log_null(ctx, ## arg) #endif #define KMOD_EXPORT __attribute__ ((visibility("default"))) diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c index 6417cab9..49acea2a 100644 --- a/libkmod/libkmod.c +++ b/libkmod/libkmod.c @@ -169,8 +169,8 @@ KMOD_EXPORT struct kmod_ctx *kmod_new(const char *dirname) if (env != NULL) kmod_set_log_priority(ctx, log_priority(env)); - info(ctx, "ctx %p created\n", ctx); - dbg(ctx, "log_priority=%d\n", ctx->log_priority); + INFO(ctx, "ctx %p created\n", ctx); + DBG(ctx, "log_priority=%d\n", ctx->log_priority); return ctx; } @@ -206,7 +206,7 @@ KMOD_EXPORT struct kmod_ctx *kmod_unref(struct kmod_ctx *ctx) if (--ctx->refcount > 0) return ctx; - info(ctx, "context %p released\n", ctx); + INFO(ctx, "context %p released\n", ctx); free((char *)ctx->dirname); free(ctx); return NULL; @@ -229,7 +229,7 @@ KMOD_EXPORT void kmod_set_log_fn(struct kmod_ctx *ctx, const char *format, va_list args)) { ctx->log_fn = log_fn; - info(ctx, "custom logging function %p registered\n", log_fn); + INFO(ctx, "custom logging function %p registered\n", log_fn); } /** -- 2.47.2