From: Li Zefan <lizf@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Jens Axboe <jens.axboe@oracle.com>,
Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Tom Zanussi <tzanussi@gmail.com>, "Theodore Ts'o" <tytso@mit.edu>,
Steven Whitehouse <swhiteho@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Jeff Moyer <jmoyer@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 1/2] tracing/events: make __string() more general
Date: Tue, 26 May 2009 12:04:28 +0800 [thread overview]
Message-ID: <4A1B6A4C.3070407@cn.fujitsu.com> (raw)
In-Reply-To: <4A1B6A2F.2040703@cn.fujitsu.com>
This changes __string(..., src) to __string(..., len), thus makes it more
general, and then block TRACE_EVENT() can use it.
Also introduce __fetch_str(), which is used in TP_assign() and returns
the address of the string, while __get_str() is used in TP_print().
[ Impact: TRACE_EVENT api change ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
include/trace/events/irq.h | 12 ++++++------
include/trace/events/lockdep.h | 8 ++++----
include/trace/ftrace.h | 21 +++++++++++++--------
3 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 32a9f7e..ce2b939 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -25,8 +25,8 @@ TRACE_EVENT(irq_handler_entry,
TP_ARGS(irq, action),
TP_STRUCT__entry(
- __field( int, irq )
- __string( name, action->name )
+ __field( int, irq )
+ __string( name, strlen(action->name) )
),
TP_fast_assign(
@@ -86,8 +86,8 @@ TRACE_EVENT(softirq_entry,
TP_ARGS(h, vec),
TP_STRUCT__entry(
- __field( int, vec )
- __string( name, softirq_to_name[h-vec] )
+ __field( int, vec )
+ __string( name, strlen(softirq_to_name[h-vec]) )
),
TP_fast_assign(
@@ -116,8 +116,8 @@ TRACE_EVENT(softirq_exit,
TP_ARGS(h, vec),
TP_STRUCT__entry(
- __field( int, vec )
- __string( name, softirq_to_name[h-vec] )
+ __field( int, vec )
+ __string( name, strlen(softirq_to_name[h-vec]) )
),
TP_fast_assign(
diff --git a/include/trace/events/lockdep.h b/include/trace/events/lockdep.h
index 0e956c9..e6218fd 100644
--- a/include/trace/events/lockdep.h
+++ b/include/trace/events/lockdep.h
@@ -19,7 +19,7 @@ TRACE_EVENT(lock_acquire,
TP_STRUCT__entry(
__field(unsigned int, flags)
- __string(name, lock->name)
+ __string(name, strlen(lock->name))
),
TP_fast_assign(
@@ -39,7 +39,7 @@ TRACE_EVENT(lock_release,
TP_ARGS(lock, nested, ip),
TP_STRUCT__entry(
- __string(name, lock->name)
+ __string(name, strlen(lock->name))
),
TP_fast_assign(
@@ -58,7 +58,7 @@ TRACE_EVENT(lock_contended,
TP_ARGS(lock, ip),
TP_STRUCT__entry(
- __string(name, lock->name)
+ __string(name, strlen(lock->name))
),
TP_fast_assign(
@@ -74,7 +74,7 @@ TRACE_EVENT(lock_acquired,
TP_ARGS(lock, ip, waittime),
TP_STRUCT__entry(
- __string(name, lock->name)
+ __string(name, strlen(lock->name))
__field(unsigned long, wait_usec)
__field(unsigned long, wait_nsec_rem)
),
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index b5ff2e8..430f7d2 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -25,7 +25,7 @@
#define __field(type, item) type item;
#undef __string
-#define __string(item, src) unsigned short __str_loc_##item;
+#define __string(item, len) unsigned short __str_loc_##item;
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args
@@ -66,7 +66,7 @@
#define __field(type, item);
#undef __string
-#define __string(item, src) int item;
+#define __string(item, len) int item;
#undef TRACE_EVENT
#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
@@ -186,7 +186,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
return 0;
#undef __string
-#define __string(item, src) \
+#define __string(item, len) \
ret = trace_seq_printf(s, "\tfield: __str_loc " #item ";\t" \
"offset:%u;tsize:%u;\n", \
(unsigned int)offsetof(typeof(field), \
@@ -239,7 +239,7 @@ ftrace_format_##call(struct trace_seq *s) \
return ret;
#undef __string
-#define __string(item, src) \
+#define __string(item, len) \
ret = trace_define_field(event_call, "__str_loc", #item, \
offsetof(typeof(field), __str_loc_##item), \
sizeof(field.__str_loc_##item), 0);
@@ -411,10 +411,15 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \
#define __array(type, item, len)
#undef __string
-#define __string(item, src) \
- __str_offsets.item = __str_size + \
- offsetof(typeof(*entry), __str_data); \
- __str_size += strlen(src) + 1;
+#define __string(item, len) \
+ __str_offsets.item = __str_size + \
+ offsetof(typeof(*entry), __str_data); \
+ __str_size += (len) + 1;
+
+#undef __fetch_str
+#define __fetch_str(dst) \
+ ({__entry->__str_loc_##dst = __str_offsets.dst; \
+ __get_str(dst);})
#undef __assign_str
#define __assign_str(dst, src) \
--
1.5.4.rc3
next prev parent reply other threads:[~2009-05-26 4:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-26 4:03 [PATCH v2 0/2] tracing/events: convert block trace points to TRACE_EVENT() Li Zefan
2009-05-26 4:04 ` Li Zefan [this message]
2009-05-26 6:02 ` [PATCH v2 1/2] tracing/events: make __string() more general Christoph Hellwig
2009-05-27 1:43 ` Li Zefan
2009-05-27 7:30 ` Christoph Hellwig
2009-05-27 8:12 ` Li Zefan
2009-05-27 9:55 ` Christoph Hellwig
2009-05-26 20:56 ` Steven Rostedt
2009-05-27 1:24 ` Li Zefan
2009-05-27 1:49 ` Steven Rostedt
2009-05-27 1:59 ` Li Zefan
2009-05-27 2:15 ` Steven Rostedt
2009-05-27 2:33 ` Li Zefan
2009-05-27 2:47 ` Steven Rostedt
2009-05-27 7:22 ` Christoph Hellwig
2009-05-26 4:05 ` [PATCH v2 2/2] tracing/events: convert block trace points to TRACE_EVENT() Li Zefan
2009-06-09 5:43 ` [PATCH v3] " Li Zefan
2009-06-10 9:22 ` [tip:tracing/core] " tip-bot for Li Zefan
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=4A1B6A4C.3070407@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=fweisbec@gmail.com \
--cc=hch@infradead.org \
--cc=jens.axboe@oracle.com \
--cc=jmoyer@redhat.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=swhiteho@redhat.com \
--cc=tytso@mit.edu \
--cc=tzanussi@gmail.com \
/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