diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/chan_user.c | 11 | ||||
-rw-r--r-- | arch/um/drivers/cow_sys.h | 17 | ||||
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 124 | ||||
-rw-r--r-- | arch/um/kernel/initrd.c | 32 | ||||
-rw-r--r-- | arch/um/kernel/smp.c | 25 |
5 files changed, 89 insertions, 120 deletions
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index d226f103462e..a15be1720e03 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
@@ -203,14 +203,3 @@ void register_winch(int fd, struct tty_struct *tty) | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | |||
207 | /* | ||
208 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
209 | * Emacs will notice this stuff at the end of the file and automatically | ||
210 | * adjust the settings for this buffer only. This must remain at the end | ||
211 | * of the file. | ||
212 | * --------------------------------------------------------------------------- | ||
213 | * Local variables: | ||
214 | * c-file-style: "linux" | ||
215 | * End: | ||
216 | */ | ||
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h index 3255583eccba..aa7bef9c38d9 100644 --- a/arch/um/drivers/cow_sys.h +++ b/arch/um/drivers/cow_sys.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | static inline void *cow_malloc(int size) | 9 | static inline void *cow_malloc(int size) |
10 | { | 10 | { |
11 | return(um_kmalloc(size)); | 11 | return um_kmalloc(size); |
12 | } | 12 | } |
13 | 13 | ||
14 | static inline void cow_free(void *ptr) | 14 | static inline void cow_free(void *ptr) |
@@ -20,29 +20,22 @@ static inline void cow_free(void *ptr) | |||
20 | 20 | ||
21 | static inline char *cow_strdup(char *str) | 21 | static inline char *cow_strdup(char *str) |
22 | { | 22 | { |
23 | return(uml_strdup(str)); | 23 | return uml_strdup(str); |
24 | } | 24 | } |
25 | 25 | ||
26 | static inline int cow_seek_file(int fd, __u64 offset) | 26 | static inline int cow_seek_file(int fd, __u64 offset) |
27 | { | 27 | { |
28 | return(os_seek_file(fd, offset)); | 28 | return os_seek_file(fd, offset); |
29 | } | 29 | } |
30 | 30 | ||
31 | static inline int cow_file_size(char *file, unsigned long long *size_out) | 31 | static inline int cow_file_size(char *file, unsigned long long *size_out) |
32 | { | 32 | { |
33 | return(os_file_size(file, size_out)); | 33 | return os_file_size(file, size_out); |
34 | } | 34 | } |
35 | 35 | ||
36 | static inline int cow_write_file(int fd, void *buf, int size) | 36 | static inline int cow_write_file(int fd, void *buf, int size) |
37 | { | 37 | { |
38 | return(os_write_file_k(fd, buf, size)); | 38 | return os_write_file_k(fd, buf, size); |
39 | } | 39 | } |
40 | 40 | ||
41 | #endif | 41 | #endif |
42 | |||
43 | /* | ||
44 | * --------------------------------------------------------------------------- | ||
45 | * Local variables: | ||
46 | * c-file-style: "linux" | ||
47 | * End: | ||
48 | */ | ||
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 2a00203e1017..614fe25a31bd 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -89,7 +89,7 @@ static inline int ubd_test_bit(__u64 bit, unsigned char *data) | |||
89 | bits = sizeof(data[0]) * 8; | 89 | bits = sizeof(data[0]) * 8; |
90 | n = bit / bits; | 90 | n = bit / bits; |
91 | off = bit % bits; | 91 | off = bit % bits; |
92 | return((data[n] & (1 << off)) != 0); | 92 | return (data[n] & (1 << off)) != 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | static inline void ubd_set_bit(__u64 bit, unsigned char *data) | 95 | static inline void ubd_set_bit(__u64 bit, unsigned char *data) |
@@ -146,7 +146,7 @@ struct cow { | |||
146 | unsigned long *bitmap; | 146 | unsigned long *bitmap; |
147 | unsigned long bitmap_len; | 147 | unsigned long bitmap_len; |
148 | int bitmap_offset; | 148 | int bitmap_offset; |
149 | int data_offset; | 149 | int data_offset; |
150 | }; | 150 | }; |
151 | 151 | ||
152 | #define MAX_SG 64 | 152 | #define MAX_SG 64 |
@@ -174,10 +174,10 @@ struct ubd { | |||
174 | 174 | ||
175 | #define DEFAULT_COW { \ | 175 | #define DEFAULT_COW { \ |
176 | .file = NULL, \ | 176 | .file = NULL, \ |
177 | .fd = -1, \ | 177 | .fd = -1, \ |
178 | .bitmap = NULL, \ | 178 | .bitmap = NULL, \ |
179 | .bitmap_offset = 0, \ | 179 | .bitmap_offset = 0, \ |
180 | .data_offset = 0, \ | 180 | .data_offset = 0, \ |
181 | } | 181 | } |
182 | 182 | ||
183 | #define DEFAULT_UBD { \ | 183 | #define DEFAULT_UBD { \ |
@@ -187,9 +187,9 @@ struct ubd { | |||
187 | .size = -1, \ | 187 | .size = -1, \ |
188 | .boot_openflags = OPEN_FLAGS, \ | 188 | .boot_openflags = OPEN_FLAGS, \ |
189 | .openflags = OPEN_FLAGS, \ | 189 | .openflags = OPEN_FLAGS, \ |
190 | .no_cow = 0, \ | 190 | .no_cow = 0, \ |
191 | .shared = 0, \ | 191 | .shared = 0, \ |
192 | .cow = DEFAULT_COW, \ | 192 | .cow = DEFAULT_COW, \ |
193 | .lock = SPIN_LOCK_UNLOCKED, \ | 193 | .lock = SPIN_LOCK_UNLOCKED, \ |
194 | .request = NULL, \ | 194 | .request = NULL, \ |
195 | .start_sg = 0, \ | 195 | .start_sg = 0, \ |
@@ -249,7 +249,7 @@ static void make_ide_entries(char *dev_name) | |||
249 | static int fake_ide_setup(char *str) | 249 | static int fake_ide_setup(char *str) |
250 | { | 250 | { |
251 | fake_ide = 1; | 251 | fake_ide = 1; |
252 | return(1); | 252 | return 1; |
253 | } | 253 | } |
254 | 254 | ||
255 | __setup("fake_ide", fake_ide_setup); | 255 | __setup("fake_ide", fake_ide_setup); |
@@ -267,7 +267,7 @@ static int parse_unit(char **ptr) | |||
267 | if(isdigit(*str)) { | 267 | if(isdigit(*str)) { |
268 | n = simple_strtoul(str, &end, 0); | 268 | n = simple_strtoul(str, &end, 0); |
269 | if(end == str) | 269 | if(end == str) |
270 | return(-1); | 270 | return -1; |
271 | *ptr = end; | 271 | *ptr = end; |
272 | } | 272 | } |
273 | else if (('a' <= *str) && (*str <= 'z')) { | 273 | else if (('a' <= *str) && (*str <= 'z')) { |
@@ -275,7 +275,7 @@ static int parse_unit(char **ptr) | |||
275 | str++; | 275 | str++; |
276 | *ptr = str; | 276 | *ptr = str; |
277 | } | 277 | } |
278 | return(n); | 278 | return n; |
279 | } | 279 | } |
280 | 280 | ||
281 | /* If *index_out == -1 at exit, the passed option was a general one; | 281 | /* If *index_out == -1 at exit, the passed option was a general one; |
@@ -442,7 +442,7 @@ static int udb_setup(char *str) | |||
442 | { | 442 | { |
443 | printk("udb%s specified on command line is almost certainly a ubd -> " | 443 | printk("udb%s specified on command line is almost certainly a ubd -> " |
444 | "udb TYPO\n", str); | 444 | "udb TYPO\n", str); |
445 | return(1); | 445 | return 1; |
446 | } | 446 | } |
447 | 447 | ||
448 | __setup("udb", udb_setup); | 448 | __setup("udb", udb_setup); |
@@ -541,7 +541,7 @@ static void ubd_handler(void) | |||
541 | static irqreturn_t ubd_intr(int irq, void *dev) | 541 | static irqreturn_t ubd_intr(int irq, void *dev) |
542 | { | 542 | { |
543 | ubd_handler(); | 543 | ubd_handler(); |
544 | return(IRQ_HANDLED); | 544 | return IRQ_HANDLED; |
545 | } | 545 | } |
546 | 546 | ||
547 | /* Only changed by ubd_init, which is an initcall. */ | 547 | /* Only changed by ubd_init, which is an initcall. */ |
@@ -560,7 +560,7 @@ static inline int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out) | |||
560 | char *file; | 560 | char *file; |
561 | 561 | ||
562 | file = ubd_dev->cow.file ? ubd_dev->cow.file : ubd_dev->file; | 562 | file = ubd_dev->cow.file ? ubd_dev->cow.file : ubd_dev->file; |
563 | return(os_file_size(file, size_out)); | 563 | return os_file_size(file, size_out); |
564 | } | 564 | } |
565 | 565 | ||
566 | static void ubd_close_dev(struct ubd *ubd_dev) | 566 | static void ubd_close_dev(struct ubd *ubd_dev) |
@@ -632,10 +632,10 @@ static int ubd_open_dev(struct ubd *ubd_dev) | |||
632 | if(err < 0) goto error; | 632 | if(err < 0) goto error; |
633 | ubd_dev->cow.fd = err; | 633 | ubd_dev->cow.fd = err; |
634 | } | 634 | } |
635 | return(0); | 635 | return 0; |
636 | error: | 636 | error: |
637 | os_close_file(ubd_dev->fd); | 637 | os_close_file(ubd_dev->fd); |
638 | return(err); | 638 | return err; |
639 | } | 639 | } |
640 | 640 | ||
641 | static void ubd_device_release(struct device *dev) | 641 | static void ubd_device_release(struct device *dev) |
@@ -653,7 +653,7 @@ static int ubd_disk_register(int major, u64 size, int unit, | |||
653 | 653 | ||
654 | disk = alloc_disk(1 << UBD_SHIFT); | 654 | disk = alloc_disk(1 << UBD_SHIFT); |
655 | if(disk == NULL) | 655 | if(disk == NULL) |
656 | return(-ENOMEM); | 656 | return -ENOMEM; |
657 | 657 | ||
658 | disk->major = major; | 658 | disk->major = major; |
659 | disk->first_minor = unit << UBD_SHIFT; | 659 | disk->first_minor = unit << UBD_SHIFT; |
@@ -758,14 +758,14 @@ static int ubd_config(char *str, char **error_out) | |||
758 | goto err_free; | 758 | goto err_free; |
759 | } | 759 | } |
760 | 760 | ||
761 | mutex_lock(&ubd_lock); | 761 | mutex_lock(&ubd_lock); |
762 | ret = ubd_add(n, error_out); | 762 | ret = ubd_add(n, error_out); |
763 | if (ret) | 763 | if (ret) |
764 | ubd_devs[n].file = NULL; | 764 | ubd_devs[n].file = NULL; |
765 | mutex_unlock(&ubd_lock); | 765 | mutex_unlock(&ubd_lock); |
766 | 766 | ||
767 | out: | 767 | out: |
768 | return ret; | 768 | return ret; |
769 | 769 | ||
770 | err_free: | 770 | err_free: |
771 | kfree(str); | 771 | kfree(str); |
@@ -780,7 +780,7 @@ static int ubd_get_config(char *name, char *str, int size, char **error_out) | |||
780 | n = parse_unit(&name); | 780 | n = parse_unit(&name); |
781 | if((n >= MAX_DEV) || (n < 0)){ | 781 | if((n >= MAX_DEV) || (n < 0)){ |
782 | *error_out = "ubd_get_config : device number out of range"; | 782 | *error_out = "ubd_get_config : device number out of range"; |
783 | return(-1); | 783 | return -1; |
784 | } | 784 | } |
785 | 785 | ||
786 | ubd_dev = &ubd_devs[n]; | 786 | ubd_dev = &ubd_devs[n]; |
@@ -801,17 +801,17 @@ static int ubd_get_config(char *name, char *str, int size, char **error_out) | |||
801 | 801 | ||
802 | out: | 802 | out: |
803 | mutex_unlock(&ubd_lock); | 803 | mutex_unlock(&ubd_lock); |
804 | return(len); | 804 | return len; |
805 | } | 805 | } |
806 | 806 | ||
807 | static int ubd_id(char **str, int *start_out, int *end_out) | 807 | static int ubd_id(char **str, int *start_out, int *end_out) |
808 | { | 808 | { |
809 | int n; | 809 | int n; |
810 | 810 | ||
811 | n = parse_unit(str); | 811 | n = parse_unit(str); |
812 | *start_out = 0; | 812 | *start_out = 0; |
813 | *end_out = MAX_DEV - 1; | 813 | *end_out = MAX_DEV - 1; |
814 | return n; | 814 | return n; |
815 | } | 815 | } |
816 | 816 | ||
817 | static int ubd_remove(int n, char **error_out) | 817 | static int ubd_remove(int n, char **error_out) |
@@ -832,7 +832,7 @@ static int ubd_remove(int n, char **error_out) | |||
832 | if(ubd_dev->count > 0) | 832 | if(ubd_dev->count > 0) |
833 | goto out; | 833 | goto out; |
834 | 834 | ||
835 | ubd_gendisk[n] = NULL; | 835 | ubd_gendisk[n] = NULL; |
836 | if(disk != NULL){ | 836 | if(disk != NULL){ |
837 | del_gendisk(disk); | 837 | del_gendisk(disk); |
838 | put_disk(disk); | 838 | put_disk(disk); |
@@ -858,7 +858,7 @@ static struct mc_device ubd_mc = { | |||
858 | .list = LIST_HEAD_INIT(ubd_mc.list), | 858 | .list = LIST_HEAD_INIT(ubd_mc.list), |
859 | .name = "ubd", | 859 | .name = "ubd", |
860 | .config = ubd_config, | 860 | .config = ubd_config, |
861 | .get_config = ubd_get_config, | 861 | .get_config = ubd_get_config, |
862 | .id = ubd_id, | 862 | .id = ubd_id, |
863 | .remove = ubd_remove, | 863 | .remove = ubd_remove, |
864 | }; | 864 | }; |
@@ -880,7 +880,7 @@ static int __init ubd0_init(void) | |||
880 | ubd_dev->file = "root_fs"; | 880 | ubd_dev->file = "root_fs"; |
881 | mutex_unlock(&ubd_lock); | 881 | mutex_unlock(&ubd_lock); |
882 | 882 | ||
883 | return(0); | 883 | return 0; |
884 | } | 884 | } |
885 | 885 | ||
886 | __initcall(ubd0_init); | 886 | __initcall(ubd0_init); |
@@ -908,14 +908,14 @@ static int __init ubd_init(void) | |||
908 | return -1; | 908 | return -1; |
909 | } | 909 | } |
910 | platform_driver_register(&ubd_driver); | 910 | platform_driver_register(&ubd_driver); |
911 | mutex_lock(&ubd_lock); | 911 | mutex_lock(&ubd_lock); |
912 | for (i = 0; i < MAX_DEV; i++){ | 912 | for (i = 0; i < MAX_DEV; i++){ |
913 | err = ubd_add(i, &error); | 913 | err = ubd_add(i, &error); |
914 | if(err) | 914 | if(err) |
915 | printk(KERN_ERR "Failed to initialize ubd device %d :" | 915 | printk(KERN_ERR "Failed to initialize ubd device %d :" |
916 | "%s\n", i, error); | 916 | "%s\n", i, error); |
917 | } | 917 | } |
918 | mutex_unlock(&ubd_lock); | 918 | mutex_unlock(&ubd_lock); |
919 | return 0; | 919 | return 0; |
920 | } | 920 | } |
921 | 921 | ||
@@ -939,7 +939,7 @@ static int __init ubd_driver_init(void){ | |||
939 | "ubd : Failed to start I/O thread (errno = %d) - " | 939 | "ubd : Failed to start I/O thread (errno = %d) - " |
940 | "falling back to synchronous I/O\n", -io_pid); | 940 | "falling back to synchronous I/O\n", -io_pid); |
941 | io_pid = -1; | 941 | io_pid = -1; |
942 | return(0); | 942 | return 0; |
943 | } | 943 | } |
944 | err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr, | 944 | err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr, |
945 | IRQF_DISABLED, "ubd", ubd_devs); | 945 | IRQF_DISABLED, "ubd", ubd_devs); |
@@ -974,7 +974,7 @@ static int ubd_open(struct inode *inode, struct file *filp) | |||
974 | err = -EROFS; | 974 | err = -EROFS; |
975 | }*/ | 975 | }*/ |
976 | out: | 976 | out: |
977 | return(err); | 977 | return err; |
978 | } | 978 | } |
979 | 979 | ||
980 | static int ubd_release(struct inode * inode, struct file * file) | 980 | static int ubd_release(struct inode * inode, struct file * file) |
@@ -984,7 +984,7 @@ static int ubd_release(struct inode * inode, struct file * file) | |||
984 | 984 | ||
985 | if(--ubd_dev->count == 0) | 985 | if(--ubd_dev->count == 0) |
986 | ubd_close_dev(ubd_dev); | 986 | ubd_close_dev(ubd_dev); |
987 | return(0); | 987 | return 0; |
988 | } | 988 | } |
989 | 989 | ||
990 | static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask, | 990 | static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask, |
@@ -1040,7 +1040,7 @@ static void cowify_req(struct io_thread_req *req, unsigned long *bitmap, | |||
1040 | if(ubd_test_bit(sector + i, (unsigned char *) bitmap)) | 1040 | if(ubd_test_bit(sector + i, (unsigned char *) bitmap)) |
1041 | ubd_set_bit(i, (unsigned char *) | 1041 | ubd_set_bit(i, (unsigned char *) |
1042 | &req->sector_mask); | 1042 | &req->sector_mask); |
1043 | } | 1043 | } |
1044 | } | 1044 | } |
1045 | else cowify_bitmap(req->offset, req->length, &req->sector_mask, | 1045 | else cowify_bitmap(req->offset, req->length, &req->sector_mask, |
1046 | &req->cow_offset, bitmap, bitmap_offset, | 1046 | &req->cow_offset, bitmap, bitmap_offset, |
@@ -1157,21 +1157,21 @@ static int ubd_ioctl(struct inode * inode, struct file * file, | |||
1157 | ubd_id.cyls = ubd_dev->size / (128 * 32 * 512); | 1157 | ubd_id.cyls = ubd_dev->size / (128 * 32 * 512); |
1158 | if(copy_to_user((char __user *) arg, (char *) &ubd_id, | 1158 | if(copy_to_user((char __user *) arg, (char *) &ubd_id, |
1159 | sizeof(ubd_id))) | 1159 | sizeof(ubd_id))) |
1160 | return(-EFAULT); | 1160 | return -EFAULT; |
1161 | return(0); | 1161 | return 0; |
1162 | 1162 | ||
1163 | case CDROMVOLREAD: | 1163 | case CDROMVOLREAD: |
1164 | if(copy_from_user(&volume, (char __user *) arg, sizeof(volume))) | 1164 | if(copy_from_user(&volume, (char __user *) arg, sizeof(volume))) |
1165 | return(-EFAULT); | 1165 | return -EFAULT; |
1166 | volume.channel0 = 255; | 1166 | volume.channel0 = 255; |
1167 | volume.channel1 = 255; | 1167 | volume.channel1 = 255; |
1168 | volume.channel2 = 255; | 1168 | volume.channel2 = 255; |
1169 | volume.channel3 = 255; | 1169 | volume.channel3 = 255; |
1170 | if(copy_to_user((char __user *) arg, &volume, sizeof(volume))) | 1170 | if(copy_to_user((char __user *) arg, &volume, sizeof(volume))) |
1171 | return(-EFAULT); | 1171 | return -EFAULT; |
1172 | return(0); | 1172 | return 0; |
1173 | } | 1173 | } |
1174 | return(-EINVAL); | 1174 | return -EINVAL; |
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow) | 1177 | static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow) |
@@ -1213,29 +1213,29 @@ static int backing_file_mismatch(char *file, __u64 size, time_t mtime) | |||
1213 | if(err < 0){ | 1213 | if(err < 0){ |
1214 | printk("Failed to get modification time of backing file " | 1214 | printk("Failed to get modification time of backing file " |
1215 | "\"%s\", err = %d\n", file, -err); | 1215 | "\"%s\", err = %d\n", file, -err); |
1216 | return(err); | 1216 | return err; |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | err = os_file_size(file, &actual); | 1219 | err = os_file_size(file, &actual); |
1220 | if(err < 0){ | 1220 | if(err < 0){ |
1221 | printk("Failed to get size of backing file \"%s\", " | 1221 | printk("Failed to get size of backing file \"%s\", " |
1222 | "err = %d\n", file, -err); | 1222 | "err = %d\n", file, -err); |
1223 | return(err); | 1223 | return err; |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | if(actual != size){ | 1226 | if(actual != size){ |
1227 | /*__u64 can be a long on AMD64 and with %lu GCC complains; so | 1227 | /*__u64 can be a long on AMD64 and with %lu GCC complains; so |
1228 | * the typecast.*/ | 1228 | * the typecast.*/ |
1229 | printk("Size mismatch (%llu vs %llu) of COW header vs backing " | 1229 | printk("Size mismatch (%llu vs %llu) of COW header vs backing " |
1230 | "file\n", (unsigned long long) size, actual); | 1230 | "file\n", (unsigned long long) size, actual); |
1231 | return(-EINVAL); | 1231 | return -EINVAL; |
1232 | } | 1232 | } |
1233 | if(modtime != mtime){ | 1233 | if(modtime != mtime){ |
1234 | printk("mtime mismatch (%ld vs %ld) of COW header vs backing " | 1234 | printk("mtime mismatch (%ld vs %ld) of COW header vs backing " |
1235 | "file\n", mtime, modtime); | 1235 | "file\n", mtime, modtime); |
1236 | return(-EINVAL); | 1236 | return -EINVAL; |
1237 | } | 1237 | } |
1238 | return(0); | 1238 | return 0; |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | int read_cow_bitmap(int fd, void *buf, int offset, int len) | 1241 | int read_cow_bitmap(int fd, void *buf, int offset, int len) |
@@ -1244,13 +1244,13 @@ int read_cow_bitmap(int fd, void *buf, int offset, int len) | |||
1244 | 1244 | ||
1245 | err = os_seek_file(fd, offset); | 1245 | err = os_seek_file(fd, offset); |
1246 | if(err < 0) | 1246 | if(err < 0) |
1247 | return(err); | 1247 | return err; |
1248 | 1248 | ||
1249 | err = os_read_file_k(fd, buf, len); | 1249 | err = os_read_file(fd, buf, len); |
1250 | if(err < 0) | 1250 | if(err < 0) |
1251 | return(err); | 1251 | return err; |
1252 | 1252 | ||
1253 | return(0); | 1253 | return 0; |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | int open_ubd_file(char *file, struct openflags *openflags, int shared, | 1256 | int open_ubd_file(char *file, struct openflags *openflags, int shared, |
@@ -1268,14 +1268,14 @@ int open_ubd_file(char *file, struct openflags *openflags, int shared, | |||
1268 | if (fd < 0) { | 1268 | if (fd < 0) { |
1269 | if ((fd == -ENOENT) && (create_cow_out != NULL)) | 1269 | if ((fd == -ENOENT) && (create_cow_out != NULL)) |
1270 | *create_cow_out = 1; | 1270 | *create_cow_out = 1; |
1271 | if (!openflags->w || | 1271 | if (!openflags->w || |
1272 | ((fd != -EROFS) && (fd != -EACCES))) | 1272 | ((fd != -EROFS) && (fd != -EACCES))) |
1273 | return fd; | 1273 | return fd; |
1274 | openflags->w = 0; | 1274 | openflags->w = 0; |
1275 | fd = os_open_file(file, *openflags, mode); | 1275 | fd = os_open_file(file, *openflags, mode); |
1276 | if (fd < 0) | 1276 | if (fd < 0) |
1277 | return fd; | 1277 | return fd; |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | if(shared) | 1280 | if(shared) |
1281 | printk("Not locking \"%s\" on the host\n", file); | 1281 | printk("Not locking \"%s\" on the host\n", file); |
@@ -1289,7 +1289,7 @@ int open_ubd_file(char *file, struct openflags *openflags, int shared, | |||
1289 | 1289 | ||
1290 | /* Successful return case! */ | 1290 | /* Successful return case! */ |
1291 | if(backing_file_out == NULL) | 1291 | if(backing_file_out == NULL) |
1292 | return(fd); | 1292 | return fd; |
1293 | 1293 | ||
1294 | err = read_cow_header(file_reader, &fd, &version, &backing_file, &mtime, | 1294 | err = read_cow_header(file_reader, &fd, &version, &backing_file, &mtime, |
1295 | &size, §orsize, &align, bitmap_offset_out); | 1295 | &size, §orsize, &align, bitmap_offset_out); |
@@ -1299,7 +1299,7 @@ int open_ubd_file(char *file, struct openflags *openflags, int shared, | |||
1299 | goto out_close; | 1299 | goto out_close; |
1300 | } | 1300 | } |
1301 | if(err) | 1301 | if(err) |
1302 | return(fd); | 1302 | return fd; |
1303 | 1303 | ||
1304 | asked_switch = path_requires_switch(*backing_file_out, backing_file, file); | 1304 | asked_switch = path_requires_switch(*backing_file_out, backing_file, file); |
1305 | 1305 | ||
@@ -1322,7 +1322,7 @@ int open_ubd_file(char *file, struct openflags *openflags, int shared, | |||
1322 | cow_sizes(version, size, sectorsize, align, *bitmap_offset_out, | 1322 | cow_sizes(version, size, sectorsize, align, *bitmap_offset_out, |
1323 | bitmap_len_out, data_offset_out); | 1323 | bitmap_len_out, data_offset_out); |
1324 | 1324 | ||
1325 | return fd; | 1325 | return fd; |
1326 | out_close: | 1326 | out_close: |
1327 | os_close_file(fd); | 1327 | os_close_file(fd); |
1328 | return err; | 1328 | return err; |
@@ -1347,10 +1347,10 @@ int create_cow_file(char *cow_file, char *backing_file, struct openflags flags, | |||
1347 | bitmap_offset_out, bitmap_len_out, | 1347 | bitmap_offset_out, bitmap_len_out, |
1348 | data_offset_out); | 1348 | data_offset_out); |
1349 | if(!err) | 1349 | if(!err) |
1350 | return(fd); | 1350 | return fd; |
1351 | os_close_file(fd); | 1351 | os_close_file(fd); |
1352 | out: | 1352 | out: |
1353 | return(err); | 1353 | return err; |
1354 | } | 1354 | } |
1355 | 1355 | ||
1356 | static int update_bitmap(struct io_thread_req *req) | 1356 | static int update_bitmap(struct io_thread_req *req) |
@@ -1358,12 +1358,12 @@ static int update_bitmap(struct io_thread_req *req) | |||
1358 | int n; | 1358 | int n; |
1359 | 1359 | ||
1360 | if(req->cow_offset == -1) | 1360 | if(req->cow_offset == -1) |
1361 | return(0); | 1361 | return 0; |
1362 | 1362 | ||
1363 | n = os_seek_file(req->fds[1], req->cow_offset); | 1363 | n = os_seek_file(req->fds[1], req->cow_offset); |
1364 | if(n < 0){ | 1364 | if(n < 0){ |
1365 | printk("do_io - bitmap lseek failed : err = %d\n", -n); | 1365 | printk("do_io - bitmap lseek failed : err = %d\n", -n); |
1366 | return(1); | 1366 | return 1; |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | n = os_write_file_k(req->fds[1], &req->bitmap_words, | 1369 | n = os_write_file_k(req->fds[1], &req->bitmap_words, |
@@ -1371,10 +1371,10 @@ static int update_bitmap(struct io_thread_req *req) | |||
1371 | if(n != sizeof(req->bitmap_words)){ | 1371 | if(n != sizeof(req->bitmap_words)){ |
1372 | printk("do_io - bitmap update failed, err = %d fd = %d\n", -n, | 1372 | printk("do_io - bitmap update failed, err = %d fd = %d\n", -n, |
1373 | req->fds[1]); | 1373 | req->fds[1]); |
1374 | return(1); | 1374 | return 1; |
1375 | } | 1375 | } |
1376 | 1376 | ||
1377 | return(0); | 1377 | return 0; |
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | void do_io(struct io_thread_req *req) | 1380 | void do_io(struct io_thread_req *req) |
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 | */ | ||
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c index 47b690893c06..9ac562124654 100644 --- a/arch/um/kernel/smp.c +++ b/arch/um/kernel/smp.c | |||
@@ -89,7 +89,7 @@ static int idle_proc(void *cpup) | |||
89 | 89 | ||
90 | cpu_set(cpu, cpu_online_map); | 90 | cpu_set(cpu, cpu_online_map); |
91 | default_idle(); | 91 | default_idle(); |
92 | return(0); | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | static struct task_struct *idle_thread(int cpu) | 95 | static struct task_struct *idle_thread(int cpu) |
@@ -97,8 +97,8 @@ static struct task_struct *idle_thread(int cpu) | |||
97 | struct task_struct *new_task; | 97 | struct task_struct *new_task; |
98 | unsigned char c; | 98 | unsigned char c; |
99 | 99 | ||
100 | current->thread.request.u.thread.proc = idle_proc; | 100 | current->thread.request.u.thread.proc = idle_proc; |
101 | current->thread.request.u.thread.arg = (void *) cpu; | 101 | current->thread.request.u.thread.arg = (void *) cpu; |
102 | new_task = fork_idle(cpu); | 102 | new_task = fork_idle(cpu); |
103 | if(IS_ERR(new_task)) | 103 | if(IS_ERR(new_task)) |
104 | panic("copy_process failed in idle_thread, error = %ld", | 104 | panic("copy_process failed in idle_thread, error = %ld", |
@@ -111,7 +111,7 @@ static struct task_struct *idle_thread(int cpu) | |||
111 | CHOOSE_MODE(os_write_file_k(new_task->thread.mode.tt.switch_pipe[1], &c, | 111 | CHOOSE_MODE(os_write_file_k(new_task->thread.mode.tt.switch_pipe[1], &c, |
112 | sizeof(c)), | 112 | sizeof(c)), |
113 | ({ panic("skas mode doesn't support SMP"); })); | 113 | ({ panic("skas mode doesn't support SMP"); })); |
114 | return(new_task); | 114 | return new_task; |
115 | } | 115 | } |
116 | 116 | ||
117 | void smp_prepare_cpus(unsigned int maxcpus) | 117 | void smp_prepare_cpus(unsigned int maxcpus) |
@@ -162,13 +162,13 @@ int __cpu_up(unsigned int cpu) | |||
162 | cpu_set(cpu, smp_commenced_mask); | 162 | cpu_set(cpu, smp_commenced_mask); |
163 | while (!cpu_isset(cpu, cpu_online_map)) | 163 | while (!cpu_isset(cpu, cpu_online_map)) |
164 | mb(); | 164 | mb(); |
165 | return(0); | 165 | return 0; |
166 | } | 166 | } |
167 | 167 | ||
168 | int setup_profiling_timer(unsigned int multiplier) | 168 | int setup_profiling_timer(unsigned int multiplier) |
169 | { | 169 | { |
170 | printk(KERN_INFO "setup_profiling_timer\n"); | 170 | printk(KERN_INFO "setup_profiling_timer\n"); |
171 | return(0); | 171 | return 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | void smp_call_function_slave(int cpu); | 174 | void smp_call_function_slave(int cpu); |
@@ -204,7 +204,7 @@ void IPI_handler(int cpu) | |||
204 | 204 | ||
205 | int hard_smp_processor_id(void) | 205 | int hard_smp_processor_id(void) |
206 | { | 206 | { |
207 | return(pid_to_processor_id(os_getpid())); | 207 | return pid_to_processor_id(os_getpid()); |
208 | } | 208 | } |
209 | 209 | ||
210 | static DEFINE_SPINLOCK(call_lock); | 210 | static DEFINE_SPINLOCK(call_lock); |
@@ -253,14 +253,3 @@ int smp_call_function(void (*_func)(void *info), void *_info, int nonatomic, | |||
253 | } | 253 | } |
254 | 254 | ||
255 | #endif | 255 | #endif |
256 | |||
257 | /* | ||
258 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
259 | * Emacs will notice this stuff at the end of the file and automatically | ||
260 | * adjust the settings for this buffer only. This must remain at the end | ||
261 | * of the file. | ||
262 | * --------------------------------------------------------------------------- | ||
263 | * Local variables: | ||
264 | * c-file-style: "linux" | ||
265 | * End: | ||
266 | */ | ||