mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 03:24:55 +08:00
232338fa2f
Add selftests validating BTF deduplication for split BTF case. Add a helper macro that allows to validate entire BTF with raw BTF dump, not just type-by-type. This saves tons of code and complexity. 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-11-andrii@kernel.org
20 lines
608 B
C
20 lines
608 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);
|
|
int btf_validate_raw(struct btf *btf, int nr_types, const char *exp_types[]);
|
|
|
|
#define VALIDATE_RAW_BTF(btf, raw_types...) \
|
|
btf_validate_raw(btf, \
|
|
sizeof((const char *[]){raw_types})/sizeof(void *),\
|
|
(const char *[]){raw_types})
|
|
|
|
const char *btf_type_c_dump(const struct btf *btf);
|
|
#endif
|