From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> Add a private field for tracecmd_input handle where callers can set it via tracecmd_set_private() and retrieve it with tracecmd_get_private(). This will allow a way to find specific information about a handle for users of tracecmd_iterate_events_multi(). Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> --- include/trace-cmd/trace-cmd.h | 3 +++ lib/trace-cmd/trace-input.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h index 86a3486972cc..e8d72c76c02a 100644 --- a/include/trace-cmd/trace-cmd.h +++ b/include/trace-cmd/trace-cmd.h @@ -48,6 +48,9 @@ int tracecmd_buffer_instances(struct tracecmd_input *handle); const char *tracecmd_buffer_instance_name(struct tracecmd_input *handle, int indx); struct tracecmd_input *tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx); +void tracecmd_set_private(struct tracecmd_input *handle, void *data); +void *tracecmd_get_private(struct tracecmd_input *handle); + int tracecmd_iterate_events(struct tracecmd_input *handle, cpu_set_t *cpus, int cpu_size, int (*callback)(struct tracecmd_input *handle, diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index 5df10716013d..a3f17070c269 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -215,6 +215,8 @@ struct tracecmd_input { /* For custom profilers. */ tracecmd_show_data_func show_data_func; + + void *private; }; __thread struct tracecmd_input *tracecmd_curr_thread_handle; @@ -245,6 +247,16 @@ enum tracecmd_file_states tracecmd_get_file_state(struct tracecmd_input *handle) return handle->file_state; } +void tracecmd_set_private(struct tracecmd_input *handle, void *data) +{ + handle->private = data; +} + +void *tracecmd_get_private(struct tracecmd_input *handle) +{ + return handle->private; +} + #if DEBUG_RECORD static void remove_record(struct page *page, struct tep_record *record) { -- 2.35.1