Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0936d4f3 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Richard Weinberger
Browse files

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: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 721ccae8
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
	offset = uml_reserved - uml_physmem;
	map_size = len - offset;
	if(map_size <= 0) {
		printf("Too few physical memory! Needed=%d, given=%d\n",
		os_warn("Too few physical memory! Needed=%lu, given=%lu\n",
			offset, len);
		exit(1);
	}
@@ -99,7 +99,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
	err = os_map_memory((void *) uml_reserved, physmem_fd, offset,
			    map_size, 1, 1, 1);
	if (err < 0) {
		printf("setup_physmem - mapping %ld bytes of memory at 0x%p "
		os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p "
			"failed - errno = %d\n", map_size,
			(void *) uml_reserved, err);
		exit(1);
+5 −3
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 };
static void __init add_arg(char *arg)
{
	if (strlen(command_line) + strlen(arg) + 1 > COMMAND_LINE_SIZE) {
		printf("add_arg: Too many command line arguments!\n");
		os_warn("add_arg: Too many command line arguments!\n");
		exit(1);
	}
	if (strlen(command_line) > 0)
@@ -126,6 +126,7 @@ static const char *usage_string =

static int __init uml_version_setup(char *line, int *add)
{
	/* Explicitly use printf() to show version in stdout */
	printf("%s\n", init_utsname()->release);
	exit(0);

@@ -154,8 +155,8 @@ __uml_setup("root=", uml_root_setup,

static int __init no_skas_debug_setup(char *line, int *add)
{
	printf("'debug' is not necessary to gdb UML in skas mode - run \n");
	printf("'gdb linux'\n");
	os_warn("'debug' is not necessary to gdb UML in skas mode - run\n");
	os_warn("'gdb linux'\n");

	return 0;
}
@@ -171,6 +172,7 @@ static int __init Usage(char *line, int *add)

	printf(usage_string, init_utsname()->release);
	p = &__uml_help_start;
	/* Explicitly use printf() to show help in stdout */
	while (p < &__uml_help_end) {
		printf("%s", *p);
		p++;
+2 −2
Original line number Diff line number Diff line
@@ -16,14 +16,14 @@ static int __init set_umid_arg(char *name, int *add)
	int err;

	if (umid_inited) {
		printf("umid already set\n");
		os_warn("umid already set\n");
		return 0;
	}

	*add = 0;
	err = set_umid(name);
	if (err == -EEXIST)
		printf("umid '%s' already in use\n", name);
		os_warn("umid '%s' already in use\n", name);
	else if (!err)
		umid_inited = 1;

+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ int main(int argc, char**argv)
	int ret;
	argc--;
	if (!argc) {
		fprintf(stderr, "Not enough arguments\n");
		os_warn("Not enough arguments\n");
		return 1;
	}
	argv++;
+3 −3
Original line number Diff line number Diff line
@@ -74,8 +74,8 @@ static void install_fatal_handler(int sig)
	action.sa_restorer = NULL;
	action.sa_handler = last_ditch_exit;
	if (sigaction(sig, &action, NULL) < 0) {
		printf("failed to install handler for signal %d - errno = %d\n",
		       sig, errno);
		os_warn("failed to install handler for signal %d "
			"- errno = %d\n", sig, errno);
		exit(1);
	}
}
@@ -175,7 +175,7 @@ int __init main(int argc, char **argv, char **envp)
	/* disable SIGIO for the fds and set SIGIO to be ignored */
	err = deactivate_all_fds();
	if (err)
		printf("deactivate_all_fds failed, errno = %d\n", -err);
		os_warn("deactivate_all_fds failed, errno = %d\n", -err);

	/*
	 * Let any pending signals fire now.  This ensures
Loading