2 * trace_export.c - export basic ftrace utilities to user space
4 * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com>
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>
16 #include "trace_output.h"
18 #include "trace_format.h"
20 #undef TRACE_FIELD_ZERO_CHAR
21 #define TRACE_FIELD_ZERO_CHAR(item) \
22 ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \
23 "offset:%u;\tsize:0;\n", \
24 (unsigned int)offsetof(typeof(field), item)); \
30 #define TP_RAW_FMT(args...) args
32 #undef TRACE_EVENT_FORMAT
33 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
35 ftrace_format_##call(struct trace_seq *s) \
42 trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt); \
47 #include "trace_event_types.h"
49 #undef TRACE_ZERO_CHAR
50 #define TRACE_ZERO_CHAR(arg)
53 #define TRACE_FIELD(type, item, assign)\
57 #define TRACE_FIELD(type, item, assign)\
61 #define TP_CMD(cmd...) cmd
64 #define TRACE_ENTRY entry
66 #undef TRACE_FIELD_SPECIAL
67 #define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
70 #undef TRACE_EVENT_FORMAT
71 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
73 static struct ftrace_event_call __used \
74 __attribute__((__aligned__(4))) \
75 __attribute__((section("_ftrace_events"))) event_##call = { \
78 .system = __stringify(TRACE_SYSTEM), \
79 .show_format = ftrace_format_##call, \
81 #include "trace_event_types.h"