File tree Expand file tree Collapse file tree 4 files changed +537
-15
lines changed Expand file tree Collapse file tree 4 files changed +537
-15
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,11 @@ static int btf_parse_type_sec(struct btf *btf)
237237 return 0 ;
238238}
239239
240+ __u32 btf__get_nr_types (const struct btf * btf )
241+ {
242+ return btf -> nr_types ;
243+ }
244+
240245const struct btf_type * btf__type_by_id (const struct btf * btf , __u32 type_id )
241246{
242247 if (type_id > btf -> nr_types )
@@ -427,6 +432,13 @@ int btf__fd(const struct btf *btf)
427432 return btf -> fd ;
428433}
429434
435+ void btf__get_strings (const struct btf * btf , const char * * strings ,
436+ __u32 * str_len )
437+ {
438+ * strings = btf -> strings ;
439+ * str_len = btf -> hdr -> str_len ;
440+ }
441+
430442const char * btf__name_by_offset (const struct btf * btf , __u32 offset )
431443{
432444 if (offset < btf -> hdr -> str_len )
Original file line number Diff line number Diff line change @@ -59,11 +59,14 @@ LIBBPF_API void btf__free(struct btf *btf);
5959LIBBPF_API struct btf * btf__new (__u8 * data , __u32 size );
6060LIBBPF_API __s32 btf__find_by_name (const struct btf * btf ,
6161 const char * type_name );
62+ LIBBPF_API __u32 btf__get_nr_types (const struct btf * btf );
6263LIBBPF_API const struct btf_type * btf__type_by_id (const struct btf * btf ,
6364 __u32 id );
6465LIBBPF_API __s64 btf__resolve_size (const struct btf * btf , __u32 type_id );
6566LIBBPF_API int btf__resolve_type (const struct btf * btf , __u32 type_id );
6667LIBBPF_API int btf__fd (const struct btf * btf );
68+ LIBBPF_API void btf__get_strings (const struct btf * btf , const char * * strings ,
69+ __u32 * str_len );
6770LIBBPF_API const char * btf__name_by_offset (const struct btf * btf , __u32 offset );
6871LIBBPF_API int btf__get_from_id (__u32 id , struct btf * * btf );
6972LIBBPF_API int btf__get_map_kv_tids (const struct btf * btf , char * map_name ,
Original file line number Diff line number Diff line change @@ -135,6 +135,8 @@ LIBBPF_0.0.2 {
135135 bpf_get_link_xdp_id;
136136 btf__dedup;
137137 btf__get_map_kv_tids;
138+ btf__get_nr_types;
139+ btf__get_strings;
138140 btf_ext__free;
139141 btf_ext__func_info_rec_size;
140142 btf_ext__line_info_rec_size;
You can’t perform that action at this time.
0 commit comments