提交 574b3725 编写于 作者: J Jim Cromie 提交者: Greg Kroah-Hartman

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: NJim Cromie <jim.cromie@gmail.com>
Signed-off-by: NJason Baron <jbaron@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 2b678319
...@@ -107,6 +107,22 @@ static char *ddebug_describe_flags(struct _ddebug *dp, char *buf, ...@@ -107,6 +107,22 @@ static char *ddebug_describe_flags(struct _ddebug *dp, char *buf,
return 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); \
} while (0)
/* /*
* Search the tables for _ddebug's which match the given * Search the tables for _ddebug's which match the given
* `query' and apply the `flags' and `mask' to them. Tells * `query' and apply the `flags' and `mask' to them. Tells
...@@ -367,14 +383,7 @@ static int ddebug_parse_query(char *words[], int nwords, ...@@ -367,14 +383,7 @@ static int ddebug_parse_query(char *words[], int nwords,
if (rc) if (rc)
return rc; return rc;
} }
vpr_info_dq(query, "parsed");
if (verbose)
pr_info("q->function=\"%s\" q->filename=\"%s\" "
"q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n",
query->function, query->filename,
query->module, query->format, query->first_lineno,
query->last_lineno);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册