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.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c
index bf3dd9659865..cff73faae991 100644
--- a/arch/um/kernel/initrd.c
+++ b/arch/um/kernel/initrd.c
@@ -21,12 +21,20 @@ static int __init read_initrd(void)
21 long long size; 21 long long size;
22 int err; 22 int err;
23 23
24 if(initrd == NULL) return 0; 24 if(initrd == NULL)
25 return 0;
26
25 err = os_file_size(initrd, &size); 27 err = os_file_size(initrd, &size);
26 if(err) return 0; 28 if(err)
29 return 0;
30
27 area = alloc_bootmem(size); 31 area = alloc_bootmem(size);
28 if(area == NULL) return 0; 32 if(area == NULL)
29 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
30 initrd_start = (unsigned long) area; 38 initrd_start = (unsigned long) area;
31 initrd_end = initrd_start + size; 39 initrd_end = initrd_start + size;
32 return 0; 40 return 0;
@@ -53,25 +61,15 @@ int load_initrd(char *filename, void *buf, int size)
53 fd = os_open_file(filename, of_read(OPENFLAGS()), 0); 61 fd = os_open_file(filename, of_read(OPENFLAGS()), 0);
54 if(fd < 0){ 62 if(fd < 0){
55 printk("Opening '%s' failed - err = %d\n", filename, -fd); 63 printk("Opening '%s' failed - err = %d\n", filename, -fd);
56 return(-1); 64 return -1;
57 } 65 }
58 n = os_read_file_k(fd, buf, size); 66 n = os_read_file_k(fd, buf, size);
59 if(n != size){ 67 if(n != size){
60 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,
61 filename, -n); 69 filename, -n);
62 return(-1); 70 return -1;
63 } 71 }
64 72
65 os_close_file(fd); 73 os_close_file(fd);
66 return(0); 74 return 0;
67} 75}
68/*
69 * Overrides for Emacs so that we follow Linus's tabbing style.
70 * Emacs will notice this stuff at the end of the file and automatically
71 * adjust the settings for this buffer only. This must remain at the end
72 * of the file.
73 * ---------------------------------------------------------------------------
74 * Local variables:
75 * c-file-style: "linux"
76 * End:
77 */