提交 a4390596 编写于 作者: T Tom Zanussi 提交者: Steven Rostedt

tracing: Simplify code for showing of soft disabled flag

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.comSigned-off-by: NTom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
上级 3fe3d619
...@@ -638,17 +638,17 @@ event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, ...@@ -638,17 +638,17 @@ event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
loff_t *ppos) loff_t *ppos)
{ {
struct ftrace_event_file *file = filp->private_data; 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_ENABLED &&
if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED) !(file->flags & FTRACE_EVENT_FL_SOFT_DISABLED))
buf = "0*\n"; strcpy(buf, "1");
else if (file->flags & FTRACE_EVENT_FL_SOFT_MODE)
buf = "1*\n"; if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED ||
else file->flags & FTRACE_EVENT_FL_SOFT_MODE)
buf = "1\n"; strcat(buf, "*");
} else
buf = "0\n"; strcat(buf, "\n");
return simple_read_from_buffer(ubuf, cnt, ppos, buf, strlen(buf)); return simple_read_from_buffer(ubuf, cnt, ppos, buf, strlen(buf));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册