diff options
author | Joe Perches <joe@perches.com> | 2011-08-11 14:36:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-22 21:23:04 -0400 |
commit | 5b2ebce4821c66dd33d15d076ee264b4eb86fea3 (patch) | |
tree | 4d5aeb3c6a78a1ddf4cf7a59faca3d67be859180 /lib | |
parent | 6c2140ee0ebf91258f93d3019922b5f520a18d88 (diff) |
dynamic_debug: Remove uses of KERN_CONT in dynamic_emit_prefix
Multiple printks with KERN_CONT can be interleaved by
other printks. Reduce the likelihood of that interleaving
by consolidating multiple calls to printk.
Signed-off-by: Joe Perches <joe@perches.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 | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 37217090aacf..a3eb6ab074a6 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -430,23 +430,35 @@ static int ddebug_exec_query(char *query_string) | |||
430 | 430 | ||
431 | static int dynamic_emit_prefix(const struct _ddebug *descriptor) | 431 | static int dynamic_emit_prefix(const struct _ddebug *descriptor) |
432 | { | 432 | { |
433 | int res; | 433 | char tid[sizeof(int) + sizeof(int)/2 + 4]; |
434 | char lineno[sizeof(int) + sizeof(int)/2]; | ||
434 | 435 | ||
435 | res = printk(KERN_DEBUG); | ||
436 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) { | 436 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) { |
437 | if (in_interrupt()) | 437 | if (in_interrupt()) |
438 | res += printk(KERN_CONT "<intr> "); | 438 | snprintf(tid, sizeof(tid), "%s", "<intr> "); |
439 | else | 439 | else |
440 | res += printk(KERN_CONT "[%d] ", task_pid_vnr(current)); | 440 | snprintf(tid, sizeof(tid), "[%d] ", |
441 | task_pid_vnr(current)); | ||
442 | } else { | ||
443 | tid[0] = 0; | ||
441 | } | 444 | } |
442 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME) | ||
443 | res += printk(KERN_CONT "%s:", descriptor->modname); | ||
444 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) | ||
445 | res += printk(KERN_CONT "%s:", descriptor->function); | ||
446 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO) | ||
447 | res += printk(KERN_CONT "%d ", descriptor->lineno); | ||
448 | 445 | ||
449 | return res; | 446 | if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO) |
447 | snprintf(lineno, sizeof(lineno), "%d", descriptor->lineno); | ||
448 | else | ||
449 | lineno[0] = 0; | ||
450 | |||
451 | return printk(KERN_DEBUG "%s%s%s%s%s%s", | ||
452 | tid, | ||
453 | (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME) ? | ||
454 | descriptor->modname : "", | ||
455 | (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME) ? | ||
456 | ":" : "", | ||
457 | (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) ? | ||
458 | descriptor->function : "", | ||
459 | (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) ? | ||
460 | ":" : "", | ||
461 | lineno); | ||
450 | } | 462 | } |
451 | 463 | ||
452 | int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | 464 | int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) |