linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/6] um: Output messages to stderr and support quiet option
@ 2017-05-08  6:15 Masami Hiramatsu
  2017-05-08  6:16 ` [RFC PATCH v2 1/6] um: Use printk instead of printf in make_uml_dir Masami Hiramatsu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Masami Hiramatsu @ 2017-05-08  6:15 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger
  Cc: Masami Hiramatsu, user-mode-linux-devel, linux-kernel

Hello,

Here is version 2 of um-quiet series.

This series fixes some boot time printf output to stderr
by adding os_info() and os_warn(). The information-level
messages via os_info() are suppressed when "quiet" kernel
option is specified.
Also the last one allows user to pass "console=" option
to kernel.

Note that the output of --help and --version are still
sent to stdout since they are intentionally shown by
the user.

Changes from v1:
 - Introduce os_info() and os_warn() to replace most of
   printf() instead of reusing non_fatal().
 - Replace fprintf(stderr, ...) with os_warn() for error
   messages.

Thank you,

---

Masami Hiramatsu (6):
      um: Use printk instead of printf in make_uml_dir
      um: Add os_info() for pre-boot information messages
      um: Use os_info for the messages on normal path
      um: Add os_warn() for pre-boot warning/error messages
      um: Use os_warn to print out pre-boot warning/error messages
      um: console: Ignore console= option


 arch/um/drivers/stdio_console.c |    3 +++
 arch/um/include/shared/os.h     |    4 ++++
 arch/um/kernel/physmem.c        |   10 +++++-----
 arch/um/kernel/um_arch.c        |   16 +++++++++-------
 arch/um/kernel/umid.c           |    4 ++--
 arch/um/os-Linux/execvp.c       |    2 +-
 arch/um/os-Linux/main.c         |    9 ++++-----
 arch/um/os-Linux/mem.c          |   28 ++++++++++++++--------------
 arch/um/os-Linux/start_up.c     |   28 +++++++++++++++-------------
 arch/um/os-Linux/umid.c         |   19 +++++++++++--------
 arch/um/os-Linux/util.c         |   34 ++++++++++++++++++++++++++++++++++
 11 files changed, 102 insertions(+), 55 deletions(-)

--
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC PATCH v2 1/6] um: Use printk instead of printf in make_uml_dir
  2017-05-08  6:15 [RFC PATCH v2 0/6] um: Output messages to stderr and support quiet option Masami Hiramatsu
@ 2017-05-08  6:16 ` Masami Hiramatsu
  2017-05-08  6:17 ` [RFC PATCH v2 2/6] um: Add os_info() for pre-boot information messages Masami Hiramatsu
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Masami Hiramatsu @ 2017-05-08  6:16 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger
  Cc: Masami Hiramatsu, user-mode-linux-devel, linux-kernel

Since this function will be called after printk buffer
initialized, use printk as other functions do.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
  Changes in v2:
   - Use "%s", __func__ according to checkpatches.pl
---
 arch/um/os-Linux/umid.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index c1dc892..37cfaba 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -35,8 +35,9 @@ static int __init make_uml_dir(void)
 
 		err = -ENOENT;
 		if (home == NULL) {
-			printk(UM_KERN_ERR "make_uml_dir : no value in "
-			       "environment for $HOME\n");
+			printk(UM_KERN_ERR
+				"%s: no value in environment for $HOME\n",
+				__func__);
 			goto err;
 		}
 		strlcpy(dir, home, sizeof(dir));
@@ -50,13 +51,15 @@ static int __init make_uml_dir(void)
 	err = -ENOMEM;
 	uml_dir = malloc(strlen(dir) + 1);
 	if (uml_dir == NULL) {
-		printf("make_uml_dir : malloc failed, errno = %d\n", errno);
+		printk(UM_KERN_ERR "%s : malloc failed, errno = %d\n",
+			__func__, errno);
 		goto err;
 	}
 	strcpy(uml_dir, dir);
 
 	if ((mkdir(uml_dir, 0777) < 0) && (errno != EEXIST)) {
-	        printf("Failed to mkdir '%s': %s\n", uml_dir, strerror(errno));
+		printk(UM_KERN_ERR "Failed to mkdir '%s': %s\n",
+			uml_dir, strerror(errno));
 		err = -errno;
 		goto err_free;
 	}

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH v2 2/6] um: Add os_info() for pre-boot information messages
  2017-05-08  6:15 [RFC PATCH v2 0/6] um: Output messages to stderr and support quiet option Masami Hiramatsu
  2017-05-08  6:16 ` [RFC PATCH v2 1/6] um: Use printk instead of printf in make_uml_dir Masami Hiramatsu
@ 2017-05-08  6:17 ` Masami Hiramatsu
  2017-05-08  6:18 ` [RFC PATCH v2 3/6] um: Use os_info for the messages on normal path Masami Hiramatsu
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Masami Hiramatsu @ 2017-05-08  6:17 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger
  Cc: Masami Hiramatsu, user-mode-linux-devel, linux-kernel

Add os_info() for printing out pre-boot information
level messages in stderr. The messages via os_info()
are suppressed by "quiet" kernel command line.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 arch/um/include/shared/os.h |    2 ++
 arch/um/os-Linux/util.c     |   25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index cd1fa97..9e95bce 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -242,6 +242,8 @@ extern void setup_hostinfo(char *buf, int len);
 extern void os_dump_core(void) __attribute__ ((noreturn));
 extern void um_early_printk(const char *s, unsigned int n);
 extern void os_fix_helper_signals(void);
+extern void os_info(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
 
 /* time.c */
 extern void os_idle_sleep(unsigned long long nsecs);
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index faee55e..c9bad1b 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -13,6 +13,7 @@
 #include <wait.h>
 #include <sys/mman.h>
 #include <sys/utsname.h>
+#include <init.h>
 #include <os.h>
 
 void stack_protections(unsigned long address)
@@ -152,3 +153,27 @@ void um_early_printk(const char *s, unsigned int n)
 {
 	printf("%.*s", n, s);
 }
+
+static int quiet_info;
+
+static int __init quiet_cmd_param(char *str, int *add)
+{
+	quiet_info = 1;
+	return 0;
+}
+
+__uml_setup("quiet", quiet_cmd_param,
+"quiet\n"
+"    Turns off information messages during boot.\n\n");
+
+void os_info(const char *fmt, ...)
+{
+	va_list list;
+
+	if (quiet_info)
+		return;
+
+	va_start(list, fmt);
+	vfprintf(stderr, fmt, list);
+	va_end(list);
+}

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH v2 3/6] um: Use os_info for the messages on normal path
  2017-05-08  6:15 [RFC PATCH v2 0/6] um: Output messages to stderr and support quiet option Masami Hiramatsu
  2017-05-08  6:16 ` [RFC PATCH v2 1/6] um: Use printk instead of printf in make_uml_dir Masami Hiramatsu
  2017-05-08  6:17 ` [RFC PATCH v2 2/6] um: Add os_info() for pre-boot information messages Masami Hiramatsu
@ 2017-05-08  6:18 ` Masami Hiramatsu
  2017-05-08  6:20 ` [RFC PATCH v2 4/6] um: Add os_warn() for pre-boot warning/error messages Masami Hiramatsu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Masami Hiramatsu @ 2017-05-08  6:18 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger
  Cc: Masami Hiramatsu, user-mode-linux-devel, linux-kernel

Use os_info() for printing out the messages on the
normal execution path.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 arch/um/kernel/um_arch.c    |    8 ++++----
 arch/um/os-Linux/main.c     |    3 +--
 arch/um/os-Linux/mem.c      |   18 +++++++++---------
 arch/um/os-Linux/start_up.c |   26 ++++++++++++++------------
 4 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 64a1fd0..5df91d8 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -289,8 +289,8 @@ int __init linux_main(int argc, char **argv)
 
 	diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
 	if (diff > 1024 * 1024) {
-		printf("Adding %ld bytes to physical memory to account for "
-		       "exec-shield gap\n", diff);
+		os_info("Adding %ld bytes to physical memory to account for "
+			"exec-shield gap\n", diff);
 		physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
 	}
 
@@ -330,8 +330,8 @@ int __init linux_main(int argc, char **argv)
 	end_vm = start_vm + virtmem_size;
 
 	if (virtmem_size < physmem_size)
-		printf("Kernel virtual memory size shrunk to %lu bytes\n",
-		       virtmem_size);
+		os_info("Kernel virtual memory size shrunk to %lu bytes\n",
+			virtmem_size);
 
 	os_flush_stdout();
 
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 9d499de..f880dcd 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -184,14 +184,13 @@ int __init main(int argc, char **argv, char **envp)
 	 */
 	unblock_signals();
 
+	os_info("\n");
 	/* Reboot */
 	if (ret) {
-		printf("\n");
 		execvp(new_argv[0], new_argv);
 		perror("Failed to exec kernel");
 		ret = 1;
 	}
-	printf("\n");
 	return uml_exitcode;
 }
 
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 8b17676..a7f6023 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -25,13 +25,13 @@ static int __init check_tmpfs(const char *dir)
 {
 	struct statfs st;
 
-	printf("Checking if %s is on tmpfs...", dir);
+	os_info("Checking if %s is on tmpfs...", dir);
 	if (statfs(dir, &st) < 0) {
-		printf("%s\n", strerror(errno));
+		os_info("%s\n", strerror(errno));
 	} else if (st.f_type != TMPFS_MAGIC) {
-		printf("no\n");
+		os_info("no\n");
 	} else {
-		printf("OK\n");
+		os_info("OK\n");
 		return 0;
 	}
 	return -1;
@@ -61,18 +61,18 @@ static char * __init choose_tempdir(void)
 	int i;
 	const char *dir;
 
-	printf("Checking environment variables for a tempdir...");
+	os_info("Checking environment variables for a tempdir...");
 	for (i = 0; vars[i]; i++) {
 		dir = getenv(vars[i]);
 		if ((dir != NULL) && (*dir != '\0')) {
-			printf("%s\n", dir);
+			os_info("%s\n", dir);
 			if (check_tmpfs(dir) >= 0)
 				goto done;
 			else
 				goto warn;
 		}
 	}
-	printf("none found\n");
+	os_info("none found\n");
 
 	for (i = 0; tmpfs_dirs[i]; i++) {
 		dir = tmpfs_dirs[i];
@@ -194,7 +194,7 @@ void __init check_tmpexec(void)
 
 	addr = mmap(NULL, UM_KERN_PAGE_SIZE,
 		    PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
-	printf("Checking PROT_EXEC mmap in %s...", tempdir);
+	os_info("Checking PROT_EXEC mmap in %s...", tempdir);
 	if (addr == MAP_FAILED) {
 		err = errno;
 		printf("%s\n", strerror(err));
@@ -203,7 +203,7 @@ void __init check_tmpexec(void)
 			printf("%s must be not mounted noexec\n", tempdir);
 		exit(1);
 	}
-	printf("OK\n");
+	os_info("OK\n");
 	munmap(addr, UM_KERN_PAGE_SIZE);
 
 	close(fd);
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 22a358e..5a61a93 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -166,7 +166,7 @@ static void __init check_sysemu(void)
 	unsigned long regs[MAX_REG_NR];
 	int pid, n, status, count=0;
 
-	non_fatal("Checking syscall emulation patch for ptrace...");
+	os_info("Checking syscall emulation patch for ptrace...");
 	sysemu_supported = 0;
 	pid = start_ptraced_child();
 
@@ -199,10 +199,10 @@ static void __init check_sysemu(void)
 		goto fail_stopped;
 
 	sysemu_supported = 1;
-	non_fatal("OK\n");
+	os_info("OK\n");
 	set_using_sysemu(!force_sysemu_disabled);
 
-	non_fatal("Checking advanced syscall emulation patch for ptrace...");
+	os_info("Checking advanced syscall emulation patch for ptrace...");
 	pid = start_ptraced_child();
 
 	if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -244,7 +244,7 @@ static void __init check_sysemu(void)
 		goto fail_stopped;
 
 	sysemu_supported = 2;
-	non_fatal("OK\n");
+	os_info("OK\n");
 
 	if (!force_sysemu_disabled)
 		set_using_sysemu(sysemu_supported);
@@ -260,7 +260,7 @@ static void __init check_ptrace(void)
 {
 	int pid, syscall, n, status;
 
-	non_fatal("Checking that ptrace can change system call numbers...");
+	os_info("Checking that ptrace can change system call numbers...");
 	pid = start_ptraced_child();
 
 	if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -292,7 +292,7 @@ static void __init check_ptrace(void)
 		}
 	}
 	stop_ptraced_child(pid, 0, 1);
-	non_fatal("OK\n");
+	os_info("OK\n");
 	check_sysemu();
 }
 
@@ -308,15 +308,17 @@ static void __init check_coredump_limit(void)
 		return;
 	}
 
-	printf("Core dump limits :\n\tsoft - ");
+	os_info("Core dump limits :\n\tsoft - ");
 	if (lim.rlim_cur == RLIM_INFINITY)
-		printf("NONE\n");
-	else printf("%lu\n", lim.rlim_cur);
+		os_info("NONE\n");
+	else
+		os_info("%lu\n", lim.rlim_cur);
 
-	printf("\thard - ");
+	os_info("\thard - ");
 	if (lim.rlim_max == RLIM_INFINITY)
-		printf("NONE\n");
-	else printf("%lu\n", lim.rlim_max);
+		os_info("NONE\n");
+	else
+		os_info("%lu\n", lim.rlim_max);
 }
 
 void __init os_early_checks(void)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH v2 4/6] um: Add os_warn() for pre-boot warning/error messages
  2017-05-08  6:15 [RFC PATCH v2 0/6] um: Output messages to stderr and support quiet option Masami Hiramatsu
                   ` (2 preceding siblings ...)
  2017-05-08  6:18 ` [RFC PATCH v2 3/6] um: Use os_info for the messages on normal path Masami Hiramatsu
@ 2017-05-08  6:20 ` Masami Hiramatsu
  2017-05-08  6:21 ` [RFC PATCH v2 5/6] um: Use os_warn to print out " Masami Hiramatsu
  2017-05-08  6:22 ` [RFC PATCH v2 6/6] um: console: Ignore console= option Masami Hiramatsu
  5 siblings, 0 replies; 7+ messages in thread
From: Masami Hiramatsu @ 2017-05-08  6:20 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger
  Cc: Masami Hiramatsu, user-mode-linux-devel, linux-kernel

Add os_warn() for printing out pre-boot warning/error
messages in stderr. The messages via os_warn() are not
suppressed by quiet option.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 arch/um/include/shared/os.h |    2 ++
 arch/um/os-Linux/util.c     |    9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 9e95bce..574e03f 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -244,6 +244,8 @@ extern void um_early_printk(const char *s, unsigned int n);
 extern void os_fix_helper_signals(void);
 extern void os_info(const char *fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
+extern void os_warn(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
 
 /* time.c */
 extern void os_idle_sleep(unsigned long long nsecs);
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index c9bad1b..8cc8b26 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -177,3 +177,12 @@ void os_info(const char *fmt, ...)
 	vfprintf(stderr, fmt, list);
 	va_end(list);
 }
+
+void os_warn(const char *fmt, ...)
+{
+	va_list list;
+
+	va_start(list, fmt);
+	vfprintf(stderr, fmt, list);
+	va_end(list);
+}

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH v2 5/6] um: Use os_warn to print out pre-boot warning/error messages
  2017-05-08  6:15 [RFC PATCH v2 0/6] um: Output messages to stderr and support quiet option Masami Hiramatsu
                   ` (3 preceding siblings ...)
  2017-05-08  6:20 ` [RFC PATCH v2 4/6] um: Add os_warn() for pre-boot warning/error messages Masami Hiramatsu
@ 2017-05-08  6:21 ` Masami Hiramatsu
  2017-05-08  6:22 ` [RFC PATCH v2 6/6] um: console: Ignore console= option Masami Hiramatsu
  5 siblings, 0 replies; 7+ messages in thread
From: Masami Hiramatsu @ 2017-05-08  6:21 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger
  Cc: Masami Hiramatsu, user-mode-linux-devel, linux-kernel

Use os_warn() instead of printf/fprintf to print out
pre-boot warning/error messages to stderr.
Note that the help message and version message are
kept to print out to stdout, because user explicitly
specifies those options to get such information.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 arch/um/kernel/physmem.c    |   10 +++++-----
 arch/um/kernel/um_arch.c    |    8 +++++---
 arch/um/kernel/umid.c       |    4 ++--
 arch/um/os-Linux/execvp.c   |    2 +-
 arch/um/os-Linux/main.c     |    6 +++---
 arch/um/os-Linux/mem.c      |   10 +++++-----
 arch/um/os-Linux/start_up.c |    2 +-
 arch/um/os-Linux/umid.c     |    8 ++++----
 8 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 4c9861b..201bd43 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -89,8 +89,8 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
 	offset = uml_reserved - uml_physmem;
 	map_size = len - offset;
 	if(map_size <= 0) {
-		printf("Too few physical memory! Needed=%d, given=%d\n",
-		       offset, len);
+		os_warn("Too few physical memory! Needed=%d, given=%d\n",
+			offset, len);
 		exit(1);
 	}
 
@@ -99,9 +99,9 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
 	err = os_map_memory((void *) uml_reserved, physmem_fd, offset,
 			    map_size, 1, 1, 1);
 	if (err < 0) {
-		printf("setup_physmem - mapping %ld bytes of memory at 0x%p "
-		       "failed - errno = %d\n", map_size,
-		       (void *) uml_reserved, err);
+		os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p "
+			"failed - errno = %d\n", map_size,
+			(void *) uml_reserved, err);
 		exit(1);
 	}
 
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 5df91d8..9c5d111 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -34,7 +34,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 };
 static void __init add_arg(char *arg)
 {
 	if (strlen(command_line) + strlen(arg) + 1 > COMMAND_LINE_SIZE) {
-		printf("add_arg: Too many command line arguments!\n");
+		os_warn("add_arg: Too many command line arguments!\n");
 		exit(1);
 	}
 	if (strlen(command_line) > 0)
@@ -126,6 +126,7 @@ static const char *usage_string =
 
 static int __init uml_version_setup(char *line, int *add)
 {
+	/* Explicitly use printf() to show version in stdout */
 	printf("%s\n", init_utsname()->release);
 	exit(0);
 
@@ -154,8 +155,8 @@ __uml_setup("root=", uml_root_setup,
 
 static int __init no_skas_debug_setup(char *line, int *add)
 {
-	printf("'debug' is not necessary to gdb UML in skas mode - run \n");
-	printf("'gdb linux'\n");
+	os_warn("'debug' is not necessary to gdb UML in skas mode - run\n");
+	os_warn("'gdb linux'\n");
 
 	return 0;
 }
@@ -171,6 +172,7 @@ static int __init Usage(char *line, int *add)
 
 	printf(usage_string, init_utsname()->release);
 	p = &__uml_help_start;
+	/* Explicitly use printf() to show help in stdout */
 	while (p < &__uml_help_end) {
 		printf("%s", *p);
 		p++;
diff --git a/arch/um/kernel/umid.c b/arch/um/kernel/umid.c
index f6cc3bd..10bf4ac 100644
--- a/arch/um/kernel/umid.c
+++ b/arch/um/kernel/umid.c
@@ -16,14 +16,14 @@ static int __init set_umid_arg(char *name, int *add)
 	int err;
 
 	if (umid_inited) {
-		printf("umid already set\n");
+		os_warn("umid already set\n");
 		return 0;
 	}
 
 	*add = 0;
 	err = set_umid(name);
 	if (err == -EEXIST)
-		printf("umid '%s' already in use\n", name);
+		os_warn("umid '%s' already in use\n", name);
 	else if (!err)
 		umid_inited = 1;
 
diff --git a/arch/um/os-Linux/execvp.c b/arch/um/os-Linux/execvp.c
index 8fb25ca..84a0777 100644
--- a/arch/um/os-Linux/execvp.c
+++ b/arch/um/os-Linux/execvp.c
@@ -136,7 +136,7 @@ int main(int argc, char**argv)
 	int ret;
 	argc--;
 	if (!argc) {
-		fprintf(stderr, "Not enough arguments\n");
+		os_warn("Not enough arguments\n");
 		return 1;
 	}
 	argv++;
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index f880dcd..5f970ec 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -74,8 +74,8 @@ static void install_fatal_handler(int sig)
 	action.sa_restorer = NULL;
 	action.sa_handler = last_ditch_exit;
 	if (sigaction(sig, &action, NULL) < 0) {
-		printf("failed to install handler for signal %d - errno = %d\n",
-		       sig, errno);
+		os_warn("failed to install handler for signal %d "
+			"- errno = %d\n", sig, errno);
 		exit(1);
 	}
 }
@@ -175,7 +175,7 @@ int __init main(int argc, char **argv, char **envp)
 	/* disable SIGIO for the fds and set SIGIO to be ignored */
 	err = deactivate_all_fds();
 	if (err)
-		printf("deactivate_all_fds failed, errno = %d\n", -err);
+		os_warn("deactivate_all_fds failed, errno = %d\n", -err);
 
 	/*
 	 * Let any pending signals fire now.  This ensures
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index a7f6023..e162a95 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -82,7 +82,7 @@ static char * __init choose_tempdir(void)
 
 	dir = fallback_dir;
 warn:
-	printf("Warning: tempdir %s is not on tmpfs\n", dir);
+	os_warn("Warning: tempdir %s is not on tmpfs\n", dir);
 done:
 	/* Make a copy since getenv results may not remain valid forever. */
 	return strdup(dir);
@@ -100,7 +100,7 @@ static int __init make_tempfile(const char *template)
 	if (tempdir == NULL) {
 		tempdir = choose_tempdir();
 		if (tempdir == NULL) {
-			fprintf(stderr, "Failed to choose tempdir: %s\n",
+			os_warn("Failed to choose tempdir: %s\n",
 				strerror(errno));
 			return -1;
 		}
@@ -125,7 +125,7 @@ static int __init make_tempfile(const char *template)
 	strcat(tempname, template);
 	fd = mkstemp(tempname);
 	if (fd < 0) {
-		fprintf(stderr, "open - cannot create %s: %s\n", tempname,
+		os_warn("open - cannot create %s: %s\n", tempname,
 			strerror(errno));
 		goto out;
 	}
@@ -197,10 +197,10 @@ void __init check_tmpexec(void)
 	os_info("Checking PROT_EXEC mmap in %s...", tempdir);
 	if (addr == MAP_FAILED) {
 		err = errno;
-		printf("%s\n", strerror(err));
+		os_warn("%s\n", strerror(err));
 		close(fd);
 		if (err == EPERM)
-			printf("%s must be not mounted noexec\n", tempdir);
+			os_warn("%s must be not mounted noexec\n", tempdir);
 		exit(1);
 	}
 	os_info("OK\n");
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 5a61a93..a044d3e 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -351,7 +351,7 @@ int __init parse_iomem(char *str, int *add)
 	driver = str;
 	file = strchr(str,',');
 	if (file == NULL) {
-		fprintf(stderr, "parse_iomem : failed to parse iomem\n");
+		os_warn("parse_iomem : failed to parse iomem\n");
 		goto out;
 	}
 	*file = '\0';
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index 37cfaba..998fbb4 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -354,7 +354,7 @@ char *get_umid(void)
 static int __init set_uml_dir(char *name, int *add)
 {
 	if (*name == '\0') {
-		printf("uml_dir can't be an empty string\n");
+		os_warn("uml_dir can't be an empty string\n");
 		return 0;
 	}
 
@@ -365,7 +365,7 @@ static int __init set_uml_dir(char *name, int *add)
 
 	uml_dir = malloc(strlen(name) + 2);
 	if (uml_dir == NULL) {
-		printf("Failed to malloc uml_dir - error = %d\n", errno);
+		os_warn("Failed to malloc uml_dir - error = %d\n", errno);
 
 		/*
 		 * Return 0 here because do_initcalls doesn't look at
@@ -390,8 +390,8 @@ static void remove_umid_dir(void)
 	sprintf(dir, "%s%s", uml_dir, umid);
 	err = remove_files_and_dir(dir);
 	if (err)
-		printf("remove_umid_dir - remove_files_and_dir failed with "
-		       "err = %d\n", err);
+		os_warn("%s - remove_files_and_dir failed with err = %d\n",
+			__func__, err);
 }
 
 __uml_exitcall(remove_umid_dir);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH v2 6/6] um: console: Ignore console= option
  2017-05-08  6:15 [RFC PATCH v2 0/6] um: Output messages to stderr and support quiet option Masami Hiramatsu
                   ` (4 preceding siblings ...)
  2017-05-08  6:21 ` [RFC PATCH v2 5/6] um: Use os_warn to print out " Masami Hiramatsu
@ 2017-05-08  6:22 ` Masami Hiramatsu
  5 siblings, 0 replies; 7+ messages in thread
From: Masami Hiramatsu @ 2017-05-08  6:22 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger
  Cc: Masami Hiramatsu, user-mode-linux-devel, linux-kernel

Ignore linux kernel's console= option at uml's console
option handler. Since uml's con= option is only for
setting up new console, and Linux kernel's console=
option specify to which console kernel output its
message, we can use both option for different purpose.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 arch/um/drivers/stdio_console.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 7b361f3..c90817b 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -192,6 +192,9 @@ __uml_exitcall(console_exit);
 
 static int console_chan_setup(char *str)
 {
+	if (!strncmp(str, "sole=", 5))	/* console= option specifies tty */
+		return 0;
+
 	line_setup(vt_conf, MAX_TTYS, &def_conf, str, "console");
 	return 1;
 }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-05-08  6:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08  6:15 [RFC PATCH v2 0/6] um: Output messages to stderr and support quiet option Masami Hiramatsu
2017-05-08  6:16 ` [RFC PATCH v2 1/6] um: Use printk instead of printf in make_uml_dir Masami Hiramatsu
2017-05-08  6:17 ` [RFC PATCH v2 2/6] um: Add os_info() for pre-boot information messages Masami Hiramatsu
2017-05-08  6:18 ` [RFC PATCH v2 3/6] um: Use os_info for the messages on normal path Masami Hiramatsu
2017-05-08  6:20 ` [RFC PATCH v2 4/6] um: Add os_warn() for pre-boot warning/error messages Masami Hiramatsu
2017-05-08  6:21 ` [RFC PATCH v2 5/6] um: Use os_warn to print out " Masami Hiramatsu
2017-05-08  6:22 ` [RFC PATCH v2 6/6] um: console: Ignore console= option Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).