1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 /* Stage 4 definitions for creating trace events */ 4 5 #define ALIGN_STRUCTFIELD(type) ((int)(__alignof__(struct {type b;}))) 6 7 #undef __field_ext 8 #define __field_ext(_type, _item, _filter_type) { \ 9 .type = #_type, .name = #_item, \ 10 .size = sizeof(_type), .align = ALIGN_STRUCTFIELD(_type), \ 11 .is_signed = is_signed_type(_type), .filter_type = _filter_type }, 12 13 #undef __field_struct_ext 14 #define __field_struct_ext(_type, _item, _filter_type) { \ 15 .type = #_type, .name = #_item, \ 16 .size = sizeof(_type), .align = ALIGN_STRUCTFIELD(_type), \ 17 0, .filter_type = _filter_type }, 18 19 #undef __field 20 #define __field(type, item) __field_ext(type, item, FILTER_OTHER) 21 22 #undef __field_struct 23 #define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER) 24 25 #undef __array 26 #define __array(_type, _item, _len) { \ 27 .type = #_type"["__stringify(_len)"]", .name = #_item, \ 28 .size = sizeof(_type[_len]), .align = ALIGN_STRUCTFIELD(_type), \ 29 .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER,\ 30 .len = _len }, 31 32 #undef __dynamic_array 33 #define __dynamic_array(_type, _item, _len) { \ 34 .type = "__data_loc " #_type "[]", .name = #_item, \ 35 .size = 4, .align = 4, \ 36 .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER }, 37 38 #undef __string 39 #define __string(item, src) __dynamic_array(char, item, -1) 40 41 #undef __string_len 42 #define __string_len(item, src, len) __dynamic_array(char, item, -1) 43 44 #undef __vstring 45 #define __vstring(item, fmt, ap) __dynamic_array(char, item, -1) 46 47 #undef __bitmask 48 #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) 49 50 #undef __cpumask 51 #define __cpumask(item) { \ 52 .type = "__data_loc cpumask_t", .name = #item, \ 53 .size = 4, .align = 4, \ 54 .is_signed = 0, .filter_type = FILTER_OTHER }, 55 56 #undef __sockaddr 57 #define __sockaddr(field, len) __dynamic_array(u8, field, len) 58 59 #undef __rel_dynamic_array 60 #define __rel_dynamic_array(_type, _item, _len) { \ 61 .type = "__rel_loc " #_type "[]", .name = #_item, \ 62 .size = 4, .align = 4, \ 63 .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER }, 64 65 #undef __rel_string 66 #define __rel_string(item, src) __rel_dynamic_array(char, item, -1) 67 68 #undef __rel_string_len 69 #define __rel_string_len(item, src, len) __rel_dynamic_array(char, item, -1) 70 71 #undef __rel_bitmask 72 #define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, item, -1) 73 74 #undef __rel_cpumask 75 #define __rel_cpumask(item) { \ 76 .type = "__rel_loc cpumask_t", .name = #item, \ 77 .size = 4, .align = 4, \ 78 .is_signed = 0, .filter_type = FILTER_OTHER }, 79 80 #undef __rel_sockaddr 81 #define __rel_sockaddr(field, len) __rel_dynamic_array(u8, field, len) 82