aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Hart <dvhltc@us.ibm.com>2009-12-16 18:40:31 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-12-17 10:38:19 -0500
commit9c8be8eb5ce22b05d94883c6860b7d975959f44f (patch)
treefb4e7f4e915f460b0fb16c08b38bd6d69bae2781
parent861ba2a81310fd290101d04547c0a13c423b22cd (diff)
trace-cmd: Use opaque record type in pevent accessor functions
The caller of the pevent accessor functions: pevent_data_pid(pevent, data) for example Already have a struct record. Let them send that directly: pevent_data_pid(pevent, record) This decouples the API from the struct implementation and facilitates language bindings which use opaque pointers for passing the C structs around. Signed-off-by: Darren Hart <dvhltc@us.ibm.com> LKML-Reference: <4B297C79.2090004@us.ibm.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c14
-rw-r--r--parse-events.h12
-rw-r--r--trace-cmd.h8
3 files changed, 17 insertions, 17 deletions
diff --git a/parse-events.c b/parse-events.c
index 7112eb8..1a2c7ca 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -3081,13 +3081,13 @@ void pevent_data_lat_fmt(struct pevent *pevent,
3081/** 3081/**
3082 * pevent_data_type - parse out the given event type 3082 * pevent_data_type - parse out the given event type
3083 * @pevent: a handle to the pevent 3083 * @pevent: a handle to the pevent
3084 * @data: the raw data to read from 3084 * @rec: the record to read from
3085 * 3085 *
3086 * This returns the event id from the raw @data. 3086 * This returns the event id from the @rec.
3087 */ 3087 */
3088int pevent_data_type(struct pevent *pevent, void *data) 3088int pevent_data_type(struct pevent *pevent, struct record *rec)
3089{ 3089{
3090 return trace_parse_common_type(pevent, data); 3090 return trace_parse_common_type(pevent, rec->data);
3091} 3091}
3092 3092
3093/** 3093/**
@@ -3105,13 +3105,13 @@ struct event *pevent_data_event_from_type(struct pevent *pevent, int type)
3105/** 3105/**
3106 * pevent_data_pid - parse the PID from raw data 3106 * pevent_data_pid - parse the PID from raw data
3107 * @pevent: a handle to the pevent 3107 * @pevent: a handle to the pevent
3108 * @data: the raw data to parse 3108 * @rec: the record to parse
3109 * 3109 *
3110 * This returns the PID from a raw data. 3110 * This returns the PID from a raw data.
3111 */ 3111 */
3112int pevent_data_pid(struct pevent *pevent, void *data) 3112int pevent_data_pid(struct pevent *pevent, struct record *rec)
3113{ 3113{
3114 return parse_common_pid(pevent, data); 3114 return parse_common_pid(pevent, rec->data);
3115} 3115}
3116 3116
3117/** 3117/**
diff --git a/parse-events.h b/parse-events.h
index 9b5ba0d..e6f5806 100644
--- a/parse-events.h
+++ b/parse-events.h
@@ -14,6 +14,14 @@
14#define TRACE_SEQ_SIZE 4096 14#define TRACE_SEQ_SIZE 4096
15#endif 15#endif
16 16
17struct record {
18 unsigned long long ts;
19 unsigned long long offset;
20 int record_size; /* size of binary record */
21 int size; /* size of data */
22 void *data;
23};
24
17/* 25/*
18 * Trace sequences are used to allow a function to call several other functions 26 * Trace sequences are used to allow a function to call several other functions
19 * to create a string of data to use (up to a max of PAGE_SIZE). 27 * to create a string of data to use (up to a max of PAGE_SIZE).
@@ -368,9 +376,9 @@ pevent_find_event_by_name(struct pevent *pevent, const char *sys, const char *na
368 376
369void pevent_data_lat_fmt(struct pevent *pevent, 377void pevent_data_lat_fmt(struct pevent *pevent,
370 struct trace_seq *s, void *data, int size __unused); 378 struct trace_seq *s, void *data, int size __unused);
371int pevent_data_type(struct pevent *pevent, void *data); 379int pevent_data_type(struct pevent *pevent, struct record *rec);
372struct event *pevent_data_event_from_type(struct pevent *pevent, int type); 380struct event *pevent_data_event_from_type(struct pevent *pevent, int type);
373int pevent_data_pid(struct pevent *pevent, void *data); 381int pevent_data_pid(struct pevent *pevent, struct record *rec);
374const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid); 382const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid);
375void pevent_event_info(struct trace_seq *s, struct event *event, 383void pevent_event_info(struct trace_seq *s, struct event *event,
376 int cpu, void *data, int size, unsigned long long nsecs); 384 int cpu, void *data, int size, unsigned long long nsecs);
diff --git a/trace-cmd.h b/trace-cmd.h
index 4410f4c..9581778 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -29,14 +29,6 @@ enum {
29#define TS_SHIFT 27 29#define TS_SHIFT 27
30#endif 30#endif
31 31
32struct record {
33 unsigned long long ts;
34 unsigned long long offset;
35 int record_size; /* size of binary record */
36 int size; /* size of data */
37 void *data;
38};
39
40static inline void free_record(struct record *record) 32static inline void free_record(struct record *record)
41{ 33{
42 free(record); 34 free(record);