[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1290053976.30543.89.camel@gandalf.stny.rr.com>
Date: Wed, 17 Nov 2010 23:19:36 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: linux-kernel@...r.kernel.org
Cc: Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Darren Hart <dvhart@...ux.intel.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"jason.wessel" <jason.wessel@...driver.com>,
Ted Ts'o <tytso@....edu>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [RFC][PATCH 2/2] [PATCH 2/2] tracing: Make event based
trace_printk()
On Wed, 2010-11-17 at 22:58 -0500, Steven Rostedt wrote:
> +static __init int event_printk_init(void)
> +{
> + struct event_printk_struct *print;
> + struct dentry *d_events;
> + char *topdir;
> + char *p;
> + int len;
> + int ret = -1;
> +
> + /*
> + * Do nothing if we have no trace printks.
> + * May change in the future when we support modules.
> + */
> + if (__start_trace_printk == __stop_trace_printk)
> + return 0;
> +
> + /*
> + * Use this file to find the path for other
> + * files. That is, __FILE__ returns the full path,
> + * but we don't want the top dir path, so we must
> + * chop it off. We know the path of this file as it
> + * is (kernel/trace/event_printk.c), so we simply
> + * cut that off and then we have the path to cut
> + * off of other files.
> + */
> + topdir = kstrdup(__FILE__, GFP_KERNEL);
> + if (WARN(!topdir, "failed to allocate printk info"))
> + return -1;
> +
> + p = strstr(topdir, "kernel/trace/event_printk.c");
> + if (WARN(!p, "event_printk.c not found. Did the file move?"))
> + goto out;
> + *p = '\0';
> +
> + d_events = event_trace_events_dir();
> +
> + printk_root = debugfs_create_dir("printk", d_events);
> + if (WARN(!printk_root, "Could not create printk entry"))
> + goto out;
> +
> + trace_create_file("enable", 0644, printk_root,
> + NULL, &trace_printk_enable_fops);
> +
> + len = strlen(topdir);
> + for_each_printk(print, __start_trace_printk, __stop_trace_printk)
> + add_event_printk(topdir, len, print);
Oops, I'm missing a:
ret = 0;
here.
-- Steve
> +
> + out:
> + kfree(topdir);
> + return ret;
> +}
--
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