diff options
| author | Peter Zijlstra <[email protected]> | 2010-03-03 15:55:04 +0100 |
|---|---|---|
| committer | Ingo Molnar <[email protected]> | 2010-03-10 13:22:23 +0100 |
| commit | dc1d628a67a8f042e711ea5accc0beedc3ef0092 (patch) | |
| tree | 728f72a5f9a8368b225890a95ea947c1c8cda301 /include/linux | |
| parent | 548b84166917d6f5e2296123b85ad24aecd3801d (diff) | |
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 <[email protected]>
Acked-by: Jean Pihet <[email protected]>
Reviewed-by: Frederic Weisbecker <[email protected]>
Acked-by: David S. Miller <[email protected]>
Cc: Jamie Iles <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'include/linux')
| -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 90e0521b1690..6f8cd7da1a01 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -801,6 +801,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, |