| 1 | /* |
| 2 | * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com> |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; |
| 7 | * version 2.1 of the License. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | * |
| 18 | * |
| 19 | * Trace files that want to automate creationg of all tracepoints defined |
| 20 | * in their file should include this file. The following are macros that the |
| 21 | * trace file may define: |
| 22 | * |
| 23 | * TRACE_SYSTEM defines the system the tracepoint is for |
| 24 | * |
| 25 | * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h |
| 26 | * This macro may be defined to tell define_trace.h what file to include. |
| 27 | * Note, leave off the ".h". |
| 28 | * |
| 29 | * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace |
| 30 | * then this macro can define the path to use. Note, the path is relative to |
| 31 | * define_trace.h, not the file including it. Full path names for out of tree |
| 32 | * modules must be used. |
| 33 | */ |
| 34 | |
| 35 | #ifdef TRACEPOINT_CREATE_PROBES |
| 36 | |
| 37 | /* Prevent recursion */ |
| 38 | #undef TRACEPOINT_CREATE_PROBES |
| 39 | |
| 40 | #include <ust/kcompat/stringify.h> |
| 41 | |
| 42 | #undef TRACEPOINT_EVENT |
| 43 | #define TRACEPOINT_EVENT(name, proto, args, fields) \ |
| 44 | _DEFINE_TRACEPOINT(name) |
| 45 | |
| 46 | #undef TRACEPOINT_EVENT_INSTANCE |
| 47 | #define TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) \ |
| 48 | _DEFINE_TRACEPOINT(name) |
| 49 | |
| 50 | #undef TRACEPOINT_EVENT_NOARGS |
| 51 | #define TRACEPOINT_EVENT_NOARGS(name, fields) \ |
| 52 | _DEFINE_TRACEPOINT(name) |
| 53 | |
| 54 | #undef TRACEPOINT_EVENT_INSTANCE_NOARGS |
| 55 | #define TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name) \ |
| 56 | _DEFINE_TRACEPOINT(name) |
| 57 | |
| 58 | #undef TRACE_INCLUDE |
| 59 | #undef __TRACE_INCLUDE |
| 60 | |
| 61 | #ifndef TRACE_INCLUDE_FILE |
| 62 | # define TRACE_INCLUDE_FILE TRACE_SYSTEM |
| 63 | # define UNDEF_TRACE_INCLUDE_FILE |
| 64 | #endif |
| 65 | |
| 66 | #ifndef TRACE_INCLUDE_PATH |
| 67 | # define __TRACE_INCLUDE(system) <trace/events/system.h> |
| 68 | # define UNDEF_TRACE_INCLUDE_PATH |
| 69 | #else |
| 70 | # define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h) |
| 71 | #endif |
| 72 | |
| 73 | # define TRACE_INCLUDE(system) __TRACE_INCLUDE(system) |
| 74 | |
| 75 | /* Let the trace headers be reread */ |
| 76 | #define TRACE_HEADER_MULTI_READ |
| 77 | |
| 78 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 79 | |
| 80 | #ifndef CONFIG_NO_EVENT_TRACING |
| 81 | #include <ust/ust_trace.h> |
| 82 | #endif |
| 83 | |
| 84 | #undef TRACEPOINT_EVENT |
| 85 | #undef TRACEPOINT_EVENT_CLASS |
| 86 | #undef TRACEPOINT_EVENT_INSTANCE |
| 87 | #undef TRACEPOINT_EVENT_NOARGS |
| 88 | #undef TRACEPOINT_EVENT_CLASS_NOARGS |
| 89 | #undef TRACEPOINT_EVENT_INSTANCE_NOARGS |
| 90 | #undef TRACE_HEADER_MULTI_READ |
| 91 | |
| 92 | /* Only undef what we defined in this file */ |
| 93 | #ifdef UNDEF_TRACE_INCLUDE_FILE |
| 94 | # undef TRACE_INCLUDE_FILE |
| 95 | # undef UNDEF_TRACE_INCLUDE_FILE |
| 96 | #endif |
| 97 | |
| 98 | #ifdef UNDEF_TRACE_INCLUDE_PATH |
| 99 | # undef TRACE_INCLUDE_PATH |
| 100 | # undef UNDEF_TRACE_INCLUDE_PATH |
| 101 | #endif |
| 102 | |
| 103 | /* We may be processing more files */ |
| 104 | #define TRACEPOINT_CREATE_PROBES |
| 105 | |
| 106 | #endif /* TRACEPOINT_CREATE_PROBES */ |