[PATCH 08/26] dynamic_debug: define several levels of verbosity

From: jim . cromie
Date: Wed Sep 21 2011 - 17:56:15 EST


From: Jim Cromie <jim.cromie@xxxxxxxxx>

define verbose levels 10, 11 to turn on noisy pr_info()s selectively
10: ddebug_proc_(start|stop) - once each per page of output
11: ddebug_proc_(show|next) - once each for every call-site
1-9: are unspecified, may be used for other pr_info()s

No MODULE_PARM_DESC added, as modinfo doesnt report it for built-ins.

Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
---
lib/dynamic_debug.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 74b395b..b88f918 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -61,6 +61,8 @@ struct ddebug_iter {
static DEFINE_MUTEX(ddebug_lock);
static LIST_HEAD(ddebug_tables);
static int verbose = 0;
+#define VERBOSE_PROC 10 /* enable per-page msgs on control file reads */
+#define VERBOSE_PROC_SHOW 11 /* enable per-line msgs on control file reads */
module_param(verbose, int, 0644);

/* Return the last part of a pathname */
@@ -636,7 +638,7 @@ static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
struct _ddebug *dp;
int n = *pos;

- if (verbose)
+ if (verbose >= VERBOSE_PROC)
pr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos);

mutex_lock(&ddebug_lock);
@@ -661,7 +663,7 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos)
struct ddebug_iter *iter = m->private;
struct _ddebug *dp;

- if (verbose)
+ if (verbose >= VERBOSE_PROC_SHOW)
pr_info("called m=%p p=%p *pos=%lld\n",
m, p, (unsigned long long)*pos);

@@ -685,7 +687,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
struct _ddebug *dp = p;
char flagsbuf[8];

- if (verbose)
+ if (verbose >= VERBOSE_PROC_SHOW)
pr_info("called m=%p p=%p\n", m, p);

if (p == SEQ_START_TOKEN) {
@@ -710,7 +712,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
*/
static void ddebug_proc_stop(struct seq_file *m, void *p)
{
- if (verbose)
+ if (verbose >= VERBOSE_PROC)
pr_info("called m=%p p=%p\n", m, p);
mutex_unlock(&ddebug_lock);
}
--
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/