xref: /linux/tools/bpf/resolve_btfids/btf_colors.h (revision aac67645215d5a38cff9f86110b81c220e5e8182)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __RESOLVE_BTFIDS_BTF_COLORS_H
3 #define __RESOLVE_BTFIDS_BTF_COLORS_H
4 
5 #include <bpf/btf.h>
6 
7 enum btf_color {
8 	BTF_COLOR_NONE = 0,
9 	BTF_COLOR_MAIN = 1,
10 	BTF_COLOR_LOC = 2,
11 	BTF_COLOR_SHARED = BTF_COLOR_MAIN | BTF_COLOR_LOC,
12 };
13 
14 #define BTF_SHA256_DIGEST_LENGTH	32
15 
16 void btf_sha256(const void *data, size_t len,
17 		__u8 out[BTF_SHA256_DIGEST_LENGTH]);
18 void btf_mark_reachable(struct btf *btf, __u32 root, enum btf_color color,
19 			__u8 *colors, __u32 *worklist);
20 
21 int btf_split_by_color(struct btf *src, const __u8 *colors,
22 		       struct btf **main_out, struct btf **inline_out);
23 
24 #endif
25