• Home
  • Raw
  • Download

Lines Matching refs:show

382 	void (*showfn)(struct btf_show *show, const char *fmt, va_list args);
422 void (*show)(const struct btf *btf, const struct btf_type *t, member
424 struct btf_show *show);
908 static const char *btf_show_name(struct btf_show *show) in btf_show_name() argument
917 const struct btf_member *m = show->state.member; in btf_show_name()
920 u32 id = show->state.type_id; in btf_show_name()
926 show->state.name[0] = '\0'; in btf_show_name()
933 if (show->state.array_member) in btf_show_name()
938 member = btf_name_by_offset(show->btf, m->name_off); in btf_show_name()
950 t = btf_type_by_id(show->btf, id); in btf_show_name()
981 name = btf_name_by_offset(show->btf, in btf_show_name()
1008 t = btf_type_skip_qualifiers(show->btf, id); in btf_show_name()
1015 name = btf_name_by_offset(show->btf, t->name_off); in btf_show_name()
1045 if (show->flags & BTF_SHOW_NONAME) in btf_show_name()
1046 snprintf(show->state.name, sizeof(show->state.name), "%s", in btf_show_name()
1049 snprintf(show->state.name, sizeof(show->state.name), in btf_show_name()
1064 return show->state.name; in btf_show_name()
1067 static const char *__btf_show_indent(struct btf_show *show) in __btf_show_indent() argument
1072 if ((indent - show->state.depth) >= indents) in __btf_show_indent()
1073 return indent - show->state.depth; in __btf_show_indent()
1077 static const char *btf_show_indent(struct btf_show *show) in btf_show_indent() argument
1079 return show->flags & BTF_SHOW_COMPACT ? "" : __btf_show_indent(show); in btf_show_indent()
1082 static const char *btf_show_newline(struct btf_show *show) in btf_show_newline() argument
1084 return show->flags & BTF_SHOW_COMPACT ? "" : "\n"; in btf_show_newline()
1087 static const char *btf_show_delim(struct btf_show *show) in btf_show_delim() argument
1089 if (show->state.depth == 0) in btf_show_delim()
1092 if ((show->flags & BTF_SHOW_COMPACT) && show->state.type && in btf_show_delim()
1093 BTF_INFO_KIND(show->state.type->info) == BTF_KIND_UNION) in btf_show_delim()
1099 __printf(2, 3) static void btf_show(struct btf_show *show, const char *fmt, ...) in btf_show() argument
1103 if (!show->state.depth_check) { in btf_show()
1105 show->showfn(show, fmt, args); in btf_show()
1115 #define btf_show_type_value(show, fmt, value) \ argument
1118 (show->flags & BTF_SHOW_ZERO) || \
1119 show->state.depth == 0) { \
1120 btf_show(show, "%s%s" fmt "%s%s", \
1121 btf_show_indent(show), \
1122 btf_show_name(show), \
1123 value, btf_show_delim(show), \
1124 btf_show_newline(show)); \
1125 if (show->state.depth > show->state.depth_to_show) \
1126 show->state.depth_to_show = show->state.depth; \
1130 #define btf_show_type_values(show, fmt, ...) \ argument
1132 btf_show(show, "%s%s" fmt "%s%s", btf_show_indent(show), \
1133 btf_show_name(show), \
1134 __VA_ARGS__, btf_show_delim(show), \
1135 btf_show_newline(show)); \
1136 if (show->state.depth > show->state.depth_to_show) \
1137 show->state.depth_to_show = show->state.depth; \
1141 static int btf_show_obj_size_left(struct btf_show *show, void *data) in btf_show_obj_size_left() argument
1143 return show->obj.head + show->obj.size - data; in btf_show_obj_size_left()
1147 static bool btf_show_obj_is_safe(struct btf_show *show, void *data, int size) in btf_show_obj_is_safe() argument
1149 return data >= show->obj.data && in btf_show_obj_is_safe()
1150 (data + size) < (show->obj.data + BTF_SHOW_OBJ_SAFE_SIZE); in btf_show_obj_is_safe()
1159 static void *__btf_show_obj_safe(struct btf_show *show, void *data, int size) in __btf_show_obj_safe() argument
1161 if (btf_show_obj_is_safe(show, data, size)) in __btf_show_obj_safe()
1162 return show->obj.safe + (data - show->obj.data); in __btf_show_obj_safe()
1194 static void *btf_show_obj_safe(struct btf_show *show, in btf_show_obj_safe() argument
1202 if (show->flags & BTF_SHOW_UNSAFE) in btf_show_obj_safe()
1205 rt = btf_resolve_size(show->btf, t, &size); in btf_show_obj_safe()
1207 show->state.status = PTR_ERR(rt); in btf_show_obj_safe()
1216 if (show->state.depth == 0) { in btf_show_obj_safe()
1217 show->obj.size = size; in btf_show_obj_safe()
1218 show->obj.head = data; in btf_show_obj_safe()
1241 safe = __btf_show_obj_safe(show, data, in btf_show_obj_safe()
1252 size_left = btf_show_obj_size_left(show, data); in btf_show_obj_safe()
1255 show->state.status = copy_from_kernel_nofault(show->obj.safe, in btf_show_obj_safe()
1257 if (!show->state.status) { in btf_show_obj_safe()
1258 show->obj.data = data; in btf_show_obj_safe()
1259 safe = show->obj.safe; in btf_show_obj_safe()
1270 static void *btf_show_start_type(struct btf_show *show, in btf_show_start_type() argument
1274 show->state.type = t; in btf_show_start_type()
1275 show->state.type_id = type_id; in btf_show_start_type()
1276 show->state.name[0] = '\0'; in btf_show_start_type()
1278 return btf_show_obj_safe(show, t, data); in btf_show_start_type()
1281 static void btf_show_end_type(struct btf_show *show) in btf_show_end_type() argument
1283 show->state.type = NULL; in btf_show_end_type()
1284 show->state.type_id = 0; in btf_show_end_type()
1285 show->state.name[0] = '\0'; in btf_show_end_type()
1288 static void *btf_show_start_aggr_type(struct btf_show *show, in btf_show_start_aggr_type() argument
1292 void *safe_data = btf_show_start_type(show, t, type_id, data); in btf_show_start_aggr_type()
1297 btf_show(show, "%s%s%s", btf_show_indent(show), in btf_show_start_aggr_type()
1298 btf_show_name(show), in btf_show_start_aggr_type()
1299 btf_show_newline(show)); in btf_show_start_aggr_type()
1300 show->state.depth++; in btf_show_start_aggr_type()
1304 static void btf_show_end_aggr_type(struct btf_show *show, in btf_show_end_aggr_type() argument
1307 show->state.depth--; in btf_show_end_aggr_type()
1308 btf_show(show, "%s%s%s%s", btf_show_indent(show), suffix, in btf_show_end_aggr_type()
1309 btf_show_delim(show), btf_show_newline(show)); in btf_show_end_aggr_type()
1310 btf_show_end_type(show); in btf_show_end_aggr_type()
1313 static void btf_show_start_member(struct btf_show *show, in btf_show_start_member() argument
1316 show->state.member = m; in btf_show_start_member()
1319 static void btf_show_start_array_member(struct btf_show *show) in btf_show_start_array_member() argument
1321 show->state.array_member = 1; in btf_show_start_array_member()
1322 btf_show_start_member(show, NULL); in btf_show_start_array_member()
1325 static void btf_show_end_member(struct btf_show *show) in btf_show_end_member() argument
1327 show->state.member = NULL; in btf_show_end_member()
1330 static void btf_show_end_array_member(struct btf_show *show) in btf_show_end_array_member() argument
1332 show->state.array_member = 0; in btf_show_end_array_member()
1333 btf_show_end_member(show); in btf_show_end_array_member()
1336 static void *btf_show_start_array_type(struct btf_show *show, in btf_show_start_array_type() argument
1342 show->state.array_encoding = array_encoding; in btf_show_start_array_type()
1343 show->state.array_terminated = 0; in btf_show_start_array_type()
1344 return btf_show_start_aggr_type(show, t, type_id, data); in btf_show_start_array_type()
1347 static void btf_show_end_array_type(struct btf_show *show) in btf_show_end_array_type() argument
1349 show->state.array_encoding = 0; in btf_show_end_array_type()
1350 show->state.array_terminated = 0; in btf_show_end_array_type()
1351 btf_show_end_aggr_type(show, "]"); in btf_show_end_array_type()
1354 static void *btf_show_start_struct_type(struct btf_show *show, in btf_show_start_struct_type() argument
1359 return btf_show_start_aggr_type(show, t, type_id, data); in btf_show_start_struct_type()
1362 static void btf_show_end_struct_type(struct btf_show *show) in btf_show_end_struct_type() argument
1364 btf_show_end_aggr_type(show, "}"); in btf_show_end_struct_type()
2032 struct btf_show *show) in btf_df_show() argument
2034 btf_show(show, "<unsupported kind:%u>", BTF_INFO_KIND(t->info)); in btf_df_show()
2207 static void btf_int128_print(struct btf_show *show, void *data) in btf_int128_print() argument
2226 btf_show_type_value(show, "0x%llx", lower_num); in btf_int128_print()
2228 btf_show_type_values(show, "0x%llx%016llx", upper_num, in btf_int128_print()
2274 u8 nr_bits, struct btf_show *show) in btf_bitfield_show() argument
2294 btf_int128_print(show, print_num); in btf_bitfield_show()
2301 struct btf_show *show) in btf_int_bits_show() argument
2314 btf_bitfield_show(data, bits_offset, nr_bits, show); in btf_int_bits_show()
2319 struct btf_show *show) in btf_int_show() argument
2327 safe_data = btf_show_start_type(show, t, type_id, data); in btf_int_show()
2333 btf_int_bits_show(btf, t, safe_data, bits_offset, show); in btf_int_show()
2339 btf_int128_print(show, safe_data); in btf_int_show()
2343 btf_show_type_value(show, "%lld", *(s64 *)safe_data); in btf_int_show()
2345 btf_show_type_value(show, "%llu", *(u64 *)safe_data); in btf_int_show()
2349 btf_show_type_value(show, "%d", *(s32 *)safe_data); in btf_int_show()
2351 btf_show_type_value(show, "%u", *(u32 *)safe_data); in btf_int_show()
2355 btf_show_type_value(show, "%d", *(s16 *)safe_data); in btf_int_show()
2357 btf_show_type_value(show, "%u", *(u16 *)safe_data); in btf_int_show()
2360 if (show->state.array_encoding == BTF_INT_CHAR) { in btf_int_show()
2362 if (show->state.array_terminated) in btf_int_show()
2365 show->state.array_terminated = 1; in btf_int_show()
2369 btf_show_type_value(show, "'%c'", in btf_int_show()
2375 btf_show_type_value(show, "%d", *(s8 *)safe_data); in btf_int_show()
2377 btf_show_type_value(show, "%u", *(u8 *)safe_data); in btf_int_show()
2380 btf_int_bits_show(btf, t, safe_data, bits_offset, show); in btf_int_show()
2384 btf_show_end_type(show); in btf_int_show()
2393 .show = btf_int_show,
2668 u8 bits_offset, struct btf_show *show) in btf_modifier_show() argument
2675 btf_type_ops(t)->show(btf, t, type_id, data, bits_offset, show); in btf_modifier_show()
2680 struct btf_show *show) in btf_var_show() argument
2684 btf_type_ops(t)->show(btf, t, type_id, data, bits_offset, show); in btf_var_show()
2689 struct btf_show *show) in btf_ptr_show() argument
2693 safe_data = btf_show_start_type(show, t, type_id, data); in btf_ptr_show()
2698 if (show->flags & BTF_SHOW_PTR_RAW) in btf_ptr_show()
2699 btf_show_type_value(show, "0x%px", *(void **)safe_data); in btf_ptr_show()
2701 btf_show_type_value(show, "0x%p", *(void **)safe_data); in btf_ptr_show()
2702 btf_show_end_type(show); in btf_ptr_show()
2717 .show = btf_modifier_show,
2726 .show = btf_ptr_show,
2767 .show = btf_df_show,
2928 struct btf_show *show) in __btf_array_show() argument
2955 if (!btf_show_start_array_type(show, t, type_id, encoding, data)) in __btf_array_show()
2964 btf_show_start_array_member(show); in __btf_array_show()
2966 elem_ops->show(btf, elem_type, elem_type_id, data, in __btf_array_show()
2967 bits_offset, show); in __btf_array_show()
2970 btf_show_end_array_member(show); in __btf_array_show()
2972 if (show->state.array_terminated) in __btf_array_show()
2976 btf_show_end_array_type(show); in __btf_array_show()
2981 struct btf_show *show) in btf_array_show() argument
2983 const struct btf_member *m = show->state.member; in btf_array_show()
2990 if (show->state.depth > 0 && !(show->flags & BTF_SHOW_ZERO)) { in btf_array_show()
2991 if (!show->state.depth_check) { in btf_array_show()
2992 show->state.depth_check = show->state.depth + 1; in btf_array_show()
2993 show->state.depth_to_show = 0; in btf_array_show()
2995 __btf_array_show(btf, t, type_id, data, bits_offset, show); in btf_array_show()
2996 show->state.member = m; in btf_array_show()
2998 if (show->state.depth_check != show->state.depth + 1) in btf_array_show()
3000 show->state.depth_check = 0; in btf_array_show()
3002 if (show->state.depth_to_show <= show->state.depth) in btf_array_show()
3009 __btf_array_show(btf, t, type_id, data, bits_offset, show); in btf_array_show()
3018 .show = btf_array_show,
3537 struct btf_show *show) in __btf_struct_show() argument
3543 safe_data = btf_show_start_struct_type(show, t, type_id, data); in __btf_struct_show()
3555 btf_show_start_member(show, member); in __btf_struct_show()
3562 safe_data = btf_show_start_type(show, member_type, in __btf_struct_show()
3568 bitfield_size, show); in __btf_struct_show()
3569 btf_show_end_type(show); in __btf_struct_show()
3572 ops->show(btf, member_type, member->type, in __btf_struct_show()
3573 data + bytes_offset, bits8_offset, show); in __btf_struct_show()
3576 btf_show_end_member(show); in __btf_struct_show()
3579 btf_show_end_struct_type(show); in __btf_struct_show()
3584 struct btf_show *show) in btf_struct_show() argument
3586 const struct btf_member *m = show->state.member; in btf_struct_show()
3593 if (show->state.depth > 0 && !(show->flags & BTF_SHOW_ZERO)) { in btf_struct_show()
3594 if (!show->state.depth_check) { in btf_struct_show()
3595 show->state.depth_check = show->state.depth + 1; in btf_struct_show()
3596 show->state.depth_to_show = 0; in btf_struct_show()
3598 __btf_struct_show(btf, t, type_id, data, bits_offset, show); in btf_struct_show()
3600 show->state.member = m; in btf_struct_show()
3601 if (show->state.depth_check != show->state.depth + 1) in btf_struct_show()
3603 show->state.depth_check = 0; in btf_struct_show()
3605 if (show->state.depth_to_show <= show->state.depth) in btf_struct_show()
3613 __btf_struct_show(btf, t, type_id, data, bits_offset, show); in btf_struct_show()
3622 .show = btf_struct_show,
3752 struct btf_show *show) in btf_enum_show() argument
3759 safe_data = btf_show_start_type(show, t, type_id, data); in btf_enum_show()
3769 btf_show_type_value(show, "%s", in btf_enum_show()
3773 btf_show_end_type(show); in btf_enum_show()
3778 btf_show_type_value(show, "%d", v); in btf_enum_show()
3780 btf_show_type_value(show, "%u", v); in btf_enum_show()
3781 btf_show_end_type(show); in btf_enum_show()
3790 .show = btf_enum_show,
3855 struct btf_show *show) in btf_enum64_show() argument
3862 safe_data = btf_show_start_type(show, t, type_id, data); in btf_enum64_show()
3872 btf_show_type_value(show, "%s", in btf_enum64_show()
3876 btf_show_end_type(show); in btf_enum64_show()
3881 btf_show_type_value(show, "%lld", v); in btf_enum64_show()
3883 btf_show_type_value(show, "%llu", v); in btf_enum64_show()
3884 btf_show_end_type(show); in btf_enum64_show()
3893 .show = btf_enum64_show,
3980 .show = btf_df_show,
4029 .show = btf_df_show,
4093 .show = btf_var_show,
4218 struct btf_show *show) in btf_datasec_show() argument
4224 if (!btf_show_start_type(show, t, type_id, data)) in btf_datasec_show()
4227 btf_show_type_value(show, "section (\"%s\") = {", in btf_datasec_show()
4232 btf_show(show, ","); in btf_datasec_show()
4233 btf_type_ops(var)->show(btf, var, vsi->type, in btf_datasec_show()
4234 data + vsi->offset, bits_offset, show); in btf_datasec_show()
4236 btf_show_end_type(show); in btf_datasec_show()
4245 .show = btf_datasec_show,
4320 .show = btf_df_show,
4424 .show = btf_df_show,
6798 struct btf_show *show) in btf_type_show() argument
6802 show->btf = btf; in btf_type_show()
6803 memset(&show->state, 0, sizeof(show->state)); in btf_type_show()
6804 memset(&show->obj, 0, sizeof(show->obj)); in btf_type_show()
6806 btf_type_ops(t)->show(btf, t, type_id, obj, 0, show); in btf_type_show()
6809 static void btf_seq_show(struct btf_show *show, const char *fmt, in btf_seq_show() argument
6812 seq_vprintf((struct seq_file *)show->target, fmt, args); in btf_seq_show()
6838 struct btf_show show; member
6843 static void btf_snprintf_show(struct btf_show *show, const char *fmt, in btf_snprintf_show() argument
6846 struct btf_show_snprintf *ssnprintf = (struct btf_show_snprintf *)show; in btf_snprintf_show()
6849 len = vsnprintf(show->target, ssnprintf->len_left, fmt, args); in btf_snprintf_show()
6861 show->target += len; in btf_snprintf_show()
6870 ssnprintf.show.target = buf; in btf_type_snprintf_show()
6871 ssnprintf.show.flags = flags; in btf_type_snprintf_show()
6872 ssnprintf.show.showfn = btf_snprintf_show; in btf_type_snprintf_show()
6879 if (ssnprintf.show.state.status) in btf_type_snprintf_show()
6880 return ssnprintf.show.state.status; in btf_type_snprintf_show()