Skip to content

Commit f7887ee

Browse files
mhiramatrichardweinberger
authored andcommitted
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 <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent e03c78a commit f7887ee

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

arch/um/include/shared/os.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ extern void setup_hostinfo(char *buf, int len);
242242
extern void os_dump_core(void) __attribute__ ((noreturn));
243243
extern void um_early_printk(const char *s, unsigned int n);
244244
extern void os_fix_helper_signals(void);
245+
extern void os_info(const char *fmt, ...)
246+
__attribute__ ((format (printf, 1, 2)));
245247

246248
/* time.c */
247249
extern void os_idle_sleep(unsigned long long nsecs);

arch/um/os-Linux/util.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <wait.h>
1414
#include <sys/mman.h>
1515
#include <sys/utsname.h>
16+
#include <init.h>
1617
#include <os.h>
1718

1819
void stack_protections(unsigned long address)
@@ -152,3 +153,27 @@ void um_early_printk(const char *s, unsigned int n)
152153
{
153154
printf("%.*s", n, s);
154155
}
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+
}

0 commit comments

Comments
 (0)