From 2271f55e8cd2718e7662b8b361f8391fafb23fe8 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sun, 20 Jan 2013 23:09:09 +0100 Subject: [PATCH] brick_say: make debug messages runtime-selectable --- Kconfig | 7 +++++++ brick_say.c | 13 +++++++++++++ brick_say.h | 1 + mars_trans_logger.c | 4 ++-- sy_old/mars_light.c | 4 ++-- sy_old/mars_proc.c | 3 +++ sy_old/sy_generic.c | 2 +- 7 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Kconfig b/Kconfig index dbbd1095..9867d893 100644 --- a/Kconfig +++ b/Kconfig @@ -16,6 +16,13 @@ config MARS_DEBUG ---help--- OFF for production systems. ON for testing! +config MARS_DEBUG_DEFAULT + bool "turn on debug messages by default (may flood the logfiles)" + depends on MARS_DEBUG + default n + ---help--- + normally OFF + config MARS_BIGMODULE tristate "compile all MARS modules into a single kernel module" depends on MARS diff --git a/brick_say.c b/brick_say.c index a580c0b6..2cf30c30 100644 --- a/brick_say.c +++ b/brick_say.c @@ -43,6 +43,13 @@ char *say_class[MAX_SAY_CLASS] = { [SAY_TOTAL] = "total", }; +int brick_say_debug = +#ifdef CONFIG_MARS_DEBUG_DEFAULT + 1; +#else + 0; +#endif +EXPORT_SYMBOL_GPL(brick_say_debug); int brick_say_syslog_min = 1; EXPORT_SYMBOL_GPL(brick_say_syslog_min); int brick_say_syslog_max = -1; @@ -415,6 +422,9 @@ void say_to(struct say_channel *ch, int class, const char *fmt, ...) va_list args; unsigned long flags; + if (!class && !brick_say_debug) + return; + if (!ch) { ch = find_channel(current); } @@ -457,6 +467,9 @@ void brick_say_to(struct say_channel *ch, int class, bool dump, const char *pref va_list args; unsigned long flags; + if (!class && !brick_say_debug) + return; + if (!ch) { ch = find_channel(current); } diff --git a/brick_say.h b/brick_say.h index 490751df..7f026ebe 100644 --- a/brick_say.h +++ b/brick_say.h @@ -4,6 +4,7 @@ ///////////////////////////////////////////////////////////////////////// +extern int brick_say_debug; extern int brick_say_syslog_min; extern int brick_say_syslog_max; extern int delay_say_on_overflow; diff --git a/mars_trans_logger.c b/mars_trans_logger.c index daae93cd..ace4604d 100644 --- a/mars_trans_logger.c +++ b/mars_trans_logger.c @@ -3,10 +3,10 @@ // Trans_Logger brick //#define BRICK_DEBUGGING -//#define MARS_DEBUGGING +#define MARS_DEBUGGING //#define IO_DEBUGGING //#define REPLAY_DEBUGGING -//#define STAT_DEBUGGING // here means: display full statistics +#define STAT_DEBUGGING // here means: display full statistics //#define HASH_DEBUGGING #include diff --git a/sy_old/mars_light.c b/sy_old/mars_light.c index 80eb0d51..b22cb576 100644 --- a/sy_old/mars_light.c +++ b/sy_old/mars_light.c @@ -1,9 +1,9 @@ // (c) 2011 Thomas Schoebel-Theuer / 1&1 Internet AG //#define BRICK_DEBUGGING -//#define MARS_DEBUGGING +#define MARS_DEBUGGING //#define IO_DEBUGGING -//#define STAT_DEBUGGING // here means: display full statistics +#define STAT_DEBUGGING // here means: display full statistics // disable this only for debugging! #define RUN_PEERS diff --git a/sy_old/mars_proc.c b/sy_old/mars_proc.c index 8470915c..48b432ee 100644 --- a/sy_old/mars_proc.c +++ b/sy_old/mars_proc.c @@ -199,6 +199,9 @@ ctl_table mars_table[] = { .mode = 0400, .proc_handler = &lamport_sysctl_handler, }, +#ifdef CONFIG_MARS_DEBUG + INT_ENTRY("write_debug_messages", brick_say_debug, 0600), +#endif INT_ENTRY("logger_completion_semantics", trans_logger_completion_semantics, 0600), INT_ENTRY("logger_do_crc", trans_logger_do_crc, 0600), INT_ENTRY("syslog_min_class", brick_say_syslog_min, 0600), diff --git a/sy_old/sy_generic.c b/sy_old/sy_generic.c index 66fe2e9f..4ee1f795 100644 --- a/sy_old/sy_generic.c +++ b/sy_old/sy_generic.c @@ -1,7 +1,7 @@ // (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG //#define BRICK_DEBUGGING -//#define MARS_DEBUGGING +#define MARS_DEBUGGING //#define IO_DEBUGGING #include