Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257115
b: refs/heads/master
c: 40ee4df
h: refs/heads/master
i:
  257113: ec80e33
  257111: 2626085
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Jul 7, 2011
1 parent 6a697db commit c1bc787
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e9dbfae53eeb9fc3d4bb7da3df87fa9875f5da02
refs/heads/master: 40ee4dffff061399eb9358e0c8fcfbaf8de4c8fe
31 changes: 22 additions & 9 deletions trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ system_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
loff_t *ppos)
{
const char set_to_char[4] = { '?', '0', '1', 'X' };
const char *system = filp->private_data;
struct event_subsystem *system = filp->private_data;
struct ftrace_event_call *call;
char buf[2];
int set = 0;
Expand All @@ -568,7 +568,7 @@ system_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
if (!call->name || !call->class || !call->class->reg)
continue;

if (system && strcmp(call->class->system, system) != 0)
if (system && strcmp(call->class->system, system->name) != 0)
continue;

/*
Expand Down Expand Up @@ -598,7 +598,8 @@ static ssize_t
system_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
loff_t *ppos)
{
const char *system = filp->private_data;
struct event_subsystem *system = filp->private_data;
const char *name = NULL;
unsigned long val;
char buf[64];
ssize_t ret;
Expand All @@ -622,7 +623,14 @@ system_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
if (val != 0 && val != 1)
return -EINVAL;

ret = __ftrace_set_clr_event(NULL, system, NULL, val);
/*
* Opening of "enable" adds a ref count to system,
* so the name is safe to use.
*/
if (system)
name = system->name;

ret = __ftrace_set_clr_event(NULL, name, NULL, val);
if (ret)
goto out;

Expand Down Expand Up @@ -862,6 +870,9 @@ static int subsystem_open(struct inode *inode, struct file *filp)
struct event_subsystem *system = NULL;
int ret;

if (!inode->i_private)
goto skip_search;

/* Make sure the system still exists */
mutex_lock(&event_mutex);
list_for_each_entry(system, &event_subsystems, list) {
Expand All @@ -880,8 +891,9 @@ static int subsystem_open(struct inode *inode, struct file *filp)
if (system != inode->i_private)
return -ENODEV;

skip_search:
ret = tracing_open_generic(inode, filp);
if (ret < 0)
if (ret < 0 && system)
put_system(system);

return ret;
Expand All @@ -891,7 +903,8 @@ static int subsystem_release(struct inode *inode, struct file *file)
{
struct event_subsystem *system = inode->i_private;

put_system(system);
if (system)
put_system(system);

return 0;
}
Expand Down Expand Up @@ -1041,10 +1054,11 @@ static const struct file_operations ftrace_subsystem_filter_fops = {
};

static const struct file_operations ftrace_system_enable_fops = {
.open = tracing_open_generic,
.open = subsystem_open,
.read = system_enable_read,
.write = system_enable_write,
.llseek = default_llseek,
.release = subsystem_release,
};

static const struct file_operations ftrace_show_header_fops = {
Expand Down Expand Up @@ -1133,8 +1147,7 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
"'%s/filter' entry\n", name);
}

trace_create_file("enable", 0644, system->entry,
(void *)system->name,
trace_create_file("enable", 0644, system->entry, system,
&ftrace_system_enable_fops);

return system->entry;
Expand Down

0 comments on commit c1bc787

Please sign in to comment.