File Index
Files and directories
Sign in
FILE

btf.c

File preview with syntax highlighting.

linux-6.19.14/tools/perf/util/btf.c C
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * Arnaldo Carvalho de Melo <acme@redhat.com>
 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
12const 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}
~/ Read-only file preview.