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