From: tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, dsahern@gmail.com, acme@redhat.com,
mingo@kernel.org, milian.wolff@kdab.com, jolsa@kernel.org,
wangnan0@huawei.com, namhyung@kernel.org, tglx@linutronix.de,
hpa@zytor.com, adrian.hunter@intel.com
Subject: [tip:perf/core] tools lib bpf: Rename bpf_map__get_name() to bpf_map__name()
Date: Wed, 8 Jun 2016 01:41:57 -0700 [thread overview]
Message-ID: <tip-crnflv84ejyhpba933ec71gs@git.kernel.org> (raw)
Commit-ID: 009ad5d5945697a887f0c1b2d581503d92dcde6f
Gitweb: http://git.kernel.org/tip/009ad5d5945697a887f0c1b2d581503d92dcde6f
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 2 Jun 2016 11:02:05 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 6 Jun 2016 18:18:44 -0300
tools lib bpf: Rename bpf_map__get_name() to bpf_map__name()
For consistency, leaving "get" for reference counting.
Acked-by: Wang Nan <wangnan0@huawei.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-crnflv84ejyhpba933ec71gs@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/bpf/libbpf.c | 6 ++----
tools/lib/bpf/libbpf.h | 2 +-
tools/perf/util/bpf-loader.c | 18 ++++++------------
3 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 9bba1a9..4dc617b 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1328,11 +1328,9 @@ int bpf_map__get_def(struct bpf_map *map, struct bpf_map_def *pdef)
return 0;
}
-const char *bpf_map__get_name(struct bpf_map *map)
+const char *bpf_map__name(struct bpf_map *map)
{
- if (!map)
- return NULL;
- return map->name;
+ return map ? map->name : NULL;
}
int bpf_map__set_private(struct bpf_map *map, void *priv,
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 916abf9..f8fbba4 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -182,7 +182,7 @@ bpf_map__next(struct bpf_map *map, struct bpf_object *obj);
int bpf_map__get_fd(struct bpf_map *map);
int bpf_map__get_def(struct bpf_map *map, struct bpf_map_def *pdef);
-const char *bpf_map__get_name(struct bpf_map *map);
+const char *bpf_map__name(struct bpf_map *map);
typedef void (*bpf_map_clear_priv_t)(struct bpf_map *, void *);
int bpf_map__set_private(struct bpf_map *map, void *priv,
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index e9a034e..c819eb8 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -897,10 +897,9 @@ bpf_map_priv__clone(struct bpf_map_priv *priv)
static int
bpf_map__add_op(struct bpf_map *map, struct bpf_map_op *op)
{
+ const char *map_name = bpf_map__name(map);
struct bpf_map_priv *priv = bpf_map__priv(map);
- const char *map_name;
- map_name = bpf_map__get_name(map);
if (IS_ERR(priv)) {
pr_debug("Failed to get private from map %s\n", map_name);
return PTR_ERR(priv);
@@ -948,11 +947,9 @@ __bpf_map__config_value(struct bpf_map *map,
{
struct bpf_map_def def;
struct bpf_map_op *op;
- const char *map_name;
+ const char *map_name = bpf_map__name(map);
int err;
- map_name = bpf_map__get_name(map);
-
err = bpf_map__get_def(map, &def);
if (err) {
pr_debug("Unable to get map definition from '%s'\n",
@@ -1014,10 +1011,9 @@ __bpf_map__config_event(struct bpf_map *map,
struct perf_evsel *evsel;
struct bpf_map_def def;
struct bpf_map_op *op;
- const char *map_name;
+ const char *map_name = bpf_map__name(map);
int err;
- map_name = bpf_map__get_name(map);
evsel = perf_evlist__find_evsel_by_str(evlist, term->val.str);
if (!evsel) {
pr_debug("Event (for '%s') '%s' doesn't exist\n",
@@ -1259,13 +1255,11 @@ bpf_map_config_foreach_key(struct bpf_map *map,
void *arg)
{
int err, map_fd;
- const char *name;
struct bpf_map_op *op;
struct bpf_map_def def;
+ const char *name = bpf_map__name(map);
struct bpf_map_priv *priv = bpf_map__priv(map);
- name = bpf_map__get_name(map);
-
if (IS_ERR(priv)) {
pr_debug("ERROR: failed to get private from map %s\n", name);
return -BPF_LOADER_ERRNO__INTERNAL;
@@ -1472,9 +1466,9 @@ int bpf__apply_obj_config(void)
#define bpf__for_each_stdout_map(pos, obj, objtmp) \
bpf__for_each_map(pos, obj, objtmp) \
- if (bpf_map__get_name(pos) && \
+ if (bpf_map__name(pos) && \
(strcmp("__bpf_stdout__", \
- bpf_map__get_name(pos)) == 0))
+ bpf_map__name(pos)) == 0))
int bpf__setup_stdout(struct perf_evlist *evlist __maybe_unused)
{
reply other threads:[~2016-06-08 8:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=tip-crnflv84ejyhpba933ec71gs@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.