mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Add re-usable btf_helpers.{c,h} to provide BTF-related testing routines. Start with adding a raw BTF dumping helpers. Raw BTF dump is the most succinct and at the same time a very human-friendly way to validate exact contents of BTF types. Cross-validate raw BTF dump and writable BTF in a single selftest. Raw type dump checks also serve as a good self-documentation. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20201105043402.2530976-7-andrii@kernel.org
12 lines
308 B
C
12 lines
308 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (c) 2020 Facebook */
|
|
#ifndef __BTF_HELPERS_H
|
|
#define __BTF_HELPERS_H
|
|
|
|
#include <stdio.h>
|
|
#include <bpf/btf.h>
|
|
|
|
int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id);
|
|
const char *btf_type_raw_dump(const struct btf *btf, int type_id);
|
|
|
|
#endif
|