From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 07/11] perf bpf: Add license(NAME) helper
Date: Wed, 16 May 2018 11:49:04 -0300 [thread overview]
Message-ID: <20180516144908.22212-8-acme@kernel.org> (raw)
In-Reply-To: <20180516144908.22212-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To further reduce boilerplate.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-vst6hj335s0ebxzqltes3nsc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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(-)
diff --git a/tools/perf/examples/bpf/5sec.c b/tools/perf/examples/bpf/5sec.c
index 3d1ed34aec8b..6fc3697ac749 100644
--- a/tools/perf/examples/bpf/5sec.c
+++ b/tools/perf/examples/bpf/5sec.c
@@ -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);
diff --git a/tools/perf/examples/bpf/empty.c b/tools/perf/examples/bpf/empty.c
index 86f97763355d..3776d26db9e7 100644
--- a/tools/perf/examples/bpf/empty.c
+++ b/tools/perf/examples/bpf/empty.c
@@ -1,4 +1,3 @@
#include <bpf.h>
-char _license[] SEC("license") = "GPL";
-int _version SEC("version") = LINUX_VERSION_CODE;
+license(GPL);
diff --git a/tools/perf/include/bpf/bpf.h b/tools/perf/include/bpf/bpf.h
index 003afcab4e51..cdfd18b9c318 100644
--- a/tools/perf/include/bpf/bpf.h
+++ b/tools/perf/include/bpf/bpf.h
@@ -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 */
--
2.14.3
next prev parent reply other threads:[~2018-05-16 14:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-16 14:48 [GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-05-16 14:48 ` [PATCH 01/11] perf tests parse-events: Add intel_pt parse test Arnaldo Carvalho de Melo
2018-05-16 21:33 ` Kim Phillips
2018-05-17 20:15 ` Arnaldo Carvalho de Melo
2018-05-17 20:58 ` Jiri Olsa
2018-05-17 22:54 ` Kim Phillips
2018-05-18 14:13 ` Arnaldo Carvalho de Melo
2018-05-16 14:48 ` [PATCH 02/11] perf buildid-cache: Warn --purge-all failures Arnaldo Carvalho de Melo
2018-05-16 14:49 ` [PATCH 03/11] perf llvm-utils: Add bpf include path to clang command line Arnaldo Carvalho de Melo
2018-05-16 14:49 ` [PATCH 04/11] perf bpf: Add 'examples' directories Arnaldo Carvalho de Melo
2018-05-16 14:49 ` [PATCH 05/11] perf bpf: Add bpf.h to be used in eBPF proggies Arnaldo Carvalho de Melo
2018-05-16 14:49 ` [PATCH 06/11] perf bpf: Add kprobe example to catch 5s naps Arnaldo Carvalho de Melo
2018-05-16 14:49 ` Arnaldo Carvalho de Melo [this message]
2018-05-16 14:49 ` [PATCH 08/11] perf bpf: Add probe() helper to reduce kprobes boilerplate Arnaldo Carvalho de Melo
2018-05-16 14:49 ` [PATCH 09/11] perf tools: Use the "_stest" symbol to identify the kernel map when loading kcore Arnaldo Carvalho de Melo
2018-05-16 14:49 ` [PATCH 10/11] perf parse-events: Handle uncore event aliases in small groups properly Arnaldo Carvalho de Melo
2018-05-16 14:49 ` [PATCH 11/11] perf bpf: Fix NULL return handling in bpf__prepare_load() Arnaldo Carvalho de Melo
2018-05-16 15:58 ` [GIT PULL 00/11] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180516144908.22212-8-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=wangnan0@huawei.com \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).