Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140821
b: refs/heads/master
c: 6ecc2d1
h: refs/heads/master
i:
  140819: 2ce07f7
v: v3
  • Loading branch information
Steven Rostedt committed Feb 28, 2009
1 parent 508c769 commit ea9beb3
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb594e45f6979cd10b18d87f7b3f02119e00a108
refs/heads/master: 6ecc2d1ca39177edb6fbdb7412948b0e9f409d02
4 changes: 4 additions & 0 deletions trunk/kernel/trace/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* This is the place to register all trace points as events.
*/

/* someday this needs to go in a generic header */
#define __STR(x) #x
#define STR(x) __STR(x)

#include <trace/trace_events.h>

#include "trace_events.h"
Expand Down
48 changes: 48 additions & 0 deletions trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,59 @@ static struct dentry *event_trace_events_dir(void)
return d_events;
}

struct event_subsystem {
struct list_head list;
const char *name;
struct dentry *entry;
};

static LIST_HEAD(event_subsystems);

static struct dentry *
event_subsystem_dir(const char *name, struct dentry *d_events)
{
struct event_subsystem *system;

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

/* need to create new entry */
system = kmalloc(sizeof(*system), GFP_KERNEL);
if (!system) {
pr_warning("No memory to create event subsystem %s\n",
name);
return d_events;
}

system->entry = debugfs_create_dir(name, d_events);
if (!system->entry) {
pr_warning("Could not create event subsystem %s\n",
name);
kfree(system);
return d_events;
}

system->name = name;
list_add(&system->list, &event_subsystems);

return system->entry;
}

static int
event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
{
struct dentry *entry;

/*
* If the trace point header did not define TRACE_SYSTEM
* then the system would be called "TRACE_SYSTEM".
*/
if (strcmp(call->system, "TRACE_SYSTEM") != 0)
d_events = event_subsystem_dir(call->system, d_events);

call->dir = debugfs_create_dir(call->name, d_events);
if (!call->dir) {
pr_warning("Could not create debugfs "
Expand Down
2 changes: 2 additions & 0 deletions trunk/kernel/trace/trace_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

struct ftrace_event_call {
char *name;
char *system;
struct dentry *dir;
int enabled;
int (*regfunc)(void);
Expand Down Expand Up @@ -44,6 +45,7 @@ static struct ftrace_event_call __used \
__attribute__((__aligned__(4))) \
__attribute__((section("_ftrace_events"))) event_##call = { \
.name = #call, \
.system = STR(TRACE_SYSTEM), \
.regfunc = ftrace_reg_event_##call, \
.unregfunc = ftrace_unreg_event_##call, \
}
Expand Down

0 comments on commit ea9beb3

Please sign in to comment.