12 #include <linux/list.h>
13 #include <linux/slab.h>
14 #include <linux/rbtree.h>
44 static struct dentry *stat_dir;
66 else if (parent->
rb_left == node)
80 static void __reset_stat_session(
struct stat_session *session)
85 node = release_next(session->
ts, node);
90 static void reset_stat_session(
struct stat_session *session)
93 __reset_stat_session(session);
97 static void destroy_session(
struct stat_session *session)
100 __reset_stat_session(session);
126 result = cmp(data->
stat, this->stat);
130 new = &((*new)->rb_left);
132 new = &((*new)->rb_right);
135 rb_link_node(&data->
node, parent,
new);
145 static int dummy_cmp(
void *
p1,
void *p2)
164 __reset_stat_session(session);
173 ret = insert_stat(root, stat, ts->
stat_cmp);
187 ret = insert_stat(root, stat, ts->
stat_cmp);
189 goto exit_free_rbtree;
197 __reset_stat_session(session);
203 static void *stat_seq_start(
struct seq_file *
s, loff_t *
pos)
214 if (session->
ts->stat_headers) {
221 for (i = 0; node && i <
n; i++)
227 static void *stat_seq_next(
struct seq_file *s,
void *
p, loff_t *pos)
240 static void stat_seq_stop(
struct seq_file *s,
void *p)
246 static int stat_seq_show(
struct seq_file *s,
void *
v)
252 return session->
ts->stat_headers(s);
254 return session->
ts->stat_show(s, l->
stat);
258 .start = stat_seq_start,
259 .next = stat_seq_next,
260 .stop = stat_seq_stop,
261 .show = stat_seq_show
271 ret = stat_seq_init(session);
275 ret =
seq_open(file, &trace_stat_seq_ops);
277 reset_stat_session(session);
289 static int tracing_stat_release(
struct inode *i,
struct file *
f)
293 reset_stat_session(session);
299 .open = tracing_stat_open,
302 .release = tracing_stat_release
305 static int tracing_stat_init(
void)
314 "'trace_stat' entry\n");
320 if (!stat_dir && tracing_stat_init())
325 session, &tracing_stat_fops);
345 if (node->
ts == trace) {
353 session = kzalloc(
sizeof(*session),
GFP_KERNEL);
361 ret = init_stat_file(session);
363 destroy_session(session);
381 if (node->
ts == trace) {
383 destroy_session(node);