aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_events.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r--kernel/trace/trace_events.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 3bcb9df9334..19332200c45 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -345,11 +345,59 @@ static struct dentry *event_trace_events_dir(void)
345 return d_events; 345 return d_events;
346} 346}
347 347
348struct event_subsystem {
349 struct list_head list;
350 const char *name;
351 struct dentry *entry;
352};
353
354static LIST_HEAD(event_subsystems);
355
356static struct dentry *
357event_subsystem_dir(const char *name, struct dentry *d_events)
358{
359 struct event_subsystem *system;
360
361 /* First see if we did not already create this dir */
362 list_for_each_entry(system, &event_subsystems, list) {
363 if (strcmp(system->name, name) == 0)
364 return system->entry;
365 }
366
367 /* need to create new entry */
368 system = kmalloc(sizeof(*system), GFP_KERNEL);
369 if (!system) {
370 pr_warning("No memory to create event subsystem %s\n",
371 name);
372 return d_events;
373 }
374
375 system->entry = debugfs_create_dir(name, d_events);
376 if (!system->entry) {
377 pr_warning("Could not create event subsystem %s\n",
378 name);
379 kfree(system);
380 return d_events;
381 }
382
383 system->name = name;
384 list_add(&system->list, &event_subsystems);
385
386 return system->entry;
387}
388
348static int 389static int
349event_create_dir(struct ftrace_event_call *call, struct dentry *d_events) 390event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
350{ 391{
351 struct dentry *entry; 392 struct dentry *entry;
352 393
394 /*
395 * If the trace point header did not define TRACE_SYSTEM
396 * then the system would be called "TRACE_SYSTEM".
397 */
398 if (strcmp(call->system, "TRACE_SYSTEM") != 0)
399 d_events = event_subsystem_dir(call->system, d_events);
400
353 call->dir = debugfs_create_dir(call->name, d_events); 401 call->dir = debugfs_create_dir(call->name, d_events);
354 if (!call->dir) { 402 if (!call->dir) {
355 pr_warning("Could not create debugfs " 403 pr_warning("Could not create debugfs "