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