|
@@ -851,8 +851,10 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
|
|
|
|
|
|
/* First see if we did not already create this dir */
|
|
/* First see if we did not already create this dir */
|
|
list_for_each_entry(system, &event_subsystems, list) {
|
|
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;
|
|
return system->entry;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/* need to create new entry */
|
|
/* need to create new entry */
|
|
@@ -871,6 +873,7 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
|
|
return d_events;
|
|
return d_events;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ system->nr_events = 1;
|
|
system->name = kstrdup(name, GFP_KERNEL);
|
|
system->name = kstrdup(name, GFP_KERNEL);
|
|
if (!system->name) {
|
|
if (!system->name) {
|
|
debugfs_remove(system->entry);
|
|
debugfs_remove(system->entry);
|
|
@@ -905,6 +908,32 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
|
|
return system->entry;
|
|
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
|
|
static int
|
|
event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
|
|
event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
|
|
const struct file_operations *id,
|
|
const struct file_operations *id,
|
|
@@ -1079,6 +1108,7 @@ static void trace_module_remove_events(struct module *mod)
|
|
list_del(&call->list);
|
|
list_del(&call->list);
|
|
trace_destroy_fields(call);
|
|
trace_destroy_fields(call);
|
|
destroy_preds(call);
|
|
destroy_preds(call);
|
|
|
|
+ remove_subsystem_dir(call->system);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|