tracing/events: move TRACE_SYSTEM outside of include guard
Subsystems (3)
PATCH 1/1 tracing/events: move TRACE_SYSTEM outside of include guard
If TRACE_INCLDUE_FILE is defined, <trace/events/TRACE_INCLUDE_FILE.h> will be included and compiled, otherwise it will be <trace/events/TRACE_SYSTEM.h>
So TRACE_SYSTEM should be defined outside of #if proctection, just like TRACE_INCLUDE_FILE.
Imaging this scenario:
#include <trace/events/foo.h>
-> TRACE_SYSTEM == foo
...
#include <trace/events/bar.h>
-> TRACE_SYSTEM == bar
...
#define CREATE_TRACE_POINTS
#include <trace/events/foo.h>
-> TRACE_SYSTEM == bar !!!and then bar.h will be included and compiled.
--- fs/gfs2/trace_gfs2.h | 8 +++--- include/trace/events/block.h | 6 ++-- include/trace/events/ext4.h | 6 ++-- include/trace/events/irq.h | 6 ++-- include/trace/events/jbd2.h | 6 ++-- include/trace/events/kmem.h | 6 ++-- include/trace/events/lockdep.h | 6 ++-- include/trace/events/sched.h | 6 ++-- include/trace/events/skb.h | 6 ++-- include/trace/events/workqueue.h | 6 ++-- samples/trace_events/trace-events-sample.h | 37 +++++++++++++++------------- 11 files changed, 51 insertions(+), 48 deletions(-)
fs/gfs2/trace_gfs2.h +4 -4
@@ -1,12 +1,11 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM gfs2 +#if !defined(_TRACE_GFS2_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GFS2_H#include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM gfs2 -#define TRACE_INCLUDE_FILE trace_gfs2 -#include <linux/fs.h> #include <linux/buffer_head.h> #include <linux/dlmconstants.h>
@@ -403,5 +402,6 @@ TRACE_EVENT(gfs2_block_alloc,/* This part must be outside protection */ #undef TRACE_INCLUDE_PATH#define TRACE_INCLUDE_PATH . +#define TRACE_INCLUDE_FILE trace_gfs2#include <trace/define_trace.h>
include/trace/events/block.h +3 -3
@@ -1,3 +1,6 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM block +#if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_BLOCK_H
@@ -5,9 +8,6 @@#include <linux/blkdev.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM block - TRACE_EVENT(block_rq_abort, TP_PROTO(struct request_queue *q, struct request *rq),
include/trace/events/ext4.h +3 -3
@@ -1,9 +1,9 @@ -#if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ ) -#define _TRACE_EXT4_H -#undef TRACE_SYSTEM#define TRACE_SYSTEM ext4 +#if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_EXT4_H +#include <linux/writeback.h> #include "../../../fs/ext4/ext4.h" #include "../../../fs/ext4/mballoc.h"
include/trace/events/irq.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM irq +#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_IRQ_H#include <linux/tracepoint.h> #include <linux/interrupt.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM irq -#define softirq_name (sirq) { sirq##_SOFTIRQ, #sirq }#define show_softirq_name (val) \ __print_symbolic(val, \
include/trace/events/jbd2.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM jbd2 +#if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_JBD2_H#include <linux/jbd2.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM jbd2 - TRACE_EVENT(jbd2_checkpoint, TP_PROTO(journal_t *journal, int result),
include/trace/events/kmem.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM kmem +#if !defined(_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_KMEM_H#include <linux/types.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM kmem -/* * The order of these masks is important. Matching masks will be seen * first and the left over flags will end up showing by themselves.
include/trace/events/lockdep.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM lockdep +#if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_LOCKDEP_H#include <linux/lockdep.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM lockdep -#ifdef CONFIG_LOCKDEP TRACE_EVENT(lock_acquire,
include/trace/events/sched.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM sched +#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_SCHED_H#include <linux/sched.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM sched -/* * Tracepoint for calling kthread_stop, performed to end a kthread: */
include/trace/events/skb.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM skb +#if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_SKB_H#include <linux/skbuff.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM skb -/* * Tracepoint for free an sk_buff: */
include/trace/events/workqueue.h +3 -3
@@ -1,3 +1,6 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM workqueue +#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_WORKQUEUE_H
@@ -5,9 +8,6 @@#include <linux/sched.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM workqueue - TRACE_EVENT(workqueue_insertion, TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
samples/trace_events/trace-events-sample.h +20 -17
@@ -1,21 +1,4 @@/* -* Notice that this file is not protected like a normal header. -* We also must allow for rereading of this file. The -* -* || defined(TRACE_HEADER_MULTI_READ) -* -* serves this purpose. -*/ -#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ ) -#define _TRACE_EVENT_SAMPLE_H - -/* -* All trace headers should include tracepoint.h, until we finally -* make it into a standard header. -*/ -#include <linux/tracepoint.h> - -/* * If TRACE_SYSTEM is defined, that will be the directory created * in the ftrace directory under /debugfs/tracing/events/<system> *
@@ -34,11 +17,31 @@* #define TRACE_INCLUDE_FILE trace-events-sample * * As we do an the bottom of this file. +* +* Notice that TRACE_SYSTEM should be defined outside of #if +* protection, just like TRACE_INCLUDE_FILE. */ #undef TRACE_SYSTEM#define TRACE_SYSTEM sample/* +* Notice that this file is not protected like a normal header. +* We also must allow for rereading of this file. The +* +* || defined(TRACE_HEADER_MULTI_READ) +* +* serves this purpose. +*/ +#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_EVENT_SAMPLE_H + +/* +* All trace headers should include tracepoint.h, until we finally +* make it into a standard header. +*/ +#include <linux/tracepoint.h> + +/* * The TRACE_EVENT macro is broken up into 5 parts. * * name: name of the trace point. This is also how to enable the tracepoint.
Signature · 1 line
1.5.4.rc3
[tip:tracing/urgent] tracing/events: Move TRACE_SYSTEM outside of include guard
Commit-ID: d0b6e04a4cd8360e3c9c419f7c30a3081a0c142a Gitweb: http://git.kernel.org/tip/d0b6e04a4cd8360e3c9c419f7c30a3081a0c142a Author: Li Zefan <[email protected]> AuthorDate: Mon, 13 Jul 2009 10:33:21 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jul 2009 10:59:55 +0200
tracing/events: Move TRACE_SYSTEM outside of include guard
If TRACE_INCLDUE_FILE is defined, <trace/events/TRACE_INCLUDE_FILE.h> will be included and compiled, otherwise it will be <trace/events/TRACE_SYSTEM.h>
So TRACE_SYSTEM should be defined outside of #if proctection, just like TRACE_INCLUDE_FILE.
Imaging this scenario:
#include <trace/events/foo.h>
-> TRACE_SYSTEM == foo
...
#include <trace/events/bar.h>
-> TRACE_SYSTEM == bar
...
#define CREATE_TRACE_POINTS
#include <trace/events/foo.h>
-> TRACE_SYSTEM == bar !!!and then bar.h will be included and compiled.
LKML-Reference: <[email protected]>
--- fs/gfs2/trace_gfs2.h | 8 +++--- include/trace/events/block.h | 6 ++-- include/trace/events/ext4.h | 6 ++-- include/trace/events/irq.h | 6 ++-- include/trace/events/jbd2.h | 6 ++-- include/trace/events/kmem.h | 6 ++-- include/trace/events/lockdep.h | 6 ++-- include/trace/events/sched.h | 6 ++-- include/trace/events/skb.h | 6 ++-- include/trace/events/workqueue.h | 6 ++-- samples/trace_events/trace-events-sample.h | 37 +++++++++++++++------------- 11 files changed, 51 insertions(+), 48 deletions(-)
fs/gfs2/trace_gfs2.h +4 -4
@@ -1,12 +1,11 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM gfs2 +#if !defined(_TRACE_GFS2_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GFS2_H#include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM gfs2 -#define TRACE_INCLUDE_FILE trace_gfs2 -#include <linux/fs.h> #include <linux/buffer_head.h> #include <linux/dlmconstants.h>
@@ -403,5 +402,6 @@ TRACE_EVENT(gfs2_block_alloc,/* This part must be outside protection */ #undef TRACE_INCLUDE_PATH#define TRACE_INCLUDE_PATH . +#define TRACE_INCLUDE_FILE trace_gfs2#include <trace/define_trace.h>
include/trace/events/block.h +3 -3
@@ -1,3 +1,6 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM block +#if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_BLOCK_H
@@ -5,9 +8,6 @@#include <linux/blkdev.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM block - TRACE_EVENT(block_rq_abort, TP_PROTO(struct request_queue *q, struct request *rq),
include/trace/events/ext4.h +3 -3
@@ -1,9 +1,9 @@ -#if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ ) -#define _TRACE_EXT4_H -#undef TRACE_SYSTEM#define TRACE_SYSTEM ext4 +#if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_EXT4_H +#include <linux/writeback.h> #include "../../../fs/ext4/ext4.h" #include "../../../fs/ext4/mballoc.h"
include/trace/events/irq.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM irq +#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_IRQ_H#include <linux/tracepoint.h> #include <linux/interrupt.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM irq -#define softirq_name (sirq) { sirq##_SOFTIRQ, #sirq }#define show_softirq_name (val) \ __print_symbolic(val, \
include/trace/events/jbd2.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM jbd2 +#if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_JBD2_H#include <linux/jbd2.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM jbd2 - TRACE_EVENT(jbd2_checkpoint, TP_PROTO(journal_t *journal, int result),
include/trace/events/kmem.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM kmem +#if !defined(_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_KMEM_H#include <linux/types.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM kmem -/* * The order of these masks is important. Matching masks will be seen * first and the left over flags will end up showing by themselves.
include/trace/events/lockdep.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM lockdep +#if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_LOCKDEP_H#include <linux/lockdep.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM lockdep -#ifdef CONFIG_LOCKDEP TRACE_EVENT(lock_acquire,
include/trace/events/sched.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM sched +#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_SCHED_H#include <linux/sched.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM sched -/* * Tracepoint for calling kthread_stop, performed to end a kthread: */
include/trace/events/skb.h +3 -3
@@ -1,12 +1,12 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM skb +#if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_SKB_H#include <linux/skbuff.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM skb -/* * Tracepoint for free an sk_buff: */
include/trace/events/workqueue.h +3 -3
@@ -1,3 +1,6 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM workqueue +#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_WORKQUEUE_H
@@ -5,9 +8,6 @@#include <linux/sched.h> #include <linux/tracepoint.h> -#undef TRACE_SYSTEM -#define TRACE_SYSTEM workqueue - TRACE_EVENT(workqueue_insertion, TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
samples/trace_events/trace-events-sample.h +20 -17
@@ -1,21 +1,4 @@/* -* Notice that this file is not protected like a normal header. -* We also must allow for rereading of this file. The -* -* || defined(TRACE_HEADER_MULTI_READ) -* -* serves this purpose. -*/ -#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ ) -#define _TRACE_EVENT_SAMPLE_H - -/* -* All trace headers should include tracepoint.h, until we finally -* make it into a standard header. -*/ -#include <linux/tracepoint.h> - -/* * If TRACE_SYSTEM is defined, that will be the directory created * in the ftrace directory under /debugfs/tracing/events/<system> *
@@ -34,11 +17,31 @@* #define TRACE_INCLUDE_FILE trace-events-sample * * As we do an the bottom of this file. +* +* Notice that TRACE_SYSTEM should be defined outside of #if +* protection, just like TRACE_INCLUDE_FILE. */ #undef TRACE_SYSTEM#define TRACE_SYSTEM sample/* +* Notice that this file is not protected like a normal header. +* We also must allow for rereading of this file. The +* +* || defined(TRACE_HEADER_MULTI_READ) +* +* serves this purpose. +*/ +#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_EVENT_SAMPLE_H + +/* +* All trace headers should include tracepoint.h, until we finally +* make it into a standard header. +*/ +#include <linux/tracepoint.h> + +/* * The TRACE_EVENT macro is broken up into 5 parts. * * name: name of the trace point. This is also how to enable the tracepoint.