From: Yonghong Song <yhs@fb.com>
To: <netdev@vger.kernel.org>
Cc: Alexei Starovoitov <ast@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>, <kernel-team@fb.com>,
Martin KaFai Lau <kafai@fb.com>
Subject: [PATCH bpf-next 3/7] tools/bpf: sync btf.h header from kernel to tools
Date: Tue, 11 Dec 2018 16:46:33 -0800 [thread overview]
Message-ID: <20181212004633.395662-1-yhs@fb.com> (raw)
In-Reply-To: <20181212004630.395424-1-yhs@fb.com>
Sync include/uapi/linux/btf.h to tools/include/uapi/linux/btf.h.
Signed-off-by: Yonghong Song <yhs@fb.com>
---
tools/include/uapi/linux/btf.h | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/include/uapi/linux/btf.h b/tools/include/uapi/linux/btf.h
index 14f66948fc95..34aba40ed926 100644
--- a/tools/include/uapi/linux/btf.h
+++ b/tools/include/uapi/linux/btf.h
@@ -34,7 +34,9 @@ struct btf_type {
* bits 0-15: vlen (e.g. # of struct's members)
* bits 16-23: unused
* bits 24-27: kind (e.g. int, ptr, array...etc)
- * bits 28-31: unused
+ * bits 28-30: unused
+ * bit 31: kind_flag, currently used by
+ * struct, union and fwd
*/
__u32 info;
/* "size" is used by INT, ENUM, STRUCT and UNION.
@@ -52,6 +54,7 @@ struct btf_type {
#define BTF_INFO_KIND(info) (((info) >> 24) & 0x0f)
#define BTF_INFO_VLEN(info) ((info) & 0xffff)
+#define BTF_INFO_KFLAG(info) ((info) >> 31)
#define BTF_KIND_UNKN 0 /* Unknown */
#define BTF_KIND_INT 1 /* Integer */
@@ -110,9 +113,17 @@ struct btf_array {
struct btf_member {
__u32 name_off;
__u32 type;
- __u32 offset; /* offset in bits */
+ __u32 offset; /* [bitfield_size and] offset in bits */
};
+/* If the type info kind_flag set, the btf_member.offset
+ * contains both member bit offset and bitfield size, and
+ * bitfield size will set for struct/union bitfield members.
+ * Otherwise, it contains only bit offset.
+ */
+#define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24)
+#define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff)
+
/* BTF_KIND_FUNC_PROTO is followed by multiple "struct btf_param".
* The exact number of btf_param is stored in the vlen (of the
* info in "struct btf_type").
--
2.17.1
next prev parent reply other threads:[~2018-12-12 0:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 0:46 [PATCH bpf-next 0/7] bpf: btf: fix struct/union/fwd types with kind_flag Yonghong Song
2018-12-12 0:46 ` [PATCH bpf-next 1/7] bpf: btf: refactor btf_int_bits_seq_show() Yonghong Song
2018-12-12 0:46 ` [PATCH bpf-next 2/7] bpf: btf: fix struct/union/fwd types with kind_flag Yonghong Song
2018-12-12 0:46 ` Yonghong Song [this message]
2018-12-12 0:46 ` [PATCH bpf-next 4/7] tools/bpf: add test_btf unit tests for kind_flag Yonghong Song
2018-12-12 0:46 ` [PATCH bpf-next 5/7] tools/bpf: test kernel bpffs map pretty print with struct kind_flag Yonghong Song
2018-12-12 0:46 ` [PATCH bpf-next 6/7] tools: bpftool: refactor btf_dumper_int_bits() Yonghong Song
2018-12-12 0:46 ` [PATCH bpf-next 7/7] tools: bpftool: support pretty print with kind_flag set Yonghong Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181212004633.395662-1-yhs@fb.com \
--to=yhs@fb.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.