um: Use os_warn to print out pre-boot warning/error messages

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>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Masami Hiramatsu
2017-05-18 02:19:31 +09:00
committed by Richard Weinberger
parent 721ccae88d
commit 0936d4f3d5
8 changed files with 26 additions and 24 deletions

View File

@ -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);