mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-20 16:29:07 +08:00
libbpf: fix formatting of bpf_object__append_subprog_code
The commit 6c918709bd30 ("libbpf: Refactor bpf_object__reloc_code")
added the bpf_object__append_subprog_code() with incorrect indentations.
Use tabs instead. (This also makes a consequent commit better readable.)
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20251019202145.3944697-14-a.s.protopopov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Andrii Nakryiko
parent
30599e72bf
commit
49c5e0eef4
42
src/libbpf.c
42
src/libbpf.c
@@ -6436,32 +6436,32 @@ static int
|
||||
bpf_object__append_subprog_code(struct bpf_object *obj, struct bpf_program *main_prog,
|
||||
struct bpf_program *subprog)
|
||||
{
|
||||
struct bpf_insn *insns;
|
||||
size_t new_cnt;
|
||||
int err;
|
||||
struct bpf_insn *insns;
|
||||
size_t new_cnt;
|
||||
int err;
|
||||
|
||||
subprog->sub_insn_off = main_prog->insns_cnt;
|
||||
subprog->sub_insn_off = main_prog->insns_cnt;
|
||||
|
||||
new_cnt = main_prog->insns_cnt + subprog->insns_cnt;
|
||||
insns = libbpf_reallocarray(main_prog->insns, new_cnt, sizeof(*insns));
|
||||
if (!insns) {
|
||||
pr_warn("prog '%s': failed to realloc prog code\n", main_prog->name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
main_prog->insns = insns;
|
||||
main_prog->insns_cnt = new_cnt;
|
||||
new_cnt = main_prog->insns_cnt + subprog->insns_cnt;
|
||||
insns = libbpf_reallocarray(main_prog->insns, new_cnt, sizeof(*insns));
|
||||
if (!insns) {
|
||||
pr_warn("prog '%s': failed to realloc prog code\n", main_prog->name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
main_prog->insns = insns;
|
||||
main_prog->insns_cnt = new_cnt;
|
||||
|
||||
memcpy(main_prog->insns + subprog->sub_insn_off, subprog->insns,
|
||||
subprog->insns_cnt * sizeof(*insns));
|
||||
memcpy(main_prog->insns + subprog->sub_insn_off, subprog->insns,
|
||||
subprog->insns_cnt * sizeof(*insns));
|
||||
|
||||
pr_debug("prog '%s': added %zu insns from sub-prog '%s'\n",
|
||||
main_prog->name, subprog->insns_cnt, subprog->name);
|
||||
pr_debug("prog '%s': added %zu insns from sub-prog '%s'\n",
|
||||
main_prog->name, subprog->insns_cnt, subprog->name);
|
||||
|
||||
/* The subprog insns are now appended. Append its relos too. */
|
||||
err = append_subprog_relos(main_prog, subprog);
|
||||
if (err)
|
||||
return err;
|
||||
return 0;
|
||||
/* The subprog insns are now appended. Append its relos too. */
|
||||
err = append_subprog_relos(main_prog, subprog);
|
||||
if (err)
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user