lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0903261949480.1917@gandalf.stny.rr.com>
Date:	Thu, 26 Mar 2009 19:53:26 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
cc:	Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing/ftrace: factorize the tracing files creation


On Fri, 27 Mar 2009, Frederic Weisbecker wrote:

> Impact: cleanup
> 
> Most of the tracing files creation follow the same pattern:
> 
> ret = debugfs_create_file(...)
> if (!ret)
> 	pr_warning("Couldn't create ... entry\n")
> 
> Unify it!
> 

I could have sworn I did this before. I found this patch with the 
timestamp dated Feb 8, 2008.  This is even before we came up with the name 
"ftrace" and I was still calling it "mcount".

Oh well, it somehow never got out :-(

I'll Ack yours ;-)


Old patch:

From: Steven Rostedt <srostedt@...hat.com>
Subject: clean up trace debugfs error messages

The debugfs creation had a bunch of cut and paste errors
in the prints. This patch creates a single function to
create the debugfs file and print out the error if it
fails.

Signed-off-by: Steven Rostedt <srostedt@...hat.com>
---
 kernel/trace/trace.c |   53 +++++++++++++++++++++------------------------------
 1 file changed, 22 insertions(+), 31 deletions(-)

Index: linux-mcount.git/kernel/trace/trace.c
===================================================================
--- linux-mcount.git.orig/kernel/trace/trace.c	2008-02-08 12:04:29.000000000 -0500
+++ linux-mcount.git/kernel/trace/trace.c	2008-02-08 14:39:43.000000000 -0500
@@ -1394,63 +1394,54 @@ struct dentry *tracing_init_dentry(void)
 	return d_tracer;
 }
 
+static __init void
+tracing_debugfs_create_file(const char *name, mode_t mode,
+			    struct dentry *parent, void *data,
+			    const struct file_operations *fops)
+{
+	struct dentry *entry;
+
+	entry = debugfs_create_file(name, mode, parent, data, fops);
+	if (!entry)
+		pr_warning("Could not create debugfs '%s' entry\n", name);
+}
+
 static __init void tracer_init_debugfs(void)
 {
 	struct dentry *d_tracer;
-	struct dentry *entry;
 
 	d_tracer = tracing_init_dentry();
 
-	entry = debugfs_create_file("tracing_enabled", 0644, d_tracer,
+	tracing_debugfs_create_file("tracing_enabled", 0644, d_tracer,
 				    &global_trace, &tracing_ctrl_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'tracing_enabled' entry\n");
 
-	entry = debugfs_create_file("iter_ctrl", 0644, d_tracer,
+
+	tracing_debugfs_create_file("iter_ctrl", 0644, d_tracer,
 				    NULL, &tracing_iter_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'iter_ctrl' entry\n");
 
-	entry = debugfs_create_file("latency_trace", 0444, d_tracer,
+	tracing_debugfs_create_file("latency_trace", 0444, d_tracer,
 				    &global_trace, &tracing_lt_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'latency_trace' entry\n");
 
-	entry = debugfs_create_file("trace", 0444, d_tracer,
+	tracing_debugfs_create_file("trace", 0444, d_tracer,
 				    &global_trace, &tracing_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'trace' entry\n");
 
-	entry = debugfs_create_file("available_tracers", 0444, d_tracer,
+	tracing_debugfs_create_file("available_tracers", 0444, d_tracer,
 				    &global_trace, &show_traces_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'trace' entry\n");
 
-	entry = debugfs_create_file("current_tracer", 0444, d_tracer,
+	tracing_debugfs_create_file("current_tracer", 0444, d_tracer,
 				    &global_trace, &set_tracer_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'trace' entry\n");
 
-	entry = debugfs_create_file("tracing_max_latency", 0644, d_tracer,
+	tracing_debugfs_create_file("tracing_max_latency", 0644, d_tracer,
 				    &tracing_max_latency,
 				    &tracing_max_lat_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'tracing_max_latency' entry\n");
 
-	entry = debugfs_create_file("tracing_thresh", 0644, d_tracer,
+	tracing_debugfs_create_file("tracing_thresh", 0644, d_tracer,
 				    &tracing_thresh, &tracing_max_lat_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'tracing_threash' entry\n");
 
 #ifdef CONFIG_DYNAMIC_FTRACE
-	entry = debugfs_create_file("dyn_ftrace_total_info", 0444, d_tracer,
+	tracing_debugfs_create_file("dyn_ftrace_total_info", 0444, d_tracer,
 				    &ftrace_update_tot_cnt,
 				    &tracing_read_long_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'dyn_ftrace_total_info' entry\n");
 #endif
 }
 
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ