1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_TRACE_H 3 #define _LINUX_TRACE_H 4 5 #ifdef CONFIG_TRACING 6 7 #define TRACE_EXPORT_FUNCTION BIT(0) 8 #define TRACE_EXPORT_EVENT BIT(1) 9 10 /* 11 * The trace export - an export of Ftrace output. The trace_export 12 * can process traces and export them to a registered destination as 13 * an addition to the current only output of Ftrace - i.e. ring buffer. 14 * 15 * If you want traces to be sent to some other place rather than ring 16 * buffer only, just need to register a new trace_export and implement 17 * its own .write() function for writing traces to the storage. 18 * 19 * next - pointer to the next trace_export 20 * write - copy traces which have been delt with ->commit() to 21 * the destination 22 * flags - which ftrace to be exported 23 */ 24 struct trace_export { 25 struct trace_export __rcu *next; 26 void (*write)(struct trace_export *, const void *, unsigned int); 27 int flags; 28 }; 29 30 int register_ftrace_export(struct trace_export *export); 31 int unregister_ftrace_export(struct trace_export *export); 32 33 struct trace_array; 34 35 void trace_printk_init_buffers(void); 36 int trace_array_printk(struct trace_array *tr, unsigned long ip, 37 const char *fmt, ...); 38 int trace_array_init_printk(struct trace_array *tr); 39 void trace_array_put(struct trace_array *tr); 40 struct trace_array *trace_array_get_by_name(const char *name); 41 int trace_array_destroy(struct trace_array *tr); 42 #endif /* CONFIG_TRACING */ 43 44 #endif /* _LINUX_TRACE_H */ 45