mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Darren Hart <dvhart@linux.intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"jason.wessel" <jason.wessel@windriver.com>,
	"Ted Ts'o" <tytso@mit.edu>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [RFC][PATCH 2/2] [PATCH 2/2] tracing: Make event based trace_printk()
Date: Wed, 17 Nov 2010 23:19:36 -0500	[thread overview]
Message-ID: <1290053976.30543.89.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <20101118040949.782054673@goodmis.org>

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;
> +}



  reply	other threads:[~2010-11-18  4:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18  3:58 [RFC][PATCH 0/2] tracing: Have trace_printk()s in the events/ directory Steven Rostedt
2010-11-18  3:58 ` [RFC][PATCH 1/2] [PATCH 1/2] tracing: Rename trace_printk to ftrace_printk Steven Rostedt
2010-11-18  3:58 ` [RFC][PATCH 2/2] [PATCH 2/2] tracing: Make event based trace_printk() Steven Rostedt
2010-11-18  4:19   ` Steven Rostedt [this message]
2010-11-18  5:50   ` Lai Jiangshan
2010-11-18 12:22     ` Steven Rostedt
2010-11-18 11:58   ` Mathieu Desnoyers
2010-11-18 12:14     ` Steven Rostedt
2010-11-18 10:41 ` [RFC][PATCH 0/2] tracing: Have trace_printk()s in the events/ directory Peter Zijlstra
2010-11-18 11:53   ` Steven Rostedt
2010-11-18 12:06     ` Mathieu Desnoyers
2010-11-18 12:14       ` Steven Rostedt
2010-11-18 13:03         ` Mathieu Desnoyers
2010-11-18 12:53   ` Frederic Weisbecker
2010-11-18 13:06     ` Steven Rostedt
2010-11-18 14:02       ` Frederic Weisbecker
2010-11-18 13:21     ` Peter Zijlstra
2010-11-18 13:36       ` Frederic Weisbecker
2010-11-18 12:39 ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1290053976.30543.89.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=dvhart@linux.intel.com \
    --cc=fweisbec@gmail.com \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®