mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: rostedt@goodmis.org
Cc: masami.hiramatsu.pt@hitachi.com, jovi.zhangwei@huawei.com,
	linux-kernel@vger.kernel.org,
	Tom Zanussi <tom.zanussi@linux.intel.com>
Subject: [PATCH v2 01/11] tracing: simplify event_enable_read()
Date: Sat, 29 Jun 2013 00:08:04 -0500	[thread overview]
Message-ID: <9aff5af6dee2f5a40ca30df41c39d5f33e998d7a.1372479499.git.tom.zanussi@linux.intel.com> (raw)
In-Reply-To: <cover.1372479499.git.tom.zanussi@linux.intel.com>
In-Reply-To: <cover.1372479499.git.tom.zanussi@linux.intel.com>

Rather than enumerating each permutation, build the enable state
string up from the combination of states.  This also allows for the
simpler addition of more states.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 kernel/trace/trace_events.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 27963e2..ecb2609 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -624,17 +624,17 @@ event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
 		  loff_t *ppos)
 {
 	struct ftrace_event_file *file = filp->private_data;
-	char *buf;
+	char buf[4] = "0";
 
-	if (file->flags & FTRACE_EVENT_FL_ENABLED) {
-		if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED)
-			buf = "0*\n";
-		else if (file->flags & FTRACE_EVENT_FL_SOFT_MODE)
-			buf = "1*\n";
-		else
-			buf = "1\n";
-	} else
-		buf = "0\n";
+	if (file->flags & FTRACE_EVENT_FL_ENABLED &&
+	    !(file->flags & FTRACE_EVENT_FL_SOFT_DISABLED))
+		strcpy(buf, "1");
+
+	if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED ||
+	    file->flags & FTRACE_EVENT_FL_SOFT_MODE)
+		strcat(buf, "*");
+
+	strcat(buf, "\n");
 
 	return simple_read_from_buffer(ubuf, cnt, ppos, buf, strlen(buf));
 }
-- 
1.7.11.4


  reply	other threads:[~2013-06-29  5:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-29  5:08 [PATCH v2 00/11] tracing: trace event triggers Tom Zanussi
2013-06-29  5:08 ` Tom Zanussi [this message]
2013-06-29  5:08 ` [PATCH v2 02/11] tracing: add missing syscall_metadata comment Tom Zanussi
2013-06-29  5:08 ` [PATCH v2 03/11] tracing: add soft disable for syscall events Tom Zanussi
2013-06-29  6:26   ` zhangwei(Jovi)
2013-07-01 11:26   ` Masami Hiramatsu
2013-06-29  5:08 ` [PATCH v2 04/11] tracing: fix disabling of soft disable Tom Zanussi
2013-06-29  5:08 ` [PATCH v2 05/11] tracing: add basic event trigger framework Tom Zanussi
2013-06-29  5:08 ` [PATCH v2 06/11] tracing: add 'traceon' and 'traceoff' event trigger commands Tom Zanussi
2013-06-29  5:08 ` [PATCH v2 07/11] tracing: add 'snapshot' event trigger command Tom Zanussi
2013-06-29  5:08 ` [PATCH v2 08/11] tracing: add 'stacktrace' " Tom Zanussi
2013-06-29  5:08 ` [PATCH v2 09/11] tracing: add 'enable_event' and 'disable_event' event trigger commands Tom Zanussi
2013-06-29  5:08 ` [PATCH v2 10/11] tracing: add and use generic set_trigger_filter() implementation Tom Zanussi
2013-06-29  5:08 ` [PATCH v2 11/11] tracing: add documentation for trace event triggers Tom Zanussi
2013-06-29  9:30 ` [PATCH v2 00/11] tracing: " zhangwei(Jovi)
2013-07-01 12:32   ` Masami Hiramatsu
2013-07-02  4:53     ` zhangwei(Jovi)
2013-07-01 15:49   ` Tom Zanussi
2013-07-02  3:54     ` zhangwei(Jovi)
2013-07-02 14:46       ` Tom Zanussi

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=9aff5af6dee2f5a40ca30df41c39d5f33e998d7a.1372479499.git.tom.zanussi@linux.intel.com \
    --to=tom.zanussi@linux.intel.com \
    --cc=jovi.zhangwei@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --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

all inboxes | Powered by JetHome®