Thread (7 messages) flat view 7 messages, 3 authors, 2021-03-17

Re: [PATCH v2 bpf-next 1/4] bpftool: generate NULL definition in vmlinux.h

From: Alexei Starovoitov <hidden>
Date: 2021-03-17 18:17:03
Also in: bpf

On Wed, Mar 17, 2021 at 10:38 AM Andrii Nakryiko
[off-list ref] wrote:
quoted
diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
index 62953bbf68b4..ff6a76632873 100644
--- a/tools/bpf/bpftool/btf.c
+++ b/tools/bpf/bpftool/btf.c
@@ -405,6 +405,8 @@ static int dump_btf_c(const struct btf *btf,
        printf("#ifndef __VMLINUX_H__\n");
        printf("#define __VMLINUX_H__\n");
        printf("\n");
+       printf("#define NULL ((void *)0)\n");

On second thought, this could also be done in bpf_helpers.h, which is
pretty much always included in BPF programs. I think that's a bit more
maintainable and less magical to users, so I'll go with that in v3.
yep. good idea.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help