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>
This commit is contained in:
@@ -1218,9 +1218,8 @@ bpf_program__next(struct bpf_program *prev, struct bpf_object *obj)
|
|||||||
return &obj->programs[idx];
|
return &obj->programs[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
int bpf_program__set_private(struct bpf_program *prog,
|
int bpf_program__set_priv(struct bpf_program *prog, void *priv,
|
||||||
void *priv,
|
bpf_program_clear_priv_t clear_priv)
|
||||||
bpf_program_clear_priv_t clear_priv)
|
|
||||||
{
|
{
|
||||||
if (prog->priv && prog->clear_priv)
|
if (prog->priv && prog->clear_priv)
|
||||||
prog->clear_priv(prog, prog->priv);
|
prog->clear_priv(prog, prog->priv);
|
||||||
@@ -1319,8 +1318,8 @@ const char *bpf_map__name(struct bpf_map *map)
|
|||||||
return map ? map->name : NULL;
|
return map ? map->name : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bpf_map__set_private(struct bpf_map *map, void *priv,
|
int bpf_map__set_priv(struct bpf_map *map, void *priv,
|
||||||
bpf_map_clear_priv_t clear_priv)
|
bpf_map_clear_priv_t clear_priv)
|
||||||
{
|
{
|
||||||
if (!map)
|
if (!map)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@@ -78,8 +78,8 @@ struct bpf_program *bpf_program__next(struct bpf_program *prog,
|
|||||||
typedef void (*bpf_program_clear_priv_t)(struct bpf_program *,
|
typedef void (*bpf_program_clear_priv_t)(struct bpf_program *,
|
||||||
void *);
|
void *);
|
||||||
|
|
||||||
int bpf_program__set_private(struct bpf_program *prog, void *priv,
|
int bpf_program__set_priv(struct bpf_program *prog, void *priv,
|
||||||
bpf_program_clear_priv_t clear_priv);
|
bpf_program_clear_priv_t clear_priv);
|
||||||
|
|
||||||
void *bpf_program__priv(struct bpf_program *prog);
|
void *bpf_program__priv(struct bpf_program *prog);
|
||||||
|
|
||||||
@@ -184,8 +184,8 @@ const struct bpf_map_def *bpf_map__def(struct bpf_map *map);
|
|||||||
const char *bpf_map__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 *);
|
typedef void (*bpf_map_clear_priv_t)(struct bpf_map *, void *);
|
||||||
int bpf_map__set_private(struct bpf_map *map, void *priv,
|
int bpf_map__set_priv(struct bpf_map *map, void *priv,
|
||||||
bpf_map_clear_priv_t clear_priv);
|
bpf_map_clear_priv_t clear_priv);
|
||||||
void *bpf_map__priv(struct bpf_map *map);
|
void *bpf_map__priv(struct bpf_map *map);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -339,7 +339,7 @@ config_bpf_program(struct bpf_program *prog)
|
|||||||
}
|
}
|
||||||
pr_debug("bpf: config '%s' is ok\n", config_str);
|
pr_debug("bpf: config '%s' is ok\n", config_str);
|
||||||
|
|
||||||
err = bpf_program__set_private(prog, priv, clear_prog_priv);
|
err = bpf_program__set_priv(prog, priv, clear_prog_priv);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_debug("Failed to set priv for program '%s'\n", config_str);
|
pr_debug("Failed to set priv for program '%s'\n", config_str);
|
||||||
goto errout;
|
goto errout;
|
||||||
@@ -910,7 +910,7 @@ bpf_map__add_op(struct bpf_map *map, struct bpf_map_op *op)
|
|||||||
}
|
}
|
||||||
INIT_LIST_HEAD(&priv->ops_list);
|
INIT_LIST_HEAD(&priv->ops_list);
|
||||||
|
|
||||||
if (bpf_map__set_private(map, priv, bpf_map_priv__clear)) {
|
if (bpf_map__set_priv(map, priv, bpf_map_priv__clear)) {
|
||||||
free(priv);
|
free(priv);
|
||||||
return -BPF_LOADER_ERRNO__INTERNAL;
|
return -BPF_LOADER_ERRNO__INTERNAL;
|
||||||
}
|
}
|
||||||
@@ -1515,7 +1515,7 @@ int bpf__setup_stdout(struct perf_evlist *evlist __maybe_unused)
|
|||||||
if (!priv)
|
if (!priv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
err = bpf_map__set_private(map, priv, bpf_map_priv__clear);
|
err = bpf_map__set_priv(map, priv, bpf_map_priv__clear);
|
||||||
if (err) {
|
if (err) {
|
||||||
bpf_map_priv__clear(map, priv);
|
bpf_map_priv__clear(map, priv);
|
||||||
return err;
|
return err;
|
||||||
|
Reference in New Issue
Block a user