libbpf: Remove extern declaration of bpf_stream_vprintk()
Subsystems (7)
Ihor Solodrai
reviewercover libbpf: Remove extern declaration of bpf_stream_vprintk()
The first patch adjusts a selftest that has been using bpf_stream_printk() macro. The second patch removes the declaration.
Successful BPF CI run: https://github.com/kernel-patches/bpf/actions/runs/22156645808
Ihor Solodrai (2):
selftests/bpf: Use vmlinux.h in test_xdp_meta
libbpf: Remove extern declaration of bpf_stream_vprintk()
tools/lib/bpf/bpf_helpers.h | 3 --- tools/testing/selftests/bpf/progs/test_xdp_meta.c | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-)
Signature · 1 line
2.53.0
Ihor Solodrai
reviewerPATCH 1/2 selftests/bpf: Use vmlinux.h in test_xdp_meta
- Replace linux/* includes with vmlinux.h
- Include errno.h
- Include bpf_tracing_net.h for TC_ACT_* and ETH_*
- Use BPF_STDERR instead of BPF_STREAM_STDERR
--- tools/testing/selftests/bpf/progs/test_xdp_meta.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/bpf/progs/test_xdp_meta.c +6 -6
@@ -1,12 +1,12 @@ -#include <stdbool.h> -#include <linux/bpf.h> -#include <linux/errno.h> -#include <linux/if_ether.h> -#include <linux/pkt_cls.h> +// SPDX-License-Identifier: GPL-2.0 +#include <vmlinux.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> +#include <errno.h> +#include "bpf_kfuncs.h" +#include "bpf_tracing_net.h" #define META_SIZE 32
@@ -42,7 +42,7 @@ static bool check_metadata(const char *file, int line, __u8 *meta_have)if (!__builtin_memcmp (meta_have, meta_want,META_SIZE ))return true; - bpf_stream_printk(BPF_STREAM_STDERR, + bpf_stream_printk(BPF_STDERR, "FAIL:%s:%d: metadata mismatch\n" " have:\n %pI6\n %pI6\n" " want:\n %pI6\n %pI6\n",
Signature · 1 line
2.53.0
Ihor Solodrai
reviewerPATCH 2/2 libbpf: Remove extern declaration of bpf_stream_vprintk()
In reply to Ihor SolodraiAn issue was reported that building BPF program which includes both vmlinux.h and bpf_helpers.h from libbpf fails due to conflicting declarations of bpf_stream_vprintk().
Remove the extern declaration from bpf_helpers.h to address this.
In order to use bpf_stream_printk() macro, BPF programs are expected to either include vmlinux.h of the kernel they are targeting, or add their own extern declaration.
--- tools/lib/bpf/bpf_helpers.h | 3 --- 1 file changed, 3 deletions(-)
tools/lib/bpf/bpf_helpers.h +0 -3
@@ -315,9 +315,6 @@ enum libbpf_tristate { ___param, sizeof(___param)); \ }) -extern int bpf_stream_vprintk(int stream_id, const char *fmt__str, const void *args, - __u32 len__sz) __weak __ksym; - #define bpf_stream_printk(stream_id, fmt, args...) \ ({ \ static const char ___fmt[] = fmt; \
Signature · 1 line
2.53.0
This series was applied to bpf/bpf.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <[email protected]>:
Quoted 10 lines · On Wed, 18 Feb 2026 13:56:49 -0800 you wrote:
The first patch adjusts a selftest that has been using
bpf_stream_printk()macro. The second patch removes the declaration.Successful BPF CI run: https://github.com/kernel-patches/bpf/actions/runs/22156645808
Ihor Solodrai (2):
selftests/bpf: Usevmlinux.hintest_xdp_meta
libbpf: Remove extern declaration ofbpf_stream_vprintk()[...]
Here is the summary with links:
- [bpf,v1,1/2] selftests/bpf: Use vmlinux.h in test_xdp_meta
https://git.kernel.org/bpf/bpf/c/b3dfa128f7da - [bpf,v1,2/2] libbpf: Remove extern declaration of bpf_stream_vprintk() https://git.kernel.org/bpf/bpf/c/0cecd492f516
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html