Lines Matching +full:standard +full:- +full:vt
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
127 jsonw_string_field(w, "name", btf_str(btf, t->name_off)); in dump_btf_type()
130 btf_str(btf, t->name_off)); in dump_btf_type()
141 jsonw_uint_field(w, "size", t->size); in dump_btf_type()
147 t->size, BTF_INT_OFFSET(v), BTF_INT_BITS(v), in dump_btf_type()
159 jsonw_uint_field(w, "type_id", t->type); in dump_btf_type()
161 printf(" type_id=%u", t->type); in dump_btf_type()
167 jsonw_uint_field(w, "type_id", arr->type); in dump_btf_type()
168 jsonw_uint_field(w, "index_type_id", arr->index_type); in dump_btf_type()
169 jsonw_uint_field(w, "nr_elems", arr->nelems); in dump_btf_type()
172 arr->type, arr->index_type, arr->nelems); in dump_btf_type()
179 __u16 vlen = BTF_INFO_VLEN(t->info); in dump_btf_type()
183 jsonw_uint_field(w, "size", t->size); in dump_btf_type()
188 printf(" size=%u vlen=%u", t->size, vlen); in dump_btf_type()
191 const char *name = btf_str(btf, m->name_off); in dump_btf_type()
194 if (BTF_INFO_KFLAG(t->info)) { in dump_btf_type()
195 bit_off = BTF_MEMBER_BIT_OFFSET(m->offset); in dump_btf_type()
196 bit_sz = BTF_MEMBER_BITFIELD_SIZE(m->offset); in dump_btf_type()
198 bit_off = m->offset; in dump_btf_type()
205 jsonw_uint_field(w, "type_id", m->type); in dump_btf_type()
214 name, m->type, bit_off); in dump_btf_type()
225 __u16 vlen = BTF_INFO_VLEN(t->info); in dump_btf_type()
232 jsonw_uint_field(w, "size", t->size); in dump_btf_type()
237 printf(" encoding=%s size=%u vlen=%u", encoding, t->size, vlen); in dump_btf_type()
240 const char *name = btf_str(btf, v->name_off); in dump_btf_type()
246 jsonw_int_field(w, "val", v->val); in dump_btf_type()
248 jsonw_uint_field(w, "val", v->val); in dump_btf_type()
252 printf("\n\t'%s' val=%d", name, v->val); in dump_btf_type()
254 printf("\n\t'%s' val=%u", name, v->val); in dump_btf_type()
270 jsonw_uint_field(w, "size", t->size); in dump_btf_type()
275 printf(" encoding=%s size=%u vlen=%u", encoding, t->size, vlen); in dump_btf_type()
278 const char *name = btf_str(btf, v->name_off); in dump_btf_type()
279 __u64 val = ((__u64)v->val_hi32 << 32) | v->val_lo32; in dump_btf_type()
303 const char *fwd_kind = BTF_INFO_KFLAG(t->info) ? "union" in dump_btf_type()
316 jsonw_uint_field(w, "type_id", t->type); in dump_btf_type()
319 printf(" type_id=%u linkage=%s", t->type, linkage); in dump_btf_type()
325 __u16 vlen = BTF_INFO_VLEN(t->info); in dump_btf_type()
329 jsonw_uint_field(w, "ret_type_id", t->type); in dump_btf_type()
334 printf(" ret_type_id=%u vlen=%u", t->type, vlen); in dump_btf_type()
337 const char *name = btf_str(btf, p->name_off); in dump_btf_type()
342 jsonw_uint_field(w, "type_id", p->type); in dump_btf_type()
345 printf("\n\t'%s' type_id=%u", name, p->type); in dump_btf_type()
356 linkage = btf_var_linkage_str(v->linkage); in dump_btf_type()
359 jsonw_uint_field(w, "type_id", t->type); in dump_btf_type()
362 printf(" type_id=%u, linkage=%s", t->type, linkage); in dump_btf_type()
368 const struct btf_type *vt; in dump_btf_type() local
369 __u16 vlen = BTF_INFO_VLEN(t->info); in dump_btf_type()
373 jsonw_uint_field(w, "size", t->size); in dump_btf_type()
378 printf(" size=%u vlen=%u", t->size, vlen); in dump_btf_type()
383 jsonw_uint_field(w, "type_id", v->type); in dump_btf_type()
384 jsonw_uint_field(w, "offset", v->offset); in dump_btf_type()
385 jsonw_uint_field(w, "size", v->size); in dump_btf_type()
389 v->type, v->offset, v->size); in dump_btf_type()
391 if (v->type < btf__type_cnt(btf)) { in dump_btf_type()
392 vt = btf__type_by_id(btf, v->type); in dump_btf_type()
394 btf_kind_str[btf_kind_safe(btf_kind(vt))], in dump_btf_type()
395 btf_str(btf, vt->name_off)); in dump_btf_type()
405 jsonw_uint_field(w, "size", t->size); in dump_btf_type()
407 printf(" size=%u", t->size); in dump_btf_type()
414 jsonw_uint_field(w, "type_id", t->type); in dump_btf_type()
415 jsonw_int_field(w, "component_idx", tag->component_idx); in dump_btf_type()
417 printf(" type_id=%u component_idx=%d", t->type, tag->component_idx); in dump_btf_type()
483 if (arr->cnt == arr->cap) { in ptr_array_push()
484 new_cap = (arr->cap ?: 16) * 2; in ptr_array_push()
485 tmp = realloc(arr->elems, sizeof(*arr->elems) * new_cap); in ptr_array_push()
487 return -ENOMEM; in ptr_array_push()
488 arr->elems = tmp; in ptr_array_push()
489 arr->cap = new_cap; in ptr_array_push()
491 arr->elems[arr->cnt++] = ptr; in ptr_array_push()
497 free(arr->elems); in ptr_array_free()
506 return strcmp(btf__str_by_offset(btf, a->name_off), in cmp_kfuncs()
507 btf__str_by_offset(btf, b->name_off)); in cmp_kfuncs()
529 if (btf_decl_tag(t)->component_idx != -1) in dump_btf_kfuncs()
532 ft = btf__type_by_id(btf, t->type); in dump_btf_kfuncs()
536 name = btf__name_by_offset(btf, t->name_off); in dump_btf_kfuncs()
565 opts.field_name = btf__name_by_offset(btf, t->name_off); in dump_btf_kfuncs()
566 err = btf_dump__emit_type_decl(d, t->type, &opts); in dump_btf_kfuncs()
593 if (t->name_off) in btf_type_rank()
610 return btf_type_rank(btf, btf_array(t)->type, has_name); in btf_type_rank()
620 return btf_type_rank(btf, t->type, has_name); in btf_type_rank()
634 int name_off = t->name_off; in btf_type_sort_name()
638 btf_enum64(t)->name_off : in btf_type_sort_name()
639 btf_enum(t)->name_off; in btf_type_sort_name()
644 return btf_type_sort_name(btf, btf_array(t)->type, true); in btf_type_sort_name()
652 return btf_type_sort_name(btf, t->type, true); in btf_type_sort_name()
654 return btf__name_by_offset(btf, t->name_off); in btf_type_sort_name()
678 hash = btf_name_hasher(hash, btf, t->name_off); in btf_type_disambig_hash()
698 hash = btf_name_hasher(hash, btf, m->name_off); in btf_type_disambig_hash()
700 hash = hasher(hash, btf_type_disambig_hash(btf, m->type, false)); in btf_type_disambig_hash()
710 hash = hasher(hash, btf_type_disambig_hash(btf, t->type, include_members)); in btf_type_disambig_hash()
715 hash = hasher(hash, arr->nelems); in btf_type_disambig_hash()
716 hash = hasher(hash, btf_type_disambig_hash(btf, arr->type, include_members)); in btf_type_disambig_hash()
731 r = d1->type_rank - d2->type_rank; in btf_type_compare()
732 r = r ?: strcmp(d1->sort_name, d2->sort_name); in btf_type_compare()
733 r = r ?: strcmp(d1->own_name, d2->own_name); in btf_type_compare()
737 if (d1->disambig_hash != d2->disambig_hash) in btf_type_compare()
738 return d1->disambig_hash < d2->disambig_hash ? -1 : 1; in btf_type_compare()
740 return d1->index - d2->index; in btf_type_compare()
757 d->index = i; in sort_btf_c()
758 d->type_rank = btf_type_rank(btf, i, false); in sort_btf_c()
759 d->sort_name = btf_type_sort_name(btf, i, false); in sort_btf_c()
760 d->own_name = btf__name_by_offset(btf, t->name_off); in sort_btf_c()
761 d->disambig_hash = btf_type_disambig_hash(btf, i, true); in sort_btf_c()
778 return -errno; in dump_btf_c()
845 sysfs_vmlinux, -errno); in get_vmlinux_btf_from_sysfs()
885 __u32 btf_id = -1; in do_dump()
887 int fd = -1; in do_dump()
892 return -1; in do_dump()
901 return -1; in do_dump()
906 return -1; in do_dump()
931 return -1; in do_dump()
936 return -1; in do_dump()
951 return -1; in do_dump()
958 strncmp(*argv, sysfs_prefix, sizeof(sysfs_prefix) - 1) == 0 && in do_dump()
964 err = -errno; in do_dump()
971 err = -1; in do_dump()
981 err = -EINVAL; in do_dump()
991 err = -EINVAL; in do_dump()
1000 err = -EINVAL; in do_dump()
1007 …p_info("Warning: valid base BTF was not specified with -B option, falling back to standard base BT… in do_dump()
1014 err = -errno; in do_dump()
1022 p_err("JSON output for C-syntax dump is not supported"); in do_dump()
1023 err = -ENOTSUP; in do_dump()
1046 return -1; in btf_parse_fd()
1053 return -1; in btf_parse_fd()
1087 err = -1; in build_btf_type_table()
1098 errno == EINVAL ? " -- kernel too old?" : ""); in build_btf_type_table()
1110 err = -1; in build_btf_type_table()
1119 err = -1; in build_btf_type_table()
1137 btf_id = ((struct bpf_prog_info *)info)->btf_id; in build_btf_type_table()
1140 btf_id = ((struct bpf_map_info *)info)->btf_id; in build_btf_type_table()
1143 err = -1; in build_btf_type_table()
1153 btf_id, id, strerror(-err)); in build_btf_type_table()
1196 const char *name = u64_to_ptr(info->name); in show_btf_plain()
1199 printf("%u: ", info->id); in show_btf_plain()
1200 if (info->kernel_btf) in show_btf_plain()
1206 printf("size %uB", info->btf_size); in show_btf_plain()
1209 hashmap__for_each_key_entry(btf_prog_table, entry, info->id) { in show_btf_plain()
1210 printf("%s%lu", n++ == 0 ? " prog_ids " : ",", entry->value); in show_btf_plain()
1214 hashmap__for_each_key_entry(btf_map_table, entry, info->id) { in show_btf_plain()
1215 printf("%s%lu", n++ == 0 ? " map_ids " : ",", entry->value); in show_btf_plain()
1218 emit_obj_refs_plain(refs_table, info->id, "\n\tpids "); in show_btf_plain()
1229 const char *name = u64_to_ptr(info->name); in show_btf_json()
1232 jsonw_uint_field(json_wtr, "id", info->id); in show_btf_json()
1233 jsonw_uint_field(json_wtr, "size", info->btf_size); in show_btf_json()
1237 hashmap__for_each_key_entry(btf_prog_table, entry, info->id) { in show_btf_json()
1238 jsonw_uint(json_wtr, entry->value); in show_btf_json()
1244 hashmap__for_each_key_entry(btf_map_table, entry, info->id) { in show_btf_json()
1245 jsonw_uint(json_wtr, entry->value); in show_btf_json()
1249 emit_obj_refs_json(refs_table, info->id, json_wtr); /* pids */ in show_btf_json()
1251 jsonw_bool_field(json_wtr, "kernel", info->kernel_btf); in show_btf_json()
1272 return -1; in show_btf()
1284 return -1; in show_btf()
1300 int err, fd = -1; in do_show()
1306 return -1; in do_show()
1325 return -1; in do_show()
1353 errno == EINVAL ? " -- kernel too old?" : ""); in do_show()
1354 err = -1; in do_show()
1364 err = -1; in do_show()
1402 " {-B|--base-btf} }\n" in do_help()