aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/initrd.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/initrd.c')
-rw-r--r--arch/um/kernel/initrd.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c
index 82ecf904b09c..16dc43e9d940 100644
--- a/arch/um/kernel/initrd.c
+++ b/arch/um/kernel/initrd.c
@@ -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 "user_util.h"
11#include "kern_util.h" 10#include "kern_util.h"
12#include "initrd.h" 11#include "initrd.h"
13#include "init.h" 12#include "init.h"
@@ -22,12 +21,20 @@ static int __init read_initrd(void)
22 long long size; 21 long long size;
23 int err; 22 int err;
24 23
25 if(initrd == NULL) return 0; 24 if(initrd == NULL)
25 return 0;
26
26 err = os_file_size(initrd, &size); 27 err = os_file_size(initrd, &size);
27 if(err) return 0; 28 if(err)
29 return 0;
30
28 area = alloc_bootmem(size); 31 area = alloc_bootmem(size);
29 if(area == NULL) return 0; 32 if(area == NULL)
30 if(load_initrd(initrd, area, size) == -1) return 0; 33 return 0;
34
35 if(load_initrd(initrd, area, size) == -1)
36 return 0;
37
31 initrd_start = (unsigned long) area; 38 initrd_start = (unsigned long) area;
32 initrd_end = initrd_start + size; 39 initrd_end = initrd_start + size;
33 return 0; 40 return 0;
@@ -54,25 +61,15 @@ int load_initrd(char *filename, void *buf, int size)
54 fd = os_open_file(filename, of_read(OPENFLAGS()), 0); 61 fd = os_open_file(filename, of_read(OPENFLAGS()), 0);
55 if(fd < 0){ 62 if(fd < 0){
56 printk("Opening '%s' failed - err = %d\n", filename, -fd); 63 printk("Opening '%s' failed - err = %d\n", filename, -fd);
57 return(-1); 64 return -1;
58 } 65 }
59 n = os_read_file(fd, buf, size); 66 n = os_read_file(fd, buf, size);
60 if(n != size){ 67 if(n != size){
61 printk("Read of %d bytes from '%s' failed, err = %d\n", size, 68 printk("Read of %d bytes from '%s' failed, err = %d\n", size,
62 filename, -n); 69 filename, -n);
63 return(-1); 70 return -1;
64 } 71 }
65 72
66 os_close_file(fd); 73 os_close_file(fd);
67 return(0); 74 return 0;
68} 75}
69/*
70 * Overrides for Emacs so that we follow Linus's tabbing style.
71 * Emacs will notice this stuff at the end of the file and automatically
72 * adjust the settings for this buffer only. This must remain at the end
73 * of the file.
74 * ---------------------------------------------------------------------------
75 * Local variables:
76 * c-file-style: "linux"
77 * End:
78 */