Skip to content

Commit

Permalink
tracing: Simplify code for showing of soft disabled flag
Browse files Browse the repository at this point in the history
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.

Link: http://lkml.kernel.org/r/9aff5af6dee2f5a40ca30df41c39d5f33e998d7a.1372479499.git.tom.zanussi@linux.intel.com

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Tom Zanussi authored and Steven Rostedt committed Jul 2, 2013
1 parent 3fe3d61 commit a439059
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
@@ -638,17 +638,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));
}

0 comments on commit a439059

Please sign in to comment.