Re: [PATCH 02/15] perf tools: fix missing tool parameter

From: Adrian Hunter
Date: Thu Jun 27 2013 - 03:52:50 EST


On 25/06/13 16:04, Jiri Olsa wrote:
> On Mon, Jun 24, 2013 at 04:15:59PM +0300, Adrian Hunter wrote:
>> perf inject expects to get a reference to 'struct perf_inject'
>> from its 'tool' member. For that to work, 'tool' needs to be
>> a parameter of all tool callbacks. Make it so.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
>> ---
>> tools/perf/builtin-inject.c | 24 ++++++++++--------------
>> tools/perf/util/header.c | 6 ++++--
>> tools/perf/util/header.h | 6 ++++--
>> tools/perf/util/session.c | 11 +++++++----
>> tools/perf/util/tool.h | 9 ++++-----
>> 5 files changed, 29 insertions(+), 27 deletions(-)
>>
>> diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
>> index f299ddf..fb341f1 100644
>> --- a/tools/perf/builtin-inject.c
>> +++ b/tools/perf/builtin-inject.c
>> @@ -73,22 +73,17 @@ static int perf_event__repipe_event_type_synth(struct perf_tool *tool,
>> return perf_event__repipe_synth(tool, event);
>> }
>>
>> -static int perf_event__repipe_tracing_data_synth(union perf_event *event,
>> - struct perf_session *session
>> - __maybe_unused)
>> -{
>> - return perf_event__repipe_synth(NULL, event);
>> -}
>> -
>> -static int perf_event__repipe_attr(union perf_event *event,
>> - struct perf_evlist **pevlist __maybe_unused)
>> +static int perf_event__repipe_attr(struct perf_tool *tool,
>> + union perf_event *event,
>> + struct perf_evlist **pevlist)
>> {
>> int ret;
>> - ret = perf_event__process_attr(event, pevlist);
>> +
>> + ret = perf_event__process_attr(tool, event, pevlist);
>> if (ret)
>> return ret;
>>
>> - return perf_event__repipe_synth(NULL, event);
>> + return perf_event__repipe_synth(tool, event);
>> }
>>
>> static int perf_event__repipe(struct perf_tool *tool,
>> @@ -147,13 +142,14 @@ static int perf_event__repipe_fork(struct perf_tool *tool,
>> return err;
>> }
>>
>> -static int perf_event__repipe_tracing_data(union perf_event *event,
>> +static int perf_event__repipe_tracing_data(struct perf_tool *tool,
>> + union perf_event *event,
>> struct perf_session *session)
>> {
>> int err;
>>
>> perf_event__repipe_synth(NULL, event);
>
> wouldn't this one cause segfault?

Thanks for reviewing. Fixed in V2.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/