Commit 8de6cae4 authored by Mauricio Vásquez's avatar Mauricio Vásquez Committed by Andrii Nakryiko
Browse files

libbpf: Expose bpf_core_{add,free}_cands() to bpftool

parent adb8fa19
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -5192,13 +5192,16 @@ size_t bpf_core_essential_name_len(const char *name)
	return n;
}

static void bpf_core_free_cands(struct bpf_core_cand_list *cands)
void bpf_core_free_cands(struct bpf_core_cand_list *cands)
{
	if (!cands)
		return;

	free(cands->cands);
	free(cands);
}

static int bpf_core_add_cands(struct bpf_core_cand *local_cand,
int bpf_core_add_cands(struct bpf_core_cand *local_cand,
		       size_t local_essent_len,
		       const struct btf *targ_btf,
		       const char *targ_btf_name,
+9 −0
Original line number Diff line number Diff line
@@ -529,4 +529,13 @@ static inline int ensure_good_fd(int fd)
	return fd;
}

/* The following two functions are exposed to bpftool */
int bpf_core_add_cands(struct bpf_core_cand *local_cand,
		       size_t local_essent_len,
		       const struct btf *targ_btf,
		       const char *targ_btf_name,
		       int targ_start_id,
		       struct bpf_core_cand_list *cands);
void bpf_core_free_cands(struct bpf_core_cand_list *cands);

#endif /* __LIBBPF_LIBBPF_INTERNAL_H */