+struct trace_event {
+ const char *name;
+ int (*regfunc)(void *data);
+ int (*unregfunc)(void *data);
+};
+
+struct trace_event_lib {
+ struct trace_event * const *trace_events_start;
+ int trace_events_count;
+ struct cds_list_head list;
+};
+
+struct trace_event_iter {
+ struct trace_event_lib *lib;
+ struct trace_event * const *trace_event;
+};
+
+extern void lock_trace_events(void);
+extern void unlock_trace_events(void);
+
+extern void trace_event_iter_start(struct trace_event_iter *iter);
+extern void trace_event_iter_next(struct trace_event_iter *iter);
+extern void trace_event_iter_reset(struct trace_event_iter *iter);
+
+extern int trace_event_get_iter_range(struct trace_event * const **trace_event,
+ struct trace_event * const *begin,
+ struct trace_event * const *end);
+
+extern void trace_event_update_process(void);
+extern int is_trace_event_enabled(const char *channel, const char *name);
+
+extern int trace_event_register_lib(struct trace_event * const *start_trace_events,
+ int trace_event_count);
+
+extern int trace_event_unregister_lib(struct trace_event * const *start_trace_events);
+
+#define TRACE_EVENT_LIB \
+ extern struct trace_event * const __start___trace_events_ptrs[] \
+ __attribute__((weak, visibility("hidden"))); \
+ extern struct trace_event * const __stop___trace_events_ptrs[] \
+ __attribute__((weak, visibility("hidden"))); \
+ static void __attribute__((constructor)) \
+ __trace_events__init(void) \
+ { \
+ trace_event_register_lib(__start___trace_events_ptrs, \
+ __stop___trace_events_ptrs - \
+ __start___trace_events_ptrs); \
+ } \
+ \
+ static void __attribute__((destructor)) \
+ __trace_event__destroy(void) \
+ { \
+ trace_event_unregister_lib(__start___trace_events_ptrs);\
+ }
+