From 5efb123e5793fe2283f5b84421fbea3e69cba28f Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Tue, 8 Dec 2009 11:16:11 +0800 Subject: [PATCH] --- yaml --- r: 177343 b: refs/heads/master c: 13f16d209161c95e92aef40e350cc6cf56ac440b h: refs/heads/master i: 177341: c8a5f39bf319b69405387662d227e2aa4d331956 177339: 66dd75666639cb9312a4da6de1be70a6e3275ce1 177335: 1b1894c02ac264c63b788fadb9deae8d744944b0 177327: d69f5c7b50542ec9277f5552431caae41857c8dd 177311: fb4ca35e3f3aa544270ad10060e129c67d5eeeda 177279: 00084cf7fe7061d7dce69270f840aa7a46afae7b v: v3 --- [refs] | 2 +- trunk/kernel/trace/trace.c | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index f34c1a166998..d60c7df5c351 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fdb372ed4cadbfe9dbba0e932a77d0523682e690 +refs/heads/master: 13f16d209161c95e92aef40e350cc6cf56ac440b diff --git a/trunk/kernel/trace/trace.c b/trunk/kernel/trace/trace.c index a6c41cc63285..886268e0d8ee 100644 --- a/trunk/kernel/trace/trace.c +++ b/trunk/kernel/trace/trace.c @@ -3366,21 +3366,18 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, return cnt; } -static ssize_t tracing_clock_read(struct file *filp, char __user *ubuf, - size_t cnt, loff_t *ppos) +static int tracing_clock_show(struct seq_file *m, void *v) { - char buf[64]; - int bufiter = 0; int i; for (i = 0; i < ARRAY_SIZE(trace_clocks); i++) - bufiter += snprintf(buf + bufiter, sizeof(buf) - bufiter, + seq_printf(m, "%s%s%s%s", i ? " " : "", i == trace_clock_id ? "[" : "", trace_clocks[i].name, i == trace_clock_id ? "]" : ""); - bufiter += snprintf(buf + bufiter, sizeof(buf) - bufiter, "\n"); + seq_putc(m, '\n'); - return simple_read_from_buffer(ubuf, cnt, ppos, buf, bufiter); + return 0; } static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf, @@ -3422,6 +3419,13 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf, return cnt; } +static int tracing_clock_open(struct inode *inode, struct file *file) +{ + if (tracing_disabled) + return -ENODEV; + return single_open(file, tracing_clock_show, NULL); +} + static const struct file_operations tracing_max_lat_fops = { .open = tracing_open_generic, .read = tracing_max_lat_read, @@ -3460,8 +3464,10 @@ static const struct file_operations tracing_mark_fops = { }; static const struct file_operations trace_clock_fops = { - .open = tracing_open_generic, - .read = tracing_clock_read, + .open = tracing_clock_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, .write = tracing_clock_write, };