Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304049
b: refs/heads/master
c: b8ccd5d
h: refs/heads/master
i:
  304047: 4fc8530
v: v3
  • Loading branch information
Jim Cromie authored and Greg Kroah-Hartman committed Apr 30, 2012
1 parent f67bc0b commit 8f7e4f7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 47 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c0a6720977f89c50473366af965ae28cd8fce923
refs/heads/master: b8ccd5dee776d85e29cf139c77595b7369e294bc
81 changes: 35 additions & 46 deletions trunk/lib/dynamic_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,22 @@ static char *ddebug_describe_flags(struct _ddebug *dp, char *buf,
return buf;
}

#define vpr_info_dq(q, msg) \
do { \
if (verbose) \
/* trim last char off format print */ \
pr_info("%s: func=\"%s\" file=\"%s\" " \
"module=\"%s\" format=\"%.*s\" " \
"lineno=%u-%u", \
msg, \
q->function ? q->function : "", \
q->filename ? q->filename : "", \
q->module ? q->module : "", \
(int)(q->format ? strlen(q->format) - 1 : 0), \
q->format ? q->format : "", \
q->first_lineno, q->last_lineno); \
#define vpr_info(fmt, ...) \
if (verbose) do { pr_info(fmt, ##__VA_ARGS__); } while (0)

#define vpr_info_dq(q, msg) \
do { \
/* trim last char off format print */ \
vpr_info("%s: func=\"%s\" file=\"%s\" " \
"module=\"%s\" format=\"%.*s\" " \
"lineno=%u-%u", \
msg, \
q->function ? q->function : "", \
q->filename ? q->filename : "", \
q->module ? q->module : "", \
(int)(q->format ? strlen(q->format) - 1 : 0), \
q->format ? q->format : "", \
q->first_lineno, q->last_lineno); \
} while (0)

/*
Expand Down Expand Up @@ -180,12 +182,11 @@ static int ddebug_change(const struct ddebug_query *query,
if (newflags == dp->flags)
continue;
dp->flags = newflags;
if (verbose)
pr_info("changed %s:%d [%s]%s =%s\n",
trim_prefix(dp->filename), dp->lineno,
dt->mod_name, dp->function,
ddebug_describe_flags(dp, flagbuf,
sizeof(flagbuf)));
vpr_info("changed %s:%d [%s]%s =%s\n",
trim_prefix(dp->filename), dp->lineno,
dt->mod_name, dp->function,
ddebug_describe_flags(dp, flagbuf,
sizeof(flagbuf)));
}
}
mutex_unlock(&ddebug_lock);
Expand Down Expand Up @@ -410,8 +411,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
default:
return -EINVAL;
}
if (verbose)
pr_info("op='%c'\n", op);
vpr_info("op='%c'\n", op);

for ( ; *str ; ++str) {
for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
Expand All @@ -423,8 +423,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
if (i < 0)
return -EINVAL;
}
if (verbose)
pr_info("flags=0x%x\n", flags);
vpr_info("flags=0x%x\n", flags);

/* calculate final *flagsp, *maskp according to mask and op */
switch (op) {
Expand All @@ -441,8 +440,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
*flagsp = 0;
break;
}
if (verbose)
pr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp);
vpr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp);
return 0;
}

Expand Down Expand Up @@ -487,8 +485,7 @@ static int ddebug_exec_queries(char *query)
if (!query || !*query || *query == '#')
continue;

if (verbose)
pr_info("query %d: \"%s\"\n", i, query);
vpr_info("query %d: \"%s\"\n", i, query);

rc = ddebug_exec_query(query);
if (rc < 0) {
Expand All @@ -498,7 +495,7 @@ static int ddebug_exec_queries(char *query)
nfound += rc;
i++;
}
pr_info("processed %d queries, with %d matches, %d errs\n",
vpr_info("processed %d queries, with %d matches, %d errs\n",
i, nfound, errs);

if (exitcode)
Expand Down Expand Up @@ -653,8 +650,7 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
return -EFAULT;
}
tmpbuf[len] = '\0';
if (verbose)
pr_info("read %d bytes from userspace\n", (int)len);
vpr_info("read %d bytes from userspace\n", (int)len);

ret = ddebug_exec_queries(tmpbuf);
kfree(tmpbuf);
Expand Down Expand Up @@ -717,8 +713,7 @@ static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
struct _ddebug *dp;
int n = *pos;

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

mutex_lock(&ddebug_lock);

Expand All @@ -742,9 +737,8 @@ 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)
pr_info("called m=%p p=%p *pos=%lld\n",
m, p, (unsigned long long)*pos);
vpr_info("called m=%p p=%p *pos=%lld\n",
m, p, (unsigned long long)*pos);

if (p == SEQ_START_TOKEN)
dp = ddebug_iter_first(iter);
Expand All @@ -766,8 +760,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
struct _ddebug *dp = p;
char flagsbuf[10];

if (verbose)
pr_info("called m=%p p=%p\n", m, p);
vpr_info("called m=%p p=%p\n", m, p);

if (p == SEQ_START_TOKEN) {
seq_puts(m,
Expand All @@ -791,8 +784,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)
pr_info("called m=%p p=%p\n", m, p);
vpr_info("called m=%p p=%p\n", m, p);
mutex_unlock(&ddebug_lock);
}

Expand All @@ -815,8 +807,7 @@ static int ddebug_proc_open(struct inode *inode, struct file *file)
struct ddebug_iter *iter;
int err;

if (verbose)
pr_info("called\n");
vpr_info("called\n");

iter = kzalloc(sizeof(*iter), GFP_KERNEL);
if (iter == NULL)
Expand Down Expand Up @@ -866,8 +857,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
list_add_tail(&dt->link, &ddebug_tables);
mutex_unlock(&ddebug_lock);

if (verbose)
pr_info("%u debug prints in module %s\n", n, dt->mod_name);
vpr_info("%u debug prints in module %s\n", n, dt->mod_name);
return 0;
}
EXPORT_SYMBOL_GPL(ddebug_add_module);
Expand All @@ -888,8 +878,7 @@ int ddebug_remove_module(const char *mod_name)
struct ddebug_table *dt, *nextdt;
int ret = -ENOENT;

if (verbose)
pr_info("removing module \"%s\"\n", mod_name);
vpr_info("removing module \"%s\"\n", mod_name);

mutex_lock(&ddebug_lock);
list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) {
Expand Down

0 comments on commit 8f7e4f7

Please sign in to comment.