diff options
author | Jim Cromie <jim.cromie@gmail.com> | 2011-12-19 17:13:16 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-24 15:50:36 -0500 |
commit | 574b3725e327531c70361d1a10b8dc8dd2b93590 (patch) | |
tree | a68938a8ef462426a34bb002ee697e2e6ce26df7 /lib | |
parent | 2b6783191da7211c88f98eb1a2bd2027bff36e30 (diff) |
dynamic_debug: factor vpr_info_dq out of ddebug_parse_query
Factor pr_info(query) out of ddebug_parse_query, into vpr_info_dq(),
for reuse later. Also change the printed labels: file, func to agree
with the query-spec keywords accepted in the control file. Pass ""
when string is null, to avoid "(null)" output from sprintf. For
format print, use precision to skip last char, assuming its '\n', no
great harm if not, its a debug msg.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dynamic_debug.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index a5508a12b83d..93fc5d500cd5 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -107,6 +107,22 @@ static char *ddebug_describe_flags(struct _ddebug *dp, char *buf, | |||
107 | return buf; | 107 | return buf; |
108 | } | 108 | } |
109 | 109 | ||
110 | #define vpr_info_dq(q, msg) \ | ||
111 | do { \ | ||
112 | if (verbose) \ | ||
113 | /* trim last char off format print */ \ | ||
114 | pr_info("%s: func=\"%s\" file=\"%s\" " \ | ||
115 | "module=\"%s\" format=\"%.*s\" " \ | ||
116 | "lineno=%u-%u", \ | ||
117 | msg, \ | ||
118 | q->function ? q->function : "", \ | ||
119 | q->filename ? q->filename : "", \ | ||
120 | q->module ? q->module : "", \ | ||
121 | (int)(q->format ? strlen(q->format) - 1 : 0), \ | ||
122 | q->format ? q->format : "", \ | ||
123 | q->first_lineno, q->last_lineno); \ | ||
124 | } while (0) | ||
125 | |||
110 | /* | 126 | /* |
111 | * Search the tables for _ddebug's which match the given | 127 | * Search the tables for _ddebug's which match the given |
112 | * `query' and apply the `flags' and `mask' to them. Tells | 128 | * `query' and apply the `flags' and `mask' to them. Tells |
@@ -367,14 +383,7 @@ static int ddebug_parse_query(char *words[], int nwords, | |||
367 | if (rc) | 383 | if (rc) |
368 | return rc; | 384 | return rc; |
369 | } | 385 | } |
370 | 386 | vpr_info_dq(query, "parsed"); | |
371 | if (verbose) | ||
372 | pr_info("q->function=\"%s\" q->filename=\"%s\" " | ||
373 | "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n", | ||
374 | query->function, query->filename, | ||
375 | query->module, query->format, query->first_lineno, | ||
376 | query->last_lineno); | ||
377 | |||
378 | return 0; | 387 | return 0; |
379 | } | 388 | } |
380 | 389 | ||