1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_TRACE_H 2 #ifndef _LINUX_TRACE_H 3 #define _LINUX_TRACE_H 3 #define _LINUX_TRACE_H 4 4 5 #define TRACE_EXPORT_FUNCTION BIT(0) !! 5 #ifdef CONFIG_TRACING 6 #define TRACE_EXPORT_EVENT BIT(1) << 7 #define TRACE_EXPORT_MARKER BIT(2) << 8 << 9 /* 6 /* 10 * The trace export - an export of Ftrace outp 7 * The trace export - an export of Ftrace output. The trace_export 11 * can process traces and export them to a reg 8 * can process traces and export them to a registered destination as 12 * an addition to the current only output of F 9 * an addition to the current only output of Ftrace - i.e. ring buffer. 13 * 10 * 14 * If you want traces to be sent to some other 11 * If you want traces to be sent to some other place rather than ring 15 * buffer only, just need to register a new tr 12 * buffer only, just need to register a new trace_export and implement 16 * its own .write() function for writing trace 13 * its own .write() function for writing traces to the storage. 17 * 14 * 18 * next - pointer to the next trace_ex 15 * next - pointer to the next trace_export 19 * write - copy traces which have been 16 * write - copy traces which have been delt with ->commit() to 20 * the destination 17 * the destination 21 * flags - which ftrace to be exported << 22 */ 18 */ 23 struct trace_export { 19 struct trace_export { 24 struct trace_export __rcu *next; 20 struct trace_export __rcu *next; 25 void (*write)(struct trace_export *, c 21 void (*write)(struct trace_export *, const void *, unsigned int); 26 int flags; << 27 }; 22 }; 28 23 29 struct trace_array; << 30 << 31 #ifdef CONFIG_TRACING << 32 << 33 int register_ftrace_export(struct trace_export 24 int register_ftrace_export(struct trace_export *export); 34 int unregister_ftrace_export(struct trace_expo 25 int unregister_ftrace_export(struct trace_export *export); 35 26 36 /** !! 27 struct trace_array; 37 * trace_array_puts - write a constant string << 38 * @tr: The trace array to write to << 39 * @str: The constant string to write << 40 */ << 41 #define trace_array_puts(tr, str) << 42 ({ << 43 str ? __trace_array_puts(tr, _ << 44 }) << 45 int __trace_array_puts(struct trace_array *tr, << 46 const char *str, int si << 47 28 48 void trace_printk_init_buffers(void); 29 void trace_printk_init_buffers(void); 49 __printf(3, 4) << 50 int trace_array_printk(struct trace_array *tr, 30 int trace_array_printk(struct trace_array *tr, unsigned long ip, 51 const char *fmt, ...); !! 31 const char *fmt, ...); 52 int trace_array_init_printk(struct trace_array 32 int trace_array_init_printk(struct trace_array *tr); 53 void trace_array_put(struct trace_array *tr); 33 void trace_array_put(struct trace_array *tr); 54 struct trace_array *trace_array_get_by_name(co !! 34 struct trace_array *trace_array_get_by_name(const char *name); 55 int trace_array_destroy(struct trace_array *tr 35 int trace_array_destroy(struct trace_array *tr); 56 << 57 /* For osnoise tracer */ << 58 int osnoise_arch_register(void); << 59 void osnoise_arch_unregister(void); << 60 void osnoise_trace_irq_entry(int id); << 61 void osnoise_trace_irq_exit(int id, const char << 62 << 63 #else /* CONFIG_TRACING */ << 64 static inline int register_ftrace_export(struc << 65 { << 66 return -EINVAL; << 67 } << 68 static inline int unregister_ftrace_export(str << 69 { << 70 return 0; << 71 } << 72 static inline void trace_printk_init_buffers(v << 73 { << 74 } << 75 static inline int trace_array_printk(struct tr << 76 const cha << 77 { << 78 return 0; << 79 } << 80 static inline int trace_array_init_printk(stru << 81 { << 82 return -EINVAL; << 83 } << 84 static inline void trace_array_put(struct trac << 85 { << 86 } << 87 static inline struct trace_array *trace_array_ << 88 { << 89 return NULL; << 90 } << 91 static inline int trace_array_destroy(struct t << 92 { << 93 return 0; << 94 } << 95 #endif /* CONFIG_TRACING */ 36 #endif /* CONFIG_TRACING */ 96 37 97 #endif /* _LINUX_TRACE_H */ 38 #endif /* _LINUX_TRACE_H */ 98 39
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.