Skip to content

Commit

Permalink
um: Add os_info() for pre-boot information messages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Masami Hiramatsu authored and Richard Weinberger committed Jul 5, 2017
1 parent e03c78a commit f7887ee
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/um/include/shared/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
25 changes: 25 additions & 0 deletions arch/um/os-Linux/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}

0 comments on commit f7887ee

Please sign in to comment.