aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dynamic_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r--lib/dynamic_debug.c34
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
431static int dynamic_emit_prefix(const struct _ddebug *descriptor) 431static 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
452int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) 464int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)