Commit | Line | Data |
---|---|---|
b87700e3 AG |
1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM printk | |
3 | ||
3bc29f0a MD |
4 | #if !defined(LTTNG_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ) |
5 | #define LTTNG_TRACE_PRINTK_H | |
b87700e3 | 6 | |
6ec43db8 | 7 | #include <probes/lttng-tracepoint-event.h> |
b87700e3 AG |
8 | #include <linux/version.h> |
9 | ||
68ed2ee0 MD |
10 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) |
11 | ||
9bbf98da MD |
12 | LTTNG_TRACEPOINT_EVENT_MAP(console, |
13 | ||
14 | printk_console, | |
15 | ||
68ed2ee0 MD |
16 | TP_PROTO(const char *text, size_t len), |
17 | ||
18 | TP_ARGS(text, len), | |
19 | ||
f127e61e MD |
20 | TP_FIELDS( |
21 | ctf_sequence_text(char, msg, text, size_t, len) | |
22 | ) | |
68ed2ee0 MD |
23 | ) |
24 | ||
25 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) | |
b87700e3 | 26 | |
47046cfc | 27 | LTTNG_TRACEPOINT_EVENT_MAP(console, |
9bbf98da MD |
28 | |
29 | printk_console, | |
30 | ||
b87700e3 AG |
31 | TP_PROTO(const char *log_buf, unsigned start, unsigned end, |
32 | unsigned log_buf_len), | |
33 | ||
34 | TP_ARGS(log_buf, start, end, log_buf_len), | |
35 | ||
f127e61e MD |
36 | TP_FIELDS( |
37 | ctf_sequence_text(char, msg, log_buf + start, | |
38 | size_t, end - start) | |
39 | ) | |
68ed2ee0 MD |
40 | ) |
41 | ||
42 | #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */ | |
43 | ||
47046cfc | 44 | LTTNG_TRACEPOINT_EVENT_MAP(console, |
9bbf98da MD |
45 | |
46 | printk_console, | |
47 | ||
68ed2ee0 MD |
48 | TP_PROTO(const char *log_buf, unsigned start, unsigned end, |
49 | unsigned log_buf_len), | |
50 | ||
51 | TP_ARGS(log_buf, start, end, log_buf_len), | |
52 | ||
f127e61e MD |
53 | TP_FIELDS( |
54 | /* | |
55 | * printk buffer is gathered from two segments on older kernels. | |
56 | */ | |
57 | ctf_sequence_text(char, msg1, | |
58 | log_buf + (start & (log_buf_len - 1)), | |
59 | size_t, (start & (log_buf_len - 1)) > (end & (log_buf_len - 1)) | |
68ed2ee0 | 60 | ? log_buf_len - (start & (log_buf_len - 1)) |
f127e61e MD |
61 | : end - start) |
62 | ctf_sequence_text(char, msg2, | |
63 | log_buf, | |
64 | size_t, (start & (log_buf_len - 1)) > (end & (log_buf_len - 1)) | |
68ed2ee0 MD |
65 | ? end & (log_buf_len - 1) |
66 | : 0) | |
f127e61e | 67 | ) |
b87700e3 | 68 | ) |
68ed2ee0 MD |
69 | |
70 | #endif | |
71 | ||
3bc29f0a | 72 | #endif /* LTTNG_TRACE_PRINTK_H */ |
b87700e3 AG |
73 | |
74 | /* This part must be outside protection */ | |
6ec43db8 | 75 | #include <probes/define_trace.h> |