From: Darren Hart <dvhltc@us.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>,
"lkml, " <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] Use opaque record type in pevent accessor functions
Date: Wed, 16 Dec 2009 16:34:01 -0800 [thread overview]
Message-ID: <4B297C79.2090004@us.ibm.com> (raw)
>From 35c283e97c16525bbebae6f9937a1ccd0f3b8da9 Mon Sep 17 00:00:00 2001
From: Darren Hart <dvhltc@us.ibm.com>
Date: Wed, 16 Dec 2009 15:40:31 -0800
Subject: [PATCH 1/2] 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>
---
parse-events.c | 14 +++++++-------
parse-events.h | 12 ++++++++++--
trace-cmd.h | 8 --------
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,
/**
* pevent_data_type - parse out the given event type
* @pevent: a handle to the pevent
- * @data: the raw data to read from
+ * @rec: the record to read from
*
- * This returns the event id from the raw @data.
+ * This returns the event id from the @rec.
*/
-int pevent_data_type(struct pevent *pevent, void *data)
+int pevent_data_type(struct pevent *pevent, struct record *rec)
{
- return trace_parse_common_type(pevent, data);
+ return trace_parse_common_type(pevent, rec->data);
}
/**
@@ -3105,13 +3105,13 @@ struct event *pevent_data_event_from_type(struct pevent *pevent, int type)
/**
* pevent_data_pid - parse the PID from raw data
* @pevent: a handle to the pevent
- * @data: the raw data to parse
+ * @rec: the record to parse
*
* This returns the PID from a raw data.
*/
-int pevent_data_pid(struct pevent *pevent, void *data)
+int pevent_data_pid(struct pevent *pevent, struct record *rec)
{
- return parse_common_pid(pevent, data);
+ return parse_common_pid(pevent, rec->data);
}
/**
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 @@
#define TRACE_SEQ_SIZE 4096
#endif
+struct record {
+ unsigned long long ts;
+ unsigned long long offset;
+ int record_size; /* size of binary record */
+ int size; /* size of data */
+ void *data;
+};
+
/*
* Trace sequences are used to allow a function to call several other functions
* 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
void pevent_data_lat_fmt(struct pevent *pevent,
struct trace_seq *s, void *data, int size __unused);
-int pevent_data_type(struct pevent *pevent, void *data);
+int pevent_data_type(struct pevent *pevent, struct record *rec);
struct event *pevent_data_event_from_type(struct pevent *pevent, int type);
-int pevent_data_pid(struct pevent *pevent, void *data);
+int pevent_data_pid(struct pevent *pevent, struct record *rec);
const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid);
void pevent_event_info(struct trace_seq *s, struct event *event,
int cpu, void *data, int size, unsigned long long nsecs);
diff --git a/trace-cmd.h b/trace-cmd.h
index d6e4db0..1c4d359 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -28,14 +28,6 @@ enum {
#define TS_SHIFT 27
#endif
-struct record {
- unsigned long long ts;
- unsigned long long offset;
- int record_size; /* size of binary record */
- int size; /* size of data */
- void *data;
-};
-
static inline void free_record(struct record *record)
{
free(record);
--
1.6.3.3
--
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
next reply other threads:[~2009-12-17 0:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-17 0:34 Darren Hart [this message]
2009-12-17 0:35 ` [PATCH 2/2] RFC: " Darren Hart
2009-12-17 10:17 ` [PATCH 2/2 V2] tracecmd: Start of a tracecmd swig wrapper for python Darren Hart
2009-12-17 15:51 ` Steven Rostedt
2009-12-17 15:51 ` [PATCH 1/2] Use opaque record type in pevent accessor functions Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B297C79.2090004@us.ibm.com \
--to=dvhltc@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome