]> Git Repo - linux.git/blob - tools/perf/util/btf.c
Linux 6.14-rc3
[linux.git] / tools / perf / util / btf.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Arnaldo Carvalho de Melo <[email protected]>
4  *
5  * Copyright (C) 2024, Red Hat, Inc
6  */
7
8 #include <bpf/btf.h>
9 #include <util/btf.h>
10 #include <string.h>
11
12 const struct btf_member *__btf_type__find_member_by_name(struct btf *btf,
13                                                          int type_id, const char *member_name)
14 {
15         const struct btf_type *t = btf__type_by_id(btf, type_id);
16         const struct btf_member *m;
17         int i;
18
19         for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) {
20                 const char *current_member_name = btf__name_by_offset(btf, m->name_off);
21
22                 if (!strcmp(current_member_name, member_name))
23                         return m;
24         }
25
26         return NULL;
27 }
This page took 0.033608 seconds and 4 git commands to generate.