1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ 2 3 /* 4 * Internal libbpf helpers. 5 * 6 * Copyright (c) 2019 Facebook 7 */ 8 9 #ifndef __LIBBPF_LIBBPF_INTERNAL_H 10 #define __LIBBPF_LIBBPF_INTERNAL_H 11 12 #define BTF_INFO_ENC(kind, kind_flag, vlen) \ 13 ((!!(kind_flag) << 31) | ((kind) << 24) | ((vlen) & BTF_MAX_VLEN)) 14 #define BTF_TYPE_ENC(name, info, size_or_type) (name), (info), (size_or_type) 15 #define BTF_INT_ENC(encoding, bits_offset, nr_bits) \ 16 ((encoding) << 24 | (bits_offset) << 16 | (nr_bits)) 17 #define BTF_TYPE_INT_ENC(name, encoding, bits_offset, bits, sz) \ 18 BTF_TYPE_ENC(name, BTF_INFO_ENC(BTF_KIND_INT, 0, 0), sz), \ 19 BTF_INT_ENC(encoding, bits_offset, bits) 20 #define BTF_MEMBER_ENC(name, type, bits_offset) (name), (type), (bits_offset) 21 #define BTF_PARAM_ENC(name, type) (name), (type) 22 #define BTF_VAR_SECINFO_ENC(type, offset, size) (type), (offset), (size) 23 24 int libbpf__probe_raw_btf(const char *raw_types, size_t types_len, 25 const char *str_sec, size_t str_len); 26 27 #endif /* __LIBBPF_LIBBPF_INTERNAL_H */ 28