btf_relocate.c (d1cf840854bb603c0718a011bc993f69f2df014e) btf_relocate.c (8646db238997df36c6ad71a9d7e0b52ceee221b2)
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2024, Oracle and/or its affiliates. */
3
4#ifndef _GNU_SOURCE
5#define _GNU_SOURCE
6#endif
7
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2024, Oracle and/or its affiliates. */
3
4#ifndef _GNU_SOURCE
5#define _GNU_SOURCE
6#endif
7
8#ifdef __KERNEL__
9#include <linux/bpf.h>
10#include <linux/bsearch.h>
11#include <linux/btf.h>
12#include <linux/sort.h>
13#include <linux/string.h>
14#include <linux/bpf_verifier.h>
15
16#define btf_type_by_id (struct btf_type *)btf_type_by_id
17#define btf__type_cnt btf_nr_types
18#define btf__base_btf btf_base_btf
19#define btf__name_by_offset btf_name_by_offset
20#define btf__str_by_offset btf_str_by_offset
21#define btf_kflag btf_type_kflag
22
23#define calloc(nmemb, sz) kvcalloc(nmemb, sz, GFP_KERNEL | __GFP_NOWARN)
24#define free(ptr) kvfree(ptr)
25#define qsort(base, num, sz, cmp) sort(base, num, sz, cmp, NULL)
26
27#else
28
8#include "btf.h"
9#include "bpf.h"
10#include "libbpf.h"
11#include "libbpf_internal.h"
12
29#include "btf.h"
30#include "bpf.h"
31#include "libbpf.h"
32#include "libbpf_internal.h"
33
34#endif /* __KERNEL__ */
35
13struct btf;
14
15struct btf_relocate {
16 struct btf *btf;
17 const struct btf *base_btf;
18 const struct btf *dist_base_btf;
19 unsigned int nr_base_types;
20 unsigned int nr_split_types;

--- 476 unchanged lines hidden ---
36struct btf;
37
38struct btf_relocate {
39 struct btf *btf;
40 const struct btf *base_btf;
41 const struct btf *dist_base_btf;
42 unsigned int nr_base_types;
43 unsigned int nr_split_types;

--- 476 unchanged lines hidden ---