summaryrefslogtreecommitdiffstats
path: root/tools/lib/api/fd/array.c
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-05-25 13:44:57 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-05-30 12:41:46 -0300
commit258e4bfcbdaa6d128c391e6e25f03d54dee4f226 (patch)
treeed95856af99c28a17a75a8d065365d0c5cbd7419 /tools/lib/api/fd/array.c
parent5a5ddeb6e3559675070df6b39ba32a4dd1ab4dd5 (diff)
downloadop-kernel-dev-258e4bfcbdaa6d128c391e6e25f03d54dee4f226.zip
op-kernel-dev-258e4bfcbdaa6d128c391e6e25f03d54dee4f226.tar.gz
tools: Pass arg to fdarray__filter's call back function
Before this patch there's no way to pass arguments to fdarray__filter's call back function. This improvement will be used by 'perf record' to support unmapping ring buffer for both main evlist and overwrite evlist. Without this patch there's no way to track overwrite evlist from 'struct fdarray'. Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1464183898-174512-10-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/api/fd/array.c')
-rw-r--r--tools/lib/api/fd/array.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lib/api/fd/array.c b/tools/lib/api/fd/array.c
index 0e636c4..b0a035f 100644
--- a/tools/lib/api/fd/array.c
+++ b/tools/lib/api/fd/array.c
@@ -85,7 +85,8 @@ int fdarray__add(struct fdarray *fda, int fd, short revents)
}
int fdarray__filter(struct fdarray *fda, short revents,
- void (*entry_destructor)(struct fdarray *fda, int fd))
+ void (*entry_destructor)(struct fdarray *fda, int fd, void *arg),
+ void *arg)
{
int fd, nr = 0;
@@ -95,7 +96,7 @@ int fdarray__filter(struct fdarray *fda, short revents,
for (fd = 0; fd < fda->nr; ++fd) {
if (fda->entries[fd].revents & revents) {
if (entry_destructor)
- entry_destructor(fda, fd);
+ entry_destructor(fda, fd, arg);
continue;
}
OpenPOWER on IntegriCloud