[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20090302131109.24ab4c1d.akpm@linux-foundation.org>
Date: Mon, 2 Mar 2009 13:11:09 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, peterz@...radead.org,
fweisbec@...il.com, tytso@....edu, compudj@...stal.dyndns.org,
tzanussi@...il.com, mhiramat@...hat.com,
kosaki.motohiro@...fujitsu.com, jbaron@...hat.com, fche@...hat.com,
acme@...hat.com, srostedt@...hat.com
Subject: Re: [PATCH 4/7] tracing: add format file to describe event struct
fields
On Mon, 02 Mar 2009 15:29:29 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> From: Steven Rostedt <srostedt@...hat.com>
>
> This patch adds the "format" file to the trace point event directory.
> This is based off of work by Tom Zanussi, in which a file is exported
> to be tread from user land such that a user space app may read the
s/tread/read/
> binary record stored in the ring buffer.
>
> ...
>
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -3,6 +3,9 @@
> *
> * Copyright (C) 2008 Red Hat Inc, Steven Rostedt <srostedt@...hat.com>
> *
> + * - Added format output of fields of the trace point.
> + * This was based off of work by Tom Zanussi <tzanussi@...il.com>.
ick. "based on"
> + *
> */
>
> #include <linux/debugfs.h>
> @@ -444,6 +447,42 @@ event_available_types_read(struct file *filp, char __user *ubuf, size_t cnt,
> return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
> }
>
> +static ssize_t
> +event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
> + loff_t *ppos)
> +{
> + struct ftrace_event_call *call = filp->private_data;
> + struct trace_seq *s;
> + char *buf;
> + int r;
> +
> + s = kmalloc(sizeof(*s), GFP_KERNEL);
> + if (!s)
> + return -ENOMEM;
> +
> + trace_seq_init(s);
> +
> + if (*ppos)
> + return 0;
Someone get this man a bucket!
> + r = call->show_format(s);
> + if (!r) {
> + /*
> + * ug! The format output is bigger than a PAGE!!
> + */
> + buf = "FORMAT TOO BIG\n";
> + r = simple_read_from_buffer(ubuf, cnt, ppos,
> + buf, strlen(buf));
> + goto out;
> + }
> +
> + r = simple_read_from_buffer(ubuf, cnt, ppos,
> + s->buffer, s->len);
> + out:
> + kfree(s);
> + return r;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists