um: Use os_info for the messages on normal path
authorMasami Hiramatsu <mhiramat@kernel.org>
Wed, 17 May 2017 17:17:14 +0000 (02:17 +0900)
committerRichard Weinberger <richard@nod.at>
Wed, 5 Jul 2017 21:17:42 +0000 (23:17 +0200)
Use os_info() for printing out the messages on the
normal execution path.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/kernel/um_arch.c
arch/um/os-Linux/main.c
arch/um/os-Linux/mem.c
arch/um/os-Linux/start_up.c

index 64a1fd06f3fde02d964c4fedcb9e73328085c94d..5df91d845a0d2fed8315c110d26b00474261fd73 100644 (file)
@@ -289,8 +289,8 @@ int __init linux_main(int argc, char **argv)
 
        diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
        if (diff > 1024 * 1024) {
-               printf("Adding %ld bytes to physical memory to account for "
-                      "exec-shield gap\n", diff);
+               os_info("Adding %ld bytes to physical memory to account for "
+                       "exec-shield gap\n", diff);
                physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
        }
 
@@ -330,8 +330,8 @@ int __init linux_main(int argc, char **argv)
        end_vm = start_vm + virtmem_size;
 
        if (virtmem_size < physmem_size)
-               printf("Kernel virtual memory size shrunk to %lu bytes\n",
-                      virtmem_size);
+               os_info("Kernel virtual memory size shrunk to %lu bytes\n",
+                       virtmem_size);
 
        os_flush_stdout();
 
index 9d499de87e63e5e5b46a5dca97224fefd9067512..f880dcd6ecc9ce8bc5691e6644f72fe11d463f82 100644 (file)
@@ -184,14 +184,13 @@ int __init main(int argc, char **argv, char **envp)
         */
        unblock_signals();
 
+       os_info("\n");
        /* Reboot */
        if (ret) {
-               printf("\n");
                execvp(new_argv[0], new_argv);
                perror("Failed to exec kernel");
                ret = 1;
        }
-       printf("\n");
        return uml_exitcode;
 }
 
index 8b1767668515f642f3f18ee0fd780d4dbbc4812b..a7f6023301cd246f8511bc3ca218ad27e994070d 100644 (file)
@@ -25,13 +25,13 @@ static int __init check_tmpfs(const char *dir)
 {
        struct statfs st;
 
-       printf("Checking if %s is on tmpfs...", dir);
+       os_info("Checking if %s is on tmpfs...", dir);
        if (statfs(dir, &st) < 0) {
-               printf("%s\n", strerror(errno));
+               os_info("%s\n", strerror(errno));
        } else if (st.f_type != TMPFS_MAGIC) {
-               printf("no\n");
+               os_info("no\n");
        } else {
-               printf("OK\n");
+               os_info("OK\n");
                return 0;
        }
        return -1;
@@ -61,18 +61,18 @@ static char * __init choose_tempdir(void)
        int i;
        const char *dir;
 
-       printf("Checking environment variables for a tempdir...");
+       os_info("Checking environment variables for a tempdir...");
        for (i = 0; vars[i]; i++) {
                dir = getenv(vars[i]);
                if ((dir != NULL) && (*dir != '\0')) {
-                       printf("%s\n", dir);
+                       os_info("%s\n", dir);
                        if (check_tmpfs(dir) >= 0)
                                goto done;
                        else
                                goto warn;
                }
        }
-       printf("none found\n");
+       os_info("none found\n");
 
        for (i = 0; tmpfs_dirs[i]; i++) {
                dir = tmpfs_dirs[i];
@@ -194,7 +194,7 @@ void __init check_tmpexec(void)
 
        addr = mmap(NULL, UM_KERN_PAGE_SIZE,
                    PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
-       printf("Checking PROT_EXEC mmap in %s...", tempdir);
+       os_info("Checking PROT_EXEC mmap in %s...", tempdir);
        if (addr == MAP_FAILED) {
                err = errno;
                printf("%s\n", strerror(err));
@@ -203,7 +203,7 @@ void __init check_tmpexec(void)
                        printf("%s must be not mounted noexec\n", tempdir);
                exit(1);
        }
-       printf("OK\n");
+       os_info("OK\n");
        munmap(addr, UM_KERN_PAGE_SIZE);
 
        close(fd);
index 22a358ef1b0cdaf227d5c768bc5670672fa45554..f16e001998e58fbf79948d00c0128c36e3349423 100644 (file)
@@ -166,7 +166,7 @@ static void __init check_sysemu(void)
        unsigned long regs[MAX_REG_NR];
        int pid, n, status, count=0;
 
-       non_fatal("Checking syscall emulation patch for ptrace...");
+       os_info("Checking syscall emulation patch for ptrace...");
        sysemu_supported = 0;
        pid = start_ptraced_child();
 
@@ -199,10 +199,10 @@ static void __init check_sysemu(void)
                goto fail_stopped;
 
        sysemu_supported = 1;
-       non_fatal("OK\n");
+       os_info("OK\n");
        set_using_sysemu(!force_sysemu_disabled);
 
-       non_fatal("Checking advanced syscall emulation patch for ptrace...");
+       os_info("Checking advanced syscall emulation patch for ptrace...");
        pid = start_ptraced_child();
 
        if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -244,7 +244,7 @@ static void __init check_sysemu(void)
                goto fail_stopped;
 
        sysemu_supported = 2;
-       non_fatal("OK\n");
+       os_info("OK\n");
 
        if (!force_sysemu_disabled)
                set_using_sysemu(sysemu_supported);
@@ -260,7 +260,7 @@ static void __init check_ptrace(void)
 {
        int pid, syscall, n, status;
 
-       non_fatal("Checking that ptrace can change system call numbers...");
+       os_info("Checking that ptrace can change system call numbers...");
        pid = start_ptraced_child();
 
        if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -292,7 +292,7 @@ static void __init check_ptrace(void)
                }
        }
        stop_ptraced_child(pid, 0, 1);
-       non_fatal("OK\n");
+       os_info("OK\n");
        check_sysemu();
 }
 
@@ -308,15 +308,17 @@ static void __init check_coredump_limit(void)
                return;
        }
 
-       printf("Core dump limits :\n\tsoft - ");
+       os_info("Core dump limits :\n\tsoft - ");
        if (lim.rlim_cur == RLIM_INFINITY)
-               printf("NONE\n");
-       else printf("%lu\n", lim.rlim_cur);
+               os_info("NONE\n");
+       else
+               os_info("%llu\n", (unsigned long long)lim.rlim_cur);
 
-       printf("\thard - ");
+       os_info("\thard - ");
        if (lim.rlim_max == RLIM_INFINITY)
-               printf("NONE\n");
-       else printf("%lu\n", lim.rlim_max);
+               os_info("NONE\n");
+       else
+               os_info("%llu\n", (unsigned long long)lim.rlim_max);
 }
 
 void __init os_early_checks(void)