mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 04:04:06 +00:00
libbpf: Fix single-line struct definition output in btf_dump
[ Upstream commit872aec4b5f
] btf_dump APIs emit unnecessary tabs when emitting struct/union definition that fits on the single line. Before this patch we'd get: struct blah {<tab>}; This patch fixes this and makes sure that we get more natural: struct blah {}; Fixes:44a726c3f2
("bpftool: Print newline before '}' for struct with padding only fields") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20221212211505.558851-2-andrii@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d2f96001a5
commit
c4724e101b
1 changed files with 5 additions and 2 deletions
|
@ -1003,9 +1003,12 @@ static void btf_dump_emit_struct_def(struct btf_dump *d,
|
|||
* Keep `struct empty {}` on a single line,
|
||||
* only print newline when there are regular or padding fields.
|
||||
*/
|
||||
if (vlen || t->size)
|
||||
if (vlen || t->size) {
|
||||
btf_dump_printf(d, "\n");
|
||||
btf_dump_printf(d, "%s}", pfx(lvl));
|
||||
btf_dump_printf(d, "%s}", pfx(lvl));
|
||||
} else {
|
||||
btf_dump_printf(d, "}");
|
||||
}
|
||||
if (packed)
|
||||
btf_dump_printf(d, " __attribute__((packed))");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue