public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Jeff Dike <jdike@addtoit.com>, Richard Weinberger <richard@nod.at>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	user-mode-linux-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH v2 2/6] um: Add os_info() for pre-boot information messages
Date: Mon,  8 May 2017 15:17:46 +0900	[thread overview]
Message-ID: <149422425674.11101.479418925777852556.stgit@devbox> (raw)
In-Reply-To: <149422411127.11101.13017249012576512464.stgit@devbox>

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

  parent reply	other threads:[~2017-05-08  6:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=149422425674.11101.479418925777852556.stgit@devbox \
    --to=mhiramat@kernel.org \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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