diff options
Diffstat (limited to 'arch/um/kernel/initrd.c')
-rw-r--r-- | arch/um/kernel/initrd.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c index 16dc43e9d940..fa015565001b 100644 --- a/arch/um/kernel/initrd.c +++ b/arch/um/kernel/initrd.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -7,7 +7,6 @@ | |||
7 | #include "linux/bootmem.h" | 7 | #include "linux/bootmem.h" |
8 | #include "linux/initrd.h" | 8 | #include "linux/initrd.h" |
9 | #include "asm/types.h" | 9 | #include "asm/types.h" |
10 | #include "kern_util.h" | ||
11 | #include "initrd.h" | 10 | #include "initrd.h" |
12 | #include "init.h" | 11 | #include "init.h" |
13 | #include "os.h" | 12 | #include "os.h" |
@@ -21,18 +20,27 @@ static int __init read_initrd(void) | |||
21 | long long size; | 20 | long long size; |
22 | int err; | 21 | int err; |
23 | 22 | ||
24 | if(initrd == NULL) | 23 | if (initrd == NULL) |
25 | return 0; | 24 | return 0; |
26 | 25 | ||
27 | err = os_file_size(initrd, &size); | 26 | err = os_file_size(initrd, &size); |
28 | if(err) | 27 | if (err) |
29 | return 0; | 28 | return 0; |
30 | 29 | ||
30 | /* | ||
31 | * This is necessary because alloc_bootmem craps out if you | ||
32 | * ask for no memory. | ||
33 | */ | ||
34 | if (size == 0) { | ||
35 | printk(KERN_ERR "\"%\" is a zero-size initrd\n"); | ||
36 | return 0; | ||
37 | } | ||
38 | |||
31 | area = alloc_bootmem(size); | 39 | area = alloc_bootmem(size); |
32 | if(area == NULL) | 40 | if (area == NULL) |
33 | return 0; | 41 | return 0; |
34 | 42 | ||
35 | if(load_initrd(initrd, area, size) == -1) | 43 | if (load_initrd(initrd, area, size) == -1) |
36 | return 0; | 44 | return 0; |
37 | 45 | ||
38 | initrd_start = (unsigned long) area; | 46 | initrd_start = (unsigned long) area; |
@@ -59,13 +67,15 @@ int load_initrd(char *filename, void *buf, int size) | |||
59 | int fd, n; | 67 | int fd, n; |
60 | 68 | ||
61 | fd = os_open_file(filename, of_read(OPENFLAGS()), 0); | 69 | fd = os_open_file(filename, of_read(OPENFLAGS()), 0); |
62 | if(fd < 0){ | 70 | if (fd < 0) { |
63 | printk("Opening '%s' failed - err = %d\n", filename, -fd); | 71 | printk(KERN_ERR "Opening '%s' failed - err = %d\n", filename, |
72 | -fd); | ||
64 | return -1; | 73 | return -1; |
65 | } | 74 | } |
66 | n = os_read_file(fd, buf, size); | 75 | n = os_read_file(fd, buf, size); |
67 | if(n != size){ | 76 | if (n != size) { |
68 | printk("Read of %d bytes from '%s' failed, err = %d\n", size, | 77 | printk(KERN_ERR "Read of %d bytes from '%s' failed, " |
78 | "err = %d\n", size, | ||
69 | filename, -n); | 79 | filename, -n); |
70 | return -1; | 80 | return -1; |
71 | } | 81 | } |