2018-03-06 01:53:50 +01:00
|
|
|
#ifndef _BTF_ENCODER_H_
|
|
|
|
#define _BTF_ENCODER_H_ 1
|
2019-01-15 18:28:24 +01:00
|
|
|
/*
|
|
|
|
SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
2019-01-18 19:42:37 +01:00
|
|
|
Copyright (C) 2019 Facebook
|
|
|
|
|
|
|
|
Derived from ctf_encoder.h, which is:
|
|
|
|
Copyright (C) Arnaldo Carvalho de Melo <acme@redhat.com>
|
2019-01-15 18:28:24 +01:00
|
|
|
*/
|
2018-03-06 01:53:50 +01:00
|
|
|
|
2021-06-03 15:43:21 +02:00
|
|
|
#include <stdbool.h>
|
2021-06-03 16:10:26 +02:00
|
|
|
#include <stdint.h>
|
2021-06-03 15:43:21 +02:00
|
|
|
|
2021-06-02 14:32:56 +02:00
|
|
|
struct btf;
|
2021-06-03 15:12:41 +02:00
|
|
|
struct btf_elf;
|
2018-03-06 01:53:50 +01:00
|
|
|
struct cu;
|
|
|
|
|
2021-06-03 16:10:26 +02:00
|
|
|
#define MAX_PERCPU_VAR_CNT 4096
|
|
|
|
|
|
|
|
struct var_info {
|
|
|
|
uint64_t addr;
|
|
|
|
const char *name;
|
|
|
|
uint32_t sz;
|
|
|
|
};
|
|
|
|
|
2021-06-03 15:12:41 +02:00
|
|
|
struct btf_encoder {
|
|
|
|
struct btf_elf *btfe;
|
2021-06-03 15:12:41 +02:00
|
|
|
bool has_index_type,
|
|
|
|
need_index_type;
|
2021-06-03 16:10:26 +02:00
|
|
|
struct {
|
|
|
|
struct var_info vars[MAX_PERCPU_VAR_CNT];
|
|
|
|
int var_cnt;
|
|
|
|
} percpu;
|
2021-06-03 15:12:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct btf_encoder *btf_encoder__new(struct cu *cu, struct btf *base_btf, bool skip_encoding_vars);
|
|
|
|
void btf_encoder__delete(struct btf_encoder *encoder);
|
|
|
|
|
2021-05-28 21:41:30 +02:00
|
|
|
int btf_encoder__encode(const char *filename);
|
2018-12-18 23:09:39 +01:00
|
|
|
|
2021-06-02 14:32:56 +02:00
|
|
|
int cu__encode_btf(struct cu *cu, struct btf *base_btf, int verbose, bool force,
|
2021-05-28 21:41:30 +02:00
|
|
|
bool skip_encoding_vars, const char *detached_btf_filename);
|
2018-03-06 01:53:50 +01:00
|
|
|
|
|
|
|
#endif /* _BTF_ENCODER_H_ */
|