-#undef DEFINE_EVENT_PRINT
-#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
- \
-static const char print_fmt_##call[] = print; \
- \
-static struct ftrace_event_call __used \
-__attribute__((__aligned__(4))) \
-__attribute__((section("_ftrace_events"))) event_##call = { \
- .name = #call, \
- .class = &event_class_##template, \
- .event.funcs = &ftrace_event_type_funcs_##call, \
- .print_fmt = print_fmt_##call, \
+#undef DECLARE_EVENT_CLASS
+#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
+static void __event_probe__##_name(void *__data, _proto) \
+{ \
+ struct ltt_event *__event = __data; \
+ struct ltt_channel *__chan = __event->chan; \
+ struct lib_ring_buffer_ctx __ctx; \
+ size_t __event_len, __event_align; \
+ size_t __dynamic_len_idx = 0; \
+ size_t __dynamic_len[ARRAY_SIZE(__event_fields___##_name)]; \
+ struct __event_typemap__##_name __typemap; \
+ int __ret; \
+ \
+ if (0) \
+ (void) __dynamic_len_idx; /* don't warn if unused */ \
+ if (unlikely(!ACCESS_ONCE(__chan->session->active))) \
+ return; \
+ if (unlikely(!ACCESS_ONCE(__chan->enabled))) \
+ return; \
+ if (unlikely(!ACCESS_ONCE(__event->enabled))) \
+ return; \
+ __event_len = __event_get_size__##_name(__dynamic_len, _args); \
+ __event_align = __event_get_align__##_name(_args); \
+ lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
+ __event_align, -1); \
+ __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
+ if (__ret < 0) \
+ return; \
+ /* Control code (field ordering) */ \
+ _tstruct \
+ __chan->ops->event_commit(&__ctx); \
+ return; \
+ /* Copy code, steered by control code */ \
+ _assign \
+}
+
+#undef DECLARE_EVENT_CLASS_NOARGS
+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
+static void __event_probe__##_name(void *__data) \
+{ \
+ struct ltt_event *__event = __data; \
+ struct ltt_channel *__chan = __event->chan; \
+ struct lib_ring_buffer_ctx __ctx; \
+ size_t __event_len, __event_align; \
+ int __ret; \
+ \
+ if (unlikely(!ACCESS_ONCE(__chan->session->active))) \
+ return; \
+ if (unlikely(!ACCESS_ONCE(__chan->enabled))) \
+ return; \
+ if (unlikely(!ACCESS_ONCE(__event->enabled))) \
+ return; \
+ __event_len = 0; \
+ __event_align = 1; \
+ lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
+ __event_align, -1); \
+ __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
+ if (__ret < 0) \
+ return; \
+ /* Control code (field ordering) */ \
+ _tstruct \
+ __chan->ops->event_commit(&__ctx); \
+ return; \
+ /* Copy code, steered by control code */ \
+ _assign \