diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2017-05-17 13:16:05 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2017-07-05 17:17:16 -0400 |
commit | f7887ee11082b468517f31ae315b474eaa48b843 (patch) | |
tree | db24f59990465714b97a5726239be3973f3d0773 | |
parent | e03c78ac2d7709b7556a9b8dd584e2969c6fce67 (diff) |
um: Add os_info() for pre-boot information messages
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>
Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r-- | arch/um/include/shared/os.h | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/util.c | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index cd1fa97776c3..9e95bcebaf9b 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); | |||
242 | extern void os_dump_core(void) __attribute__ ((noreturn)); | 242 | extern void os_dump_core(void) __attribute__ ((noreturn)); |
243 | extern void um_early_printk(const char *s, unsigned int n); | 243 | extern void um_early_printk(const char *s, unsigned int n); |
244 | extern void os_fix_helper_signals(void); | 244 | extern void os_fix_helper_signals(void); |
245 | extern void os_info(const char *fmt, ...) | ||
246 | __attribute__ ((format (printf, 1, 2))); | ||
245 | 247 | ||
246 | /* time.c */ | 248 | /* time.c */ |
247 | extern void os_idle_sleep(unsigned long long nsecs); | 249 | 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 faee55ef6d2f..c9bad1bca108 100644 --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <wait.h> | 13 | #include <wait.h> |
14 | #include <sys/mman.h> | 14 | #include <sys/mman.h> |
15 | #include <sys/utsname.h> | 15 | #include <sys/utsname.h> |
16 | #include <init.h> | ||
16 | #include <os.h> | 17 | #include <os.h> |
17 | 18 | ||
18 | void stack_protections(unsigned long address) | 19 | void stack_protections(unsigned long address) |
@@ -152,3 +153,27 @@ void um_early_printk(const char *s, unsigned int n) | |||
152 | { | 153 | { |
153 | printf("%.*s", n, s); | 154 | printf("%.*s", n, s); |
154 | } | 155 | } |
156 | |||
157 | static int quiet_info; | ||
158 | |||
159 | static int __init quiet_cmd_param(char *str, int *add) | ||
160 | { | ||
161 | quiet_info = 1; | ||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | __uml_setup("quiet", quiet_cmd_param, | ||
166 | "quiet\n" | ||
167 | " Turns off information messages during boot.\n\n"); | ||
168 | |||
169 | void os_info(const char *fmt, ...) | ||
170 | { | ||
171 | va_list list; | ||
172 | |||
173 | if (quiet_info) | ||
174 | return; | ||
175 | |||
176 | va_start(list, fmt); | ||
177 | vfprintf(stderr, fmt, list); | ||
178 | va_end(list); | ||
179 | } | ||