blob: f350170059c6c274dc951fb7b550272c8bff4df9 [file] [log] [blame]
Johannes Berg95100352011-11-24 20:03:08 +01001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM printk
3
4#if !defined(_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_PRINTK_H
6
7#include <linux/tracepoint.h>
8
zhangwei(Jovi)07c65f42013-04-29 16:17:16 -07009TRACE_EVENT(console,
10 TP_PROTO(const char *text, size_t len),
Johannes Berg95100352011-11-24 20:03:08 +010011
zhangwei(Jovi)07c65f42013-04-29 16:17:16 -070012 TP_ARGS(text, len),
Johannes Berg95100352011-11-24 20:03:08 +010013
14 TP_STRUCT__entry(
zhangwei(Jovi)07c65f42013-04-29 16:17:16 -070015 __dynamic_array(char, msg, len + 1)
Johannes Berg95100352011-11-24 20:03:08 +010016 ),
17
18 TP_fast_assign(
Daniel Bristot de Oliveira78aebca2016-07-01 20:44:37 -030019 /*
20 * Each trace entry is printed in a new line.
21 * If the msg finishes with '\n', cut it off
22 * to avoid blank lines in the trace.
23 */
24 if ((len > 0) && (text[len-1] == '\n'))
25 len -= 1;
26
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -030027 memcpy(__get_str(msg), text, len);
28 __get_str(msg)[len] = 0;
Johannes Berg95100352011-11-24 20:03:08 +010029 ),
30
31 TP_printk("%s", __get_str(msg))
32);
33#endif /* _TRACE_PRINTK_H */
34
35/* This part must be outside protection */
36#include <trace/define_trace.h>