diff options
author | Peter Zijlstra <peterz@infradead.org> | 2010-03-19 02:00:19 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-04-01 16:01:29 -0700 |
commit | 06432c9591a2607d70580333a50aba19344e2e40 (patch) | |
tree | cb1706f959b0dc06ef81ef1cd8378f634be53155 /include | |
parent | f3cfe648b427db8768a1039cfd201842ae8a4a1d (diff) | |
download | lwn-06432c9591a2607d70580333a50aba19344e2e40.tar.gz lwn-06432c9591a2607d70580333a50aba19344e2e40.zip |
perf: Provide generic perf_sample_data initialization
This makes it easier to extend perf_sample_data and fixes a bug on arm
and sparc, which failed to set ->raw to NULL, which can cause crashes
when combined with PERF_SAMPLE_RAW.
It also optimizes PowerPC and tracepoint, because the struct
initialization is forced to zero out the whole structure.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Jean Pihet <jpihet@mvista.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Jamie Iles <jamie.iles@picochip.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <20100304140100.315416040@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/perf_event.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index c8ea0c77a625..41f977bc53ac 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -793,6 +793,13 @@ struct perf_sample_data { struct perf_raw_record *raw; }; +static inline +void perf_sample_data_init(struct perf_sample_data *data, u64 addr) +{ + data->addr = addr; + data->raw = NULL; +} + extern void perf_output_sample(struct perf_output_handle *handle, struct perf_event_header *header, struct perf_sample_data *data, |