Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158390
b: refs/heads/master
c: dc82ec9
h: refs/heads/master
v: v3
  • Loading branch information
Xiao Guangrong authored and Ingo Molnar committed Jul 10, 2009
1 parent ffe7c20 commit 6c6881f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 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: c5cb183608167c744cb28bbd85884be5a4ce875d
refs/heads/master: dc82ec98a4727fd51b77e92d05fe7d2db3dcc11c
1 change: 1 addition & 0 deletions trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ struct event_subsystem {
const char *name;
struct dentry *entry;
void *filter;
int nr_events;
};

struct filter_pred;
Expand Down
32 changes: 31 additions & 1 deletion trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,10 @@ event_subsystem_dir(const char *name, struct dentry *d_events)

/* First see if we did not already create this dir */
list_for_each_entry(system, &event_subsystems, list) {
if (strcmp(system->name, name) == 0)
if (strcmp(system->name, name) == 0) {
system->nr_events++;
return system->entry;
}
}

/* need to create new entry */
Expand All @@ -871,6 +873,7 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
return d_events;
}

system->nr_events = 1;
system->name = kstrdup(name, GFP_KERNEL);
if (!system->name) {
debugfs_remove(system->entry);
Expand Down Expand Up @@ -905,6 +908,32 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
return system->entry;
}

static void remove_subsystem_dir(const char *name)
{
struct event_subsystem *system;

if (strcmp(name, TRACE_SYSTEM) == 0)
return;

list_for_each_entry(system, &event_subsystems, list) {
if (strcmp(system->name, name) == 0) {
if (!--system->nr_events) {
struct event_filter *filter = system->filter;

debugfs_remove_recursive(system->entry);
list_del(&system->list);
if (filter) {
kfree(filter->filter_string);
kfree(filter);
}
kfree(system->name);
kfree(system);
}
break;
}
}
}

static int
event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
const struct file_operations *id,
Expand Down Expand Up @@ -1079,6 +1108,7 @@ static void trace_module_remove_events(struct module *mod)
list_del(&call->list);
trace_destroy_fields(call);
destroy_preds(call);
remove_subsystem_dir(call->system);
}
}

Expand Down

0 comments on commit 6c6881f

Please sign in to comment.