[PATCH 09/24] tools lib fd array: Allow associating a pointer cookie with each entry

From: Arnaldo Carvalho de Melo
Date: Fri Jul 15 2016 - 16:52:34 EST


From: Wang Nan <wangnan0@xxxxxxxxxx>

Add a 'ptr' field to fdarray->priv array.

This feature will be used by following commits, which introduce
muiltiple 'struct perf_mmap' arrays for different types of mapping.

Because of this, during fdarray__filter(), a simple 'idx' is not enough.

Add a pointer cookie that allows to directly associate a 'struct
perf_mmap' pointer to an fdarray entry.

Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: He Kuang <hekuang@xxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Nilay Vaish <nilayvaish@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
Link: http://lkml.kernel.org/r/1468485287-33422-3-git-send-email-wangnan0@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/lib/api/fd/array.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/lib/api/fd/array.h b/tools/lib/api/fd/array.h
index e87fd800fa8d..71287dddc05f 100644
--- a/tools/lib/api/fd/array.h
+++ b/tools/lib/api/fd/array.h
@@ -22,6 +22,7 @@ struct fdarray {
struct pollfd *entries;
union {
int idx;
+ void *ptr;
} *priv;
};

--
2.7.4