Skip to contentSkip to conversation

procfs: use WARN() rather than printk+backtrace

PATCH Applied Arjan van de Ven 2 participants 3 messages Oct 21, 2008 – Oct 23, 2008 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 procfs: use WARN() rather than printk+backtrace

Quoted 1 line

From 20cba7e9bd227f3fb2e8042403af33be03dc31cf Mon Sep 17 00:00:00 2001

From: Arjan van de Ven <[email protected]>
Date: Sat, 13 Sep 2008 19:51:30 -0700
Subject: [PATCH] procfs: use WARN() rather than printk+backtrace

Use WARN() rather than a printk() + backtrace();
this gives a more standard format message as well as complete information (including line numbers etc) that will be collected by kerneloops.org

---
 fs/proc/generic.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
fs/proc/generic.c +1 -2
index 7821589..60a359b 100644
@@ -547,9 +547,8 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
 
 	for (tmp = dir->subdir; tmp; tmp = tmp->next)
 		if (strcmp(tmp->name, dp->name) == 0) {
-			printk(KERN_WARNING "proc_dir_entry '%s/%s' already registered\n",
+			WARN(1, KERN_WARNING "proc_dir_entry '%s/%s' already registered\n",
 				dir->name, dp->name);
-			dump_stack();
 			break;
 		}
 
Signature · 8 lines
1.5.5.1



-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#1 lore raw

fs/proc/generic.c static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp · line 550

Quoted 2 lines · Arjan van de Ven
fs/proc/generic.c +1 -1
-			printk(KERN_WARNING "proc_dir_entry '%s/%s' already registered\n",
+			WARN(1, KERN_WARNING "proc_dir_entry '%s/%s' already registered\n",

Applied to proc.git

As a side note, seeing WARN twice on this line is depressing, and people use WARN(, KERN_ERR);

I mean, how hard is to get something conceptually simple as warning right?

#2 lore raw
Quoted 8 lines · On Thu, 23 Oct 2008 12:35:47 +0400 Alexey Dobriyan <[email protected]> wrote:
Quoted 4 lines · Arjan van de Ven
(quoted diff) +0 -1
-			printk(KERN_WARNING "proc_dir_entry

'%s/%s' already registered\n",

(quoted diff) +1 -0
+			WARN(1, KERN_WARNING "proc_dir_entry

'%s/%s' already registered\n",

Applied to proc.git

Quoted 5 lines

As a side note, seeing WARN twice on this line is depressing, and people use WARN(, KERN_ERR);

I mean, how hard is to get something conceptually simple as warning right?

if we were consistent about which level we wanted these things at we could fold that into the macro. Sadly that's not the case ;( (and then there's the issue with multilines etc)
Also, WARN() tries to be as printk() compatible as possible, and that includes the log level....

Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org