perf bpf: Make bpf__for_each_stdout_map() generic

By passing a 'name' arg, that will eventually be used to setup more
"bpf-output" events, e.g. to create a event where to create raw_syscalls
like events that in addition to the syscall arguments will also copy the
pointer contents being passed from/to userspace.

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-talrnxps9p3qozk3aeh91fgv@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 53a5d7b8
...@@ -1529,12 +1529,15 @@ int bpf__apply_obj_config(void) ...@@ -1529,12 +1529,15 @@ int bpf__apply_obj_config(void)
bpf_object__for_each_safe(obj, objtmp) \ bpf_object__for_each_safe(obj, objtmp) \
bpf_map__for_each(pos, obj) bpf_map__for_each(pos, obj)
#define bpf__for_each_stdout_map(pos, obj, objtmp) \ #define bpf__for_each_map_named(pos, obj, objtmp, name) \
bpf__for_each_map(pos, obj, objtmp) \ bpf__for_each_map(pos, obj, objtmp) \
if (bpf_map__name(pos) && \ if (bpf_map__name(pos) && \
(strcmp("__bpf_stdout__", \ (strcmp(name, \
bpf_map__name(pos)) == 0)) bpf_map__name(pos)) == 0))
#define bpf__for_each_stdout_map(pos, obj, objtmp) \
bpf__for_each_map_named(pos, obj, objtmp, "__bpf_stdout__")
int bpf__setup_stdout(struct perf_evlist *evlist) int bpf__setup_stdout(struct perf_evlist *evlist)
{ {
struct bpf_map_priv *tmpl_priv = NULL; struct bpf_map_priv *tmpl_priv = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment