Cleanup: Move lttng-modules instrumentation headers
[lttng-modules.git] / include / instrumentation / events / printk.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM printk
4
5 #if !defined(LTTNG_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_PRINTK_H
7
8 #include <lttng/tracepoint-event.h>
9 #include <linux/version.h>
10
11 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
12
13 LTTNG_TRACEPOINT_EVENT_MAP(console,
14
15 printk_console,
16
17 TP_PROTO(const char *text, size_t len),
18
19 TP_ARGS(text, len),
20
21 TP_FIELDS(
22 ctf_sequence_text(char, msg, text, size_t, len)
23 )
24 )
25
26 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
27
28 LTTNG_TRACEPOINT_EVENT_MAP(console,
29
30 printk_console,
31
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
37 TP_FIELDS(
38 ctf_sequence_text(char, msg, log_buf + start,
39 size_t, end - start)
40 )
41 )
42
43 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
44
45 LTTNG_TRACEPOINT_EVENT_MAP(console,
46
47 printk_console,
48
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
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))
61 ? log_buf_len - (start & (log_buf_len - 1))
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))
66 ? end & (log_buf_len - 1)
67 : 0)
68 )
69 )
70
71 #endif
72
73 #endif /* LTTNG_TRACE_PRINTK_H */
74
75 /* This part must be outside protection */
76 #include <lttng/define_trace.h>
This page took 0.030137 seconds and 4 git commands to generate.