diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-03 11:38:21 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-06 17:19:49 -0400 |
commit | edb13ed47c1a196eca4b669b7c20d26b27260813 (patch) | |
tree | adea0430f469284d1f722d0d01215346607c85b7 | |
parent | be834ffbd15ea9d73ba96fdbdcb1012add7e3bdf (diff) |
tools lib bpf: Rename set_private() to set_priv()
For consistency with class__priv() elsewhere, and with the callback
typedef for clearing those areas (e.g. bpf_map_clear_priv_t).
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-rnbiyv27ohw8xppsgx0el3xb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/lib/bpf/libbpf.c | 9 | ||||
-rw-r--r-- | tools/lib/bpf/libbpf.h | 8 | ||||
-rw-r--r-- | tools/perf/util/bpf-loader.c | 6 |
3 files changed, 11 insertions, 12 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 7eb7fb26e999..462e526a4465 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c | |||
@@ -1218,9 +1218,8 @@ bpf_program__next(struct bpf_program *prev, struct bpf_object *obj) | |||
1218 | return &obj->programs[idx]; | 1218 | return &obj->programs[idx]; |
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | int bpf_program__set_private(struct bpf_program *prog, | 1221 | int bpf_program__set_priv(struct bpf_program *prog, void *priv, |
1222 | void *priv, | 1222 | bpf_program_clear_priv_t clear_priv) |
1223 | bpf_program_clear_priv_t clear_priv) | ||
1224 | { | 1223 | { |
1225 | if (prog->priv && prog->clear_priv) | 1224 | if (prog->priv && prog->clear_priv) |
1226 | prog->clear_priv(prog, prog->priv); | 1225 | prog->clear_priv(prog, prog->priv); |
@@ -1319,8 +1318,8 @@ const char *bpf_map__name(struct bpf_map *map) | |||
1319 | return map ? map->name : NULL; | 1318 | return map ? map->name : NULL; |
1320 | } | 1319 | } |
1321 | 1320 | ||
1322 | int bpf_map__set_private(struct bpf_map *map, void *priv, | 1321 | int bpf_map__set_priv(struct bpf_map *map, void *priv, |
1323 | bpf_map_clear_priv_t clear_priv) | 1322 | bpf_map_clear_priv_t clear_priv) |
1324 | { | 1323 | { |
1325 | if (!map) | 1324 | if (!map) |
1326 | return -EINVAL; | 1325 | return -EINVAL; |
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index 372cecbde207..722f46b2d553 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h | |||
@@ -78,8 +78,8 @@ struct bpf_program *bpf_program__next(struct bpf_program *prog, | |||
78 | typedef void (*bpf_program_clear_priv_t)(struct bpf_program *, | 78 | typedef void (*bpf_program_clear_priv_t)(struct bpf_program *, |
79 | void *); | 79 | void *); |
80 | 80 | ||
81 | int bpf_program__set_private(struct bpf_program *prog, void *priv, | 81 | int bpf_program__set_priv(struct bpf_program *prog, void *priv, |
82 | bpf_program_clear_priv_t clear_priv); | 82 | bpf_program_clear_priv_t clear_priv); |
83 | 83 | ||
84 | void *bpf_program__priv(struct bpf_program *prog); | 84 | void *bpf_program__priv(struct bpf_program *prog); |
85 | 85 | ||
@@ -184,8 +184,8 @@ const struct bpf_map_def *bpf_map__def(struct bpf_map *map); | |||
184 | const char *bpf_map__name(struct bpf_map *map); | 184 | const char *bpf_map__name(struct bpf_map *map); |
185 | 185 | ||
186 | typedef void (*bpf_map_clear_priv_t)(struct bpf_map *, void *); | 186 | typedef void (*bpf_map_clear_priv_t)(struct bpf_map *, void *); |
187 | int bpf_map__set_private(struct bpf_map *map, void *priv, | 187 | int bpf_map__set_priv(struct bpf_map *map, void *priv, |
188 | bpf_map_clear_priv_t clear_priv); | 188 | bpf_map_clear_priv_t clear_priv); |
189 | void *bpf_map__priv(struct bpf_map *map); | 189 | void *bpf_map__priv(struct bpf_map *map); |
190 | 190 | ||
191 | #endif | 191 | #endif |
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c index 1907d5313960..dcc8845881ae 100644 --- a/tools/perf/util/bpf-loader.c +++ b/tools/perf/util/bpf-loader.c | |||
@@ -339,7 +339,7 @@ config_bpf_program(struct bpf_program *prog) | |||
339 | } | 339 | } |
340 | pr_debug("bpf: config '%s' is ok\n", config_str); | 340 | pr_debug("bpf: config '%s' is ok\n", config_str); |
341 | 341 | ||
342 | err = bpf_program__set_private(prog, priv, clear_prog_priv); | 342 | err = bpf_program__set_priv(prog, priv, clear_prog_priv); |
343 | if (err) { | 343 | if (err) { |
344 | pr_debug("Failed to set priv for program '%s'\n", config_str); | 344 | pr_debug("Failed to set priv for program '%s'\n", config_str); |
345 | goto errout; | 345 | goto errout; |
@@ -910,7 +910,7 @@ bpf_map__add_op(struct bpf_map *map, struct bpf_map_op *op) | |||
910 | } | 910 | } |
911 | INIT_LIST_HEAD(&priv->ops_list); | 911 | INIT_LIST_HEAD(&priv->ops_list); |
912 | 912 | ||
913 | if (bpf_map__set_private(map, priv, bpf_map_priv__clear)) { | 913 | if (bpf_map__set_priv(map, priv, bpf_map_priv__clear)) { |
914 | free(priv); | 914 | free(priv); |
915 | return -BPF_LOADER_ERRNO__INTERNAL; | 915 | return -BPF_LOADER_ERRNO__INTERNAL; |
916 | } | 916 | } |
@@ -1515,7 +1515,7 @@ int bpf__setup_stdout(struct perf_evlist *evlist __maybe_unused) | |||
1515 | if (!priv) | 1515 | if (!priv) |
1516 | return -ENOMEM; | 1516 | return -ENOMEM; |
1517 | 1517 | ||
1518 | err = bpf_map__set_private(map, priv, bpf_map_priv__clear); | 1518 | err = bpf_map__set_priv(map, priv, bpf_map_priv__clear); |
1519 | if (err) { | 1519 | if (err) { |
1520 | bpf_map_priv__clear(map, priv); | 1520 | bpf_map_priv__clear(map, priv); |
1521 | return err; | 1521 | return err; |