aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-03-03 09:55:04 -0500
committerIngo Molnar <mingo@elte.hu>2010-03-10 07:22:23 -0500
commitdc1d628a67a8f042e711ea5accc0beedc3ef0092 (patch)
tree728f72a5f9a8368b225890a95ea947c1c8cda301 /include
parent548b84166917d6f5e2296123b85ad24aecd3801d (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 <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> Cc: stable@kernel.org LKML-Reference: <20100304140100.315416040@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/linux/perf_event.h7
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 {
801 struct perf_raw_record *raw; 801 struct perf_raw_record *raw;
802}; 802};
803 803
804static inline
805void perf_sample_data_init(struct perf_sample_data *data, u64 addr)
806{
807 data->addr = addr;
808 data->raw = NULL;
809}
810
804extern void perf_output_sample(struct perf_output_handle *handle, 811extern void perf_output_sample(struct perf_output_handle *handle,
805 struct perf_event_header *header, 812 struct perf_event_header *header,
806 struct perf_sample_data *data, 813 struct perf_sample_data *data,