perf bpf: Add license(NAME) helper
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 1f477305ab462e2fd1fa8a4c4fa425ad752b3175 Gitweb: https://git.kernel.org/tip/1f477305ab462e2fd1fa8a4c4fa425ad752b3175 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Fri, 4 May 2018 15:18:31 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 15 May 2018 14:31:24 -0300
perf bpf: Add license(NAME) helper
To further reduce boilerplate.
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/examples/bpf/5sec.c | 3 +-- tools/perf/examples/bpf/empty.c | 3 +-- tools/perf/include/bpf/bpf.h | 5 +++++ 3 files changed, 7 insertions(+), 4 deletions(-)
tools/perf/examples/bpf/5sec.c +1 -2
@@ -40,5 +40,4 @@ int func(void *ctx, int err, long sec)return sec ==5 ; } -char _license[] SEC("license") = "GPL"; -int _version SEC("version") = LINUX_VERSION_CODE; +license (GPL );
tools/perf/examples/bpf/empty.c +1 -2
@@ -1,4 +1,3 @@#include <bpf.h> -char _license[] SEC("license") = "GPL"; -int _version SEC("version") = LINUX_VERSION_CODE; +license (GPL );
tools/perf/include/bpf/bpf.h +5 -0
@@ -2,4 +2,9 @@#ifndef _PERF_BPF_H#define _PERF_BPF_H#define SEC (NAME ) __attribute__((section(NAME), used)) + +#define license (name) \ +char _license[] SEC("license") = #name; \ +int _version SEC("version") = LINUX_VERSION_CODE; +#endif /* _PERF_BPF_H */