tracing/syscalls: Fix typo in SYSCALL_DEFINE0
[deliverable/linux.git] / kernel / trace / trace_export.c
CommitLineData
770cb243
SR
1/*
2 * trace_export.c - export basic ftrace utilities to user space
3 *
4 * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com>
5 */
6#include <linux/stringify.h>
7#include <linux/kallsyms.h>
8#include <linux/seq_file.h>
9#include <linux/debugfs.h>
10#include <linux/uaccess.h>
11#include <linux/ftrace.h>
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/fs.h>
15
16#include "trace_output.h"
17
4e5292ea
SR
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM ftrace
da4d0302 20
4e5292ea
SR
21/* not needed for this file */
22#undef __field_struct
23#define __field_struct(type, item)
da4d0302 24
05ffa2d0
LZ
25#undef __field
26#define __field(type, item) type item;
27
28#undef __field_desc
29#define __field_desc(type, container, item) type item;
30
31#undef __array
32#define __array(type, item, size) type item[size];
33
34#undef __array_desc
35#define __array_desc(type, container, item, size) type item[size];
36
37#undef __dynamic_array
38#define __dynamic_array(type, item) type item[];
39
40#undef F_STRUCT
41#define F_STRUCT(args...) args
42
43#undef F_printk
44#define F_printk(fmt, args...) fmt, args
45
46#undef FTRACE_ENTRY
47#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
48struct ____ftrace_##name { \
49 tstruct \
50}; \
5e9b3972 51static void __always_unused ____ftrace_check_##name(void) \
05ffa2d0
LZ
52{ \
53 struct ____ftrace_##name *__entry = NULL; \
54 \
5e9b3972 55 /* force compile-time check on F_printk() */ \
05ffa2d0
LZ
56 printk(print); \
57}
58
59#undef FTRACE_ENTRY_DUP
60#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \
61 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
62
63#include "trace_entries.h"
64
65
4e5292ea
SR
66#undef __field
67#define __field(type, item) \
68 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
26a50744 69 "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \
4e5292ea 70 offsetof(typeof(field), item), \
26a50744 71 sizeof(field.item), is_signed_type(type)); \
4e5292ea
SR
72 if (!ret) \
73 return 0;
75db37d2 74
4e5292ea
SR
75#undef __field_desc
76#define __field_desc(type, container, item) \
da4d0302 77 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
26a50744 78 "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \
4e5292ea 79 offsetof(typeof(field), container.item), \
26a50744
TZ
80 sizeof(field.container.item), \
81 is_signed_type(type)); \
da4d0302
SR
82 if (!ret) \
83 return 0;
84
4e5292ea
SR
85#undef __array
86#define __array(type, item, len) \
87 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
26a50744
TZ
88 "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \
89 offsetof(typeof(field), item), \
90 sizeof(field.item), is_signed_type(type)); \
4e5292ea
SR
91 if (!ret) \
92 return 0;
da4d0302 93
4e5292ea
SR
94#undef __array_desc
95#define __array_desc(type, container, item, len) \
96 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
26a50744 97 "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \
4e5292ea 98 offsetof(typeof(field), container.item), \
26a50744
TZ
99 sizeof(field.container.item), \
100 is_signed_type(type)); \
da4d0302
SR
101 if (!ret) \
102 return 0;
770cb243 103
4e5292ea
SR
104#undef __dynamic_array
105#define __dynamic_array(type, item) \
106 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
26a50744
TZ
107 "offset:%zu;\tsize:0;\tsigned:%u;\n", \
108 offsetof(typeof(field), item), \
109 is_signed_type(type)); \
156b5f17 110 if (!ret) \
770cb243
SR
111 return 0;
112
4e5292ea
SR
113#undef F_printk
114#define F_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
770cb243 115
4e5292ea
SR
116#undef __entry
117#define __entry REC
770cb243 118
4e5292ea
SR
119#undef FTRACE_ENTRY
120#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
770cb243 121static int \
4e5292ea
SR
122ftrace_format_##name(struct ftrace_event_call *unused, \
123 struct trace_seq *s) \
770cb243 124{ \
4e5292ea
SR
125 struct struct_name field __attribute__((unused)); \
126 int ret = 0; \
770cb243
SR
127 \
128 tstruct; \
129 \
4e5292ea 130 trace_seq_printf(s, "\nprint fmt: " print); \
770cb243
SR
131 \
132 return ret; \
133}
134
4e5292ea
SR
135#include "trace_entries.h"
136
4e5292ea
SR
137#undef __field
138#define __field(type, item) \
139 ret = trace_define_field(event_call, #type, #item, \
140 offsetof(typeof(field), item), \
141 sizeof(field.item), \
142 is_signed_type(type), FILTER_OTHER); \
143 if (ret) \
144 return ret;
145
146#undef __field_desc
147#define __field_desc(type, container, item) \
148 ret = trace_define_field(event_call, #type, #item, \
149 offsetof(typeof(field), \
150 container.item), \
151 sizeof(field.container.item), \
152 is_signed_type(type), FILTER_OTHER); \
153 if (ret) \
154 return ret;
155
156#undef __array
157#define __array(type, item, len) \
158 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
159 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
160 offsetof(typeof(field), item), \
161 sizeof(field.item), 0, FILTER_OTHER); \
162 if (ret) \
163 return ret;
164
165#undef __array_desc
166#define __array_desc(type, container, item, len) \
167 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
168 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
169 offsetof(typeof(field), \
170 container.item), \
171 sizeof(field.container.item), 0, \
172 FILTER_OTHER); \
173 if (ret) \
174 return ret;
175
176#undef __dynamic_array
177#define __dynamic_array(type, item)
178
179#undef FTRACE_ENTRY
180#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
181int \
182ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
e45f2e2b 183{ \
4e5292ea 184 struct struct_name field; \
e45f2e2b
TZ
185 int ret; \
186 \
4e5292ea 187 tstruct; \
e45f2e2b
TZ
188 \
189 return ret; \
190}
191
4e5292ea
SR
192#include "trace_entries.h"
193
d7a4b414
FW
194static int ftrace_raw_init_event(struct ftrace_event_call *call)
195{
196 INIT_LIST_HEAD(&call->fields);
197 return 0;
198}
4e5292ea
SR
199
200#undef __field
201#define __field(type, item)
202
203#undef __field_desc
204#define __field_desc(type, container, item)
205
206#undef __array
207#define __array(type, item, len)
208
209#undef __array_desc
210#define __array_desc(type, container, item, len)
211
212#undef __dynamic_array
213#define __dynamic_array(type, item)
214
4e5292ea
SR
215#undef FTRACE_ENTRY
216#define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \
770cb243 217 \
e1112b4d 218struct ftrace_event_call __used \
770cb243
SR
219__attribute__((__aligned__(4))) \
220__attribute__((section("_ftrace_events"))) event_##call = { \
ef18012b 221 .name = #call, \
4e5292ea 222 .id = type, \
770cb243 223 .system = __stringify(TRACE_SYSTEM), \
d7a4b414 224 .raw_init = ftrace_raw_init_event, \
770cb243 225 .show_format = ftrace_format_##call, \
e1112b4d
TZ
226 .define_fields = ftrace_define_fields_##call, \
227}; \
e1112b4d 228
4e5292ea 229#include "trace_entries.h"
This page took 0.078496 seconds and 5 git commands to generate.