linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH 2/2] trace_events/trace_export: Use __section
Date: Tue, 18 Feb 2020 18:03:18 -0800	[thread overview]
Message-ID: <71e7010925c59cd65273b4dbd3ec8ec8516d65cd.1582077699.git.joe@perches.com> (raw)
In-Reply-To: <cover.1582077698.git.joe@perches.com>

Convert __attribute__((section("foo"))) to __section(foo) to be a
bit more kernel style compliant and improve readability a tiny bit.

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/trace/trace_events.h | 29 +++++++++++------------------
 kernel/trace/trace_export.c  |  9 ++++-----
 2 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
index 361999f..a5b2eb 100644
--- a/include/trace/trace_events.h
+++ b/include/trace/trace_events.h
@@ -45,7 +45,7 @@ TRACE_MAKE_SYSTEM_STR();
 		.eval_value = a				\
 	};						\
 	static struct trace_eval_map __used		\
-	__attribute__((section("_ftrace_eval_map")))	\
+	__section(_ftrace_eval_map)			\
 	*TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
 
 #undef TRACE_DEFINE_SIZEOF
@@ -58,7 +58,7 @@ TRACE_MAKE_SYSTEM_STR();
 		.eval_value = sizeof(a)			\
 	};						\
 	static struct trace_eval_map __used		\
-	__attribute__((section("_ftrace_eval_map")))	\
+	__section(_ftrace_eval_map)			\
 	*TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
 
 /*
@@ -369,8 +369,7 @@ trace_raw_output_##call(struct trace_iterator *iter, int flags,		\
 									\
 	return trace_handle_return(s);					\
 }									\
-static struct trace_event_functions					\
-__attribute__((section("_ftrace_data")))				\
+static struct trace_event_functions __section(_ftrace_data)		\
 trace_event_type_funcs_##call = {					\
 	.trace			= trace_raw_output_##call,		\
 };
@@ -441,8 +440,7 @@ static struct trace_event_functions trace_event_type_funcs_##call = {	\
 
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print)	\
-static struct trace_event_fields					\
-__attribute__((section("_ftrace_data")))				\
+static struct trace_event_fields __section(_ftrace_data)		\
 trace_event_fields_##call[] = {						\
 	tstruct								\
 	{}								\
@@ -624,7 +622,7 @@ static inline notrace int trace_event_get_offsets_##call(		\
  * // its only safe to use pointers when doing linker tricks to
  * // create an array.
  * static struct trace_event_call __used
- * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>;
+ * __section(_ftrace_events) *__event_<call> = &event_<call>;
  *
  */
 
@@ -751,7 +749,7 @@ static inline void ftrace_test_probe_##call(void)			\
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)	\
 _TRACE_PERF_PROTO(call, PARAMS(proto));					\
-static char __attribute__((section("_ftrace_data")))			\
+static char __section(_ftrace_data)					\
 print_fmt_##call[] = print;						\
 static struct trace_event_class __used __refdata event_class_##call = { \
 	.system			= TRACE_SYSTEM_STRING,			\
@@ -766,8 +764,7 @@ static struct trace_event_class __used __refdata event_class_##call = { \
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, call, proto, args)			\
 									\
-static struct trace_event_call __used					\
-__attribute__((section("_ftrace_data")))				\
+static struct trace_event_call __used __section(_ftrace_data)		\
 event_##call = {							\
 	.class			= &event_class_##template,		\
 	{								\
@@ -777,18 +774,15 @@ event_##call = {							\
 	.print_fmt		= print_fmt_##template,			\
 	.flags			= TRACE_EVENT_FL_TRACEPOINT,		\
 };									\
-static struct trace_event_call __used					\
-__attribute__((section("_ftrace_events")))				\
+static struct trace_event_call __used __section(_ftrace_events)		\
 *__event_##call = &event_##call
 
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, call, proto, args, print)		\
-									\
-static char __attribute__((section("_ftrace_data")))			\
+static char __section(_ftrace_data)					\
 print_fmt_##call[] = print;						\
 									\
-static struct trace_event_call __used					\
-__attribute__((section("_ftrace_data")))				\
+static struct trace_event_call __used __section(_ftrace_data)		\
 event_##call = {							\
 	.class			= &event_class_##template,		\
 	{								\
@@ -798,8 +792,7 @@ event_##call = {							\
 	.print_fmt		= print_fmt_##call,			\
 	.flags			= TRACE_EVENT_FL_TRACEPOINT,		\
 };									\
-static struct trace_event_call __used					\
-__attribute__((section("_ftrace_events")))				\
+static struct trace_event_call __used __section(_ftrace_events)		\
 *__event_##call = &event_##call
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 90af7c9..e38a672 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -111,8 +111,7 @@ static void __always_unused ____ftrace_check_##name(void)		\
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(name, struct_name, id, tstruct, print)		\
-static struct trace_event_fields					\
-__attribute__((section("_ftrace_data")))				\
+static struct trace_event_fields __section(_ftrace_data)		\
 ftrace_event_fields_##name[] = {					\
 	tstruct								\
 	{}								\
@@ -153,7 +152,7 @@ static struct trace_event_class __refdata event_class_ftrace_##call = {	\
 	.reg			= regfn,				\
 };									\
 									\
-struct trace_event_call __used __attribute((section("_ftrace_data")))	\
+struct trace_event_call __used __section(_ftrace_data)			\
 event_##call = {							\
 	.class			= &event_class_ftrace_##call,		\
 	{								\
@@ -163,8 +162,8 @@ event_##call = {							\
 	.print_fmt		= print,				\
 	.flags			= TRACE_EVENT_FL_IGNORE_ENABLE,		\
 };									\
-static struct trace_event_call __used						\
-__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
+static struct trace_event_call * __used __section(_ftrace_events)	\
+__event_##call = &event_##call;
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(call, struct_name, etype, tstruct, print)		\
-- 
2.24.0


  parent reply	other threads:[~2020-02-19  2:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  2:03 [RFC PATCH 0/2] trace: Move trace data to new section _ftrace_data Joe Perches
2020-02-19  2:03 ` [RFC PATCH 1/2] trace: Move " Joe Perches
2020-02-19  2:03 ` Joe Perches [this message]
2020-02-19  2:53 ` [RFC PATCH 0/2] trace: Move trace " Steven Rostedt
2020-02-19  3:09   ` Joe Perches
2020-02-19  3:26     ` Steven Rostedt
2020-02-19  3:33       ` Joe Perches

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=71e7010925c59cd65273b4dbd3ec8ec8516d65cd.1582077699.git.joe@perches.com \
    --to=joe@perches.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;
as well as URLs for NNTP newsgroup(s).