|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | + |
| 3 | +/* Stage 3 definitions for creating trace events */ |
| 4 | + |
| 5 | +#undef __entry |
| 6 | +#define __entry field |
| 7 | + |
| 8 | +#undef TP_printk |
| 9 | +#define TP_printk(fmt, args...) fmt "\n", args |
| 10 | + |
| 11 | +#undef __get_dynamic_array |
| 12 | +#define __get_dynamic_array(field) \ |
| 13 | + ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) |
| 14 | + |
| 15 | +#undef __get_dynamic_array_len |
| 16 | +#define __get_dynamic_array_len(field) \ |
| 17 | + ((__entry->__data_loc_##field >> 16) & 0xffff) |
| 18 | + |
| 19 | +#undef __get_str |
| 20 | +#define __get_str(field) ((char *)__get_dynamic_array(field)) |
| 21 | + |
| 22 | +#undef __get_rel_dynamic_array |
| 23 | +#define __get_rel_dynamic_array(field) \ |
| 24 | + ((void *)__entry + \ |
| 25 | + offsetof(typeof(*__entry), __rel_loc_##field) + \ |
| 26 | + sizeof(__entry->__rel_loc_##field) + \ |
| 27 | + (__entry->__rel_loc_##field & 0xffff)) |
| 28 | + |
| 29 | +#undef __get_rel_dynamic_array_len |
| 30 | +#define __get_rel_dynamic_array_len(field) \ |
| 31 | + ((__entry->__rel_loc_##field >> 16) & 0xffff) |
| 32 | + |
| 33 | +#undef __get_rel_str |
| 34 | +#define __get_rel_str(field) ((char *)__get_rel_dynamic_array(field)) |
| 35 | + |
| 36 | +#undef __get_bitmask |
| 37 | +#define __get_bitmask(field) \ |
| 38 | + ({ \ |
| 39 | + void *__bitmask = __get_dynamic_array(field); \ |
| 40 | + unsigned int __bitmask_size; \ |
| 41 | + __bitmask_size = __get_dynamic_array_len(field); \ |
| 42 | + trace_print_bitmask_seq(p, __bitmask, __bitmask_size); \ |
| 43 | + }) |
| 44 | + |
| 45 | +#undef __get_rel_bitmask |
| 46 | +#define __get_rel_bitmask(field) \ |
| 47 | + ({ \ |
| 48 | + void *__bitmask = __get_rel_dynamic_array(field); \ |
| 49 | + unsigned int __bitmask_size; \ |
| 50 | + __bitmask_size = __get_rel_dynamic_array_len(field); \ |
| 51 | + trace_print_bitmask_seq(p, __bitmask, __bitmask_size); \ |
| 52 | + }) |
| 53 | + |
| 54 | +#undef __print_flags |
| 55 | +#define __print_flags(flag, delim, flag_array...) \ |
| 56 | + ({ \ |
| 57 | + static const struct trace_print_flags __flags[] = \ |
| 58 | + { flag_array, { -1, NULL }}; \ |
| 59 | + trace_print_flags_seq(p, delim, flag, __flags); \ |
| 60 | + }) |
| 61 | + |
| 62 | +#undef __print_symbolic |
| 63 | +#define __print_symbolic(value, symbol_array...) \ |
| 64 | + ({ \ |
| 65 | + static const struct trace_print_flags symbols[] = \ |
| 66 | + { symbol_array, { -1, NULL }}; \ |
| 67 | + trace_print_symbols_seq(p, value, symbols); \ |
| 68 | + }) |
| 69 | + |
| 70 | +#undef __print_flags_u64 |
| 71 | +#undef __print_symbolic_u64 |
| 72 | +#if BITS_PER_LONG == 32 |
| 73 | +#define __print_flags_u64(flag, delim, flag_array...) \ |
| 74 | + ({ \ |
| 75 | + static const struct trace_print_flags_u64 __flags[] = \ |
| 76 | + { flag_array, { -1, NULL } }; \ |
| 77 | + trace_print_flags_seq_u64(p, delim, flag, __flags); \ |
| 78 | + }) |
| 79 | + |
| 80 | +#define __print_symbolic_u64(value, symbol_array...) \ |
| 81 | + ({ \ |
| 82 | + static const struct trace_print_flags_u64 symbols[] = \ |
| 83 | + { symbol_array, { -1, NULL } }; \ |
| 84 | + trace_print_symbols_seq_u64(p, value, symbols); \ |
| 85 | + }) |
| 86 | +#else |
| 87 | +#define __print_flags_u64(flag, delim, flag_array...) \ |
| 88 | + __print_flags(flag, delim, flag_array) |
| 89 | + |
| 90 | +#define __print_symbolic_u64(value, symbol_array...) \ |
| 91 | + __print_symbolic(value, symbol_array) |
| 92 | +#endif |
| 93 | + |
| 94 | +#undef __print_hex |
| 95 | +#define __print_hex(buf, buf_len) \ |
| 96 | + trace_print_hex_seq(p, buf, buf_len, false) |
| 97 | + |
| 98 | +#undef __print_hex_str |
| 99 | +#define __print_hex_str(buf, buf_len) \ |
| 100 | + trace_print_hex_seq(p, buf, buf_len, true) |
| 101 | + |
| 102 | +#undef __print_array |
| 103 | +#define __print_array(array, count, el_size) \ |
| 104 | + ({ \ |
| 105 | + BUILD_BUG_ON(el_size != 1 && el_size != 2 && \ |
| 106 | + el_size != 4 && el_size != 8); \ |
| 107 | + trace_print_array_seq(p, array, count, el_size); \ |
| 108 | + }) |
| 109 | + |
| 110 | +#undef __print_hex_dump |
| 111 | +#define __print_hex_dump(prefix_str, prefix_type, \ |
| 112 | + rowsize, groupsize, buf, len, ascii) \ |
| 113 | + trace_print_hex_dump_seq(p, prefix_str, prefix_type, \ |
| 114 | + rowsize, groupsize, buf, len, ascii) |
| 115 | + |
| 116 | +#undef __print_ns_to_secs |
| 117 | +#define __print_ns_to_secs(value) \ |
| 118 | + ({ \ |
| 119 | + u64 ____val = (u64)(value); \ |
| 120 | + do_div(____val, NSEC_PER_SEC); \ |
| 121 | + ____val; \ |
| 122 | + }) |
| 123 | + |
| 124 | +#undef __print_ns_without_secs |
| 125 | +#define __print_ns_without_secs(value) \ |
| 126 | + ({ \ |
| 127 | + u64 ____val = (u64)(value); \ |
| 128 | + (u32) do_div(____val, NSEC_PER_SEC); \ |
| 129 | + }) |
0 commit comments