Skip to contentSkip to conversation

init: print warning message if /dev/console failed to open

PATCH In review Alexander Kuleshov 3 participants 3 messages Feb 3, 2016 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init: print warning message if /dev/console failed to open

---
 init/do_mounts.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
init/do_mounts.c +3 -1
index dea5de9..ca5da05 100644
@@ -505,7 +505,9 @@ void __init change_floppy(char *fmt, ...)
 		termios.c_lflag |= ICANON;
 		sys_ioctl(fd, TCSETSF, (long)&termios);
 		sys_close(fd);
-	}
+	} else
+		pr_err("Warning: unable to open /dev/console.\n");
+
 }
 #endif
 
Signature · 1 line
2.7.0.25.gfc10eb5
#1 lore raw

Hello Alexander,

Quoted 1 line · Alexander Kuleshov

Please describe the changes in each patch. Why do you need this warning?

If you haven't read it yet, please read (esp. Section 2):
https://www.kernel.org/doc/Documentation/SubmittingPatches

Quoted 9 lines
---
 init/do_mounts.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
init/do_mounts.c +0 -0
index dea5de9..ca5da05 100644

init/do_mounts.c void __init change_floppy(char *fmt, ...) · line 509

Quoted 6 lines
init/do_mounts.c +2 -1
@@ -505,7 +505,9 @@ void __init change_floppy(char *fmt, ...)
                termios.c_lflag |= ICANON;
                sys_ioctl(fd, TCSETSF, (long)&termios);
                sys_close(fd);
-       }
+       } else
+               pr_err("Warning: unable to open /dev/console.\n");

Your message says 'Warning'. But you use pr_err(). I think pr_warn() might be a better option.

Quoted 7 lines
init/do_mounts.c +1 -1
+
 }
 #endif
 
--

2.7.0.25.gfc10eb5

Thanks,

Signature · 1 line
Pranith
#2 lore raw
In reply to Alexander Kuleshov

Hi Alexander,

Quoted 10 lines · Alexander Kuleshov
---
 init/do_mounts.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
init/do_mounts.c +0 -0
index dea5de9..ca5da05 100644

init/do_mounts.c void __init change_floppy(char *fmt, ...) · line 509

Quoted 6 lines
init/do_mounts.c +2 -1
@@ -505,7 +505,9 @@ void __init change_floppy(char *fmt, ...)
 		termios.c_lflag |= ICANON;
 		sys_ioctl(fd, TCSETSF, (long)&termios);
 		sys_close(fd);
-	}
+	} else
+		pr_err("Warning: unable to open /dev/console.\n");

I think you should include the -fd error code as well.

Is this failure new?

Regards,
Peter Hurley

Quoted 5 lines
init/do_mounts.c +1 -0
+
 }
 #endif