For example:
__stringify(__entry->irq, __entry->ret) will convert it to:
"REC->irq, REC->ret"
It also support single argument as old macro.
Signed-off-by: Zhao Lei <[email protected]>
---
include/linux/stringify.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/stringify.h b/include/linux/stringify.h
index 0b43883..841cec8 100644
--- a/include/linux/stringify.h
+++ b/include/linux/stringify.h
@@ -6,7 +6,7 @@
* converts to "bar".
*/
-#define __stringify_1(x) #x
-#define __stringify(x) __stringify_1(x)
+#define __stringify_1(x...) #x
+#define __stringify(x...) __stringify_1(x)
#endif /* !__LINUX_STRINGIFY_H */
--
1.5.5.3
print fmt: "irq=%d return=%s", __entry->irq, __entry->ret ? \"handled\" : \"unhandled\"
"__entry" should be convert to "REC" by __stringify() macro.
Signed-off-by: Zhao Lei <[email protected]>
---
kernel/trace/trace_events_stage_2.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
index 9e47c39..d694a8a 100644
--- a/kernel/trace/trace_events_stage_2.h
+++ b/kernel/trace/trace_events_stage_2.h
@@ -108,10 +108,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
return 0;
#undef __entry
-#define __entry "REC"
+#define __entry REC
#undef TP_printk
-#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
+#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
#undef TRACE_EVENT
#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
--
1.5.5.3
On Wed, Apr 08, 2009 at 05:00:13PM +0800, Zhaolei wrote:
> print fmt: "irq=%d return=%s", __entry->irq, __entry->ret ? \"handled\" : \"unhandled\"
>
> "__entry" should be convert to "REC" by __stringify() macro.
>
> Signed-off-by: Zhao Lei <[email protected]>
> ---
> kernel/trace/trace_events_stage_2.h | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
> index 9e47c39..d694a8a 100644
> --- a/kernel/trace/trace_events_stage_2.h
> +++ b/kernel/trace/trace_events_stage_2.h
> @@ -108,10 +108,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
> return 0;
>
> #undef __entry
> -#define __entry "REC"
> +#define __entry REC
>
> #undef TP_printk
> -#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
> +#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
>
> #undef TRACE_EVENT
> #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
> --
> 1.5.5.3
>
>
Ah indeed nice catch.
The patch that expands stringify to multiple args looks good too.
On Wed, Apr 08, 2009 at 05:00:13PM +0800, Zhaolei wrote:
> print fmt: "irq=%d return=%s", __entry->irq, __entry->ret ? \"handled\" : \"unhandled\"
>
> "__entry" should be convert to "REC" by __stringify() macro.
>
> Signed-off-by: Zhao Lei <[email protected]>
> ---
> kernel/trace/trace_events_stage_2.h | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
> index 9e47c39..d694a8a 100644
> --- a/kernel/trace/trace_events_stage_2.h
> +++ b/kernel/trace/trace_events_stage_2.h
> @@ -108,10 +108,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
> return 0;
>
> #undef __entry
> -#define __entry "REC"
> +#define __entry REC
>
> #undef TP_printk
> -#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
> +#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
>
> #undef TRACE_EVENT
> #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
> --
> 1.5.5.3
>
>
Nice catch!
The other patch that expands stringify to multiple args looks good too.
* Zhaolei <[email protected]> wrote:
> print fmt: "irq=%d return=%s", __entry->irq, __entry->ret ? \"handled\" : \"unhandled\"
>
> "__entry" should be convert to "REC" by __stringify() macro.
>
> Signed-off-by: Zhao Lei <[email protected]>
> ---
> kernel/trace/trace_events_stage_2.h | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
good fix, but it is causing build trouble when applied to latest
tip/master:
include/trace/sched_event_types.h:257:1: error: macro "__stringify"
passed 3 arguments, but takes just 1
see: http://people.redhat.com/mingo/tip.git/README
Ingo
Commit-ID: 8f7c2c37319a81ef4c2bfdec67b1ccd5744d97e4
Gitweb: http://git.kernel.org/tip/8f7c2c37319a81ef4c2bfdec67b1ccd5744d97e4
Author: Zhaolei <[email protected]>
AuthorDate: Wed, 8 Apr 2009 16:58:57 +0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Fri, 10 Apr 2009 15:48:52 +0200
Make __stringify support variable argument macros too
For example:
__stringify(__entry->irq, __entry->ret)
will now convert it to:
"REC->irq, REC->ret"
It also still supports single arguments as the old macro did.
Signed-off-by: Zhao Lei <[email protected]>
Acked-by: Frederic Weisbecker <[email protected]>
Cc: Steven Rostedt <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
include/linux/stringify.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/stringify.h b/include/linux/stringify.h
index 0b43883..841cec8 100644
--- a/include/linux/stringify.h
+++ b/include/linux/stringify.h
@@ -6,7 +6,7 @@
* converts to "bar".
*/
-#define __stringify_1(x) #x
-#define __stringify(x) __stringify_1(x)
+#define __stringify_1(x...) #x
+#define __stringify(x...) __stringify_1(x)
#endif /* !__LINUX_STRINGIFY_H */
Commit-ID: 0462b5664b2bda5a18fef7efb5bb32ce36590c1a
Gitweb: http://git.kernel.org/tip/0462b5664b2bda5a18fef7efb5bb32ce36590c1a
Author: Zhaolei <[email protected]>
AuthorDate: Wed, 8 Apr 2009 17:00:13 +0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Fri, 10 Apr 2009 15:48:53 +0200
ftrace: Output REC->var instead of __entry->var for trace format
print fmt: "irq=%d return=%s", __entry->irq, __entry->ret ? \"handled\" : \"unhandled\"
"__entry" should be convert to "REC" by __stringify() macro.
Signed-off-by: Zhao Lei <[email protected]>
Acked-by: Frederic Weisbecker <[email protected]>
Cc: Steven Rostedt <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
kernel/trace/trace_events_stage_2.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
index 30743f7..d363c66 100644
--- a/kernel/trace/trace_events_stage_2.h
+++ b/kernel/trace/trace_events_stage_2.h
@@ -105,10 +105,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
return 0;
#undef __entry
-#define __entry "REC"
+#define __entry REC
#undef TP_printk
-#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
+#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
#undef TP_fast_assign
#define TP_fast_assign(args...) args