]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
libbpf: Improve log message formatting
authorTony Ambardar <tony.ambardar@gmail.com>
Mon, 16 Sep 2024 08:37:40 +0000 (01:37 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 4 Oct 2024 00:47:36 +0000 (17:47 -0700)
Fix missing newlines and extraneous terminal spaces in messages.

Signed-off-by: Tony Ambardar <tony.ambardar@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/086884b7cbf87e524d584f9bf87f7a580e378b2b.1726475448.git.tony.ambardar@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/btf.c
tools/lib/bpf/btf_dump.c
tools/lib/bpf/btf_relocate.c
tools/lib/bpf/libbpf.c
tools/lib/bpf/relo_core.c

index 3c131039c523269b263fef2ea48f82ea1ffcfc21..e1d4cbd8372903d7e26728939653d6e02eedfec7 100644 (file)
@@ -2941,7 +2941,7 @@ static int btf_ext_setup_info(struct btf_ext *btf_ext,
 
        /* If no records, return failure now so .BTF.ext won't be used. */
        if (!info_left) {
-               pr_debug("%s section in .BTF.ext has no records", ext_sec->desc);
+               pr_debug("%s section in .BTF.ext has no records\n", ext_sec->desc);
                return -EINVAL;
        }
 
@@ -3029,7 +3029,7 @@ static int btf_ext_parse_hdr(__u8 *data, __u32 data_size)
 
        if (data_size < offsetofend(struct btf_ext_header, hdr_len) ||
            data_size < hdr->hdr_len) {
-               pr_debug("BTF.ext header not found");
+               pr_debug("BTF.ext header not found\n");
                return -EINVAL;
        }
 
@@ -3291,7 +3291,7 @@ int btf__dedup(struct btf *btf, const struct btf_dedup_opts *opts)
 
        d = btf_dedup_new(btf, opts);
        if (IS_ERR(d)) {
-               pr_debug("btf_dedup_new failed: %ld", PTR_ERR(d));
+               pr_debug("btf_dedup_new failed: %ld\n", PTR_ERR(d));
                return libbpf_err(-EINVAL);
        }
 
index 0a7327541c17f1252dc5c8601ef4e8fc338ab36a..8440c2c5ad3ede3c05fc05fa08db103d2da33a87 100644 (file)
@@ -1304,7 +1304,7 @@ static void btf_dump_emit_type_decl(struct btf_dump *d, __u32 id,
                         * chain, restore stack, emit warning, and try to
                         * proceed nevertheless
                         */
-                       pr_warn("not enough memory for decl stack:%d", err);
+                       pr_warn("not enough memory for decl stack: %d\n", err);
                        d->decl_stack_cnt = stack_start;
                        return;
                }
index 4f7399d85eab3d5816abdf260d525a527842139e..b72f83e15156a6f6d096f39dd4f5ee7306acc880 100644 (file)
@@ -428,7 +428,7 @@ static int btf_relocate_rewrite_strs(struct btf_relocate *r, __u32 i)
                } else {
                        off = r->str_map[*str_off];
                        if (!off) {
-                               pr_warn("string '%s' [offset %u] is not mapped to base BTF",
+                               pr_warn("string '%s' [offset %u] is not mapped to base BTF\n",
                                        btf__str_by_offset(r->btf, off), *str_off);
                                return -ENOENT;
                        }
index 1ef221df0541a9ed151781ba15cd1e131d0a4847..a7cbb30605da85bc7e847f29aacd3594be4455b4 100644 (file)
@@ -12765,7 +12765,7 @@ struct bpf_link *bpf_program__attach_freplace(const struct bpf_program *prog,
        }
 
        if (prog->type != BPF_PROG_TYPE_EXT) {
-               pr_warn("prog '%s': only BPF_PROG_TYPE_EXT can attach as freplace",
+               pr_warn("prog '%s': only BPF_PROG_TYPE_EXT can attach as freplace\n",
                        prog->name);
                return libbpf_err_ptr(-EINVAL);
        }
@@ -13839,7 +13839,7 @@ int bpf_object__open_subskeleton(struct bpf_object_subskeleton *s)
                map_type = btf__type_by_id(btf, map_type_id);
 
                if (!btf_is_datasec(map_type)) {
-                       pr_warn("type for map '%1$s' is not a datasec: %2$s",
+                       pr_warn("type for map '%1$s' is not a datasec: %2$s\n",
                                bpf_map__name(map),
                                __btf_kind_str(btf_kind(map_type)));
                        return libbpf_err(-EINVAL);
index 63a4d5ad12d1a314ea8470e2f320dae313153d4c..7632e9d418271798fded941e4b672aafe2f3296c 100644 (file)
@@ -1339,7 +1339,7 @@ int bpf_core_calc_relo_insn(const char *prog_name,
                                          cands->cands[i].id, cand_spec);
                if (err < 0) {
                        bpf_core_format_spec(spec_buf, sizeof(spec_buf), cand_spec);
-                       pr_warn("prog '%s': relo #%d: error matching candidate #%d %s: %d\n ",
+                       pr_warn("prog '%s': relo #%d: error matching candidate #%d %s: %d\n",
                                prog_name, relo_idx, i, spec_buf, err);
                        return err;
                }