diff options
Diffstat (limited to 'arch/um/drivers/ubd_kern.c')
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 125a63fd3a45..49c047b75cc5 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -202,17 +202,6 @@ struct ubd { | |||
202 | 202 | ||
203 | struct ubd ubd_devs[MAX_DEV] = { [ 0 ... MAX_DEV - 1 ] = DEFAULT_UBD }; | 203 | struct ubd ubd_devs[MAX_DEV] = { [ 0 ... MAX_DEV - 1 ] = DEFAULT_UBD }; |
204 | 204 | ||
205 | static int ubd0_init(void) | ||
206 | { | ||
207 | struct ubd *ubd_dev = &ubd_devs[0]; | ||
208 | |||
209 | if(ubd_dev->file == NULL) | ||
210 | ubd_dev->file = "root_fs"; | ||
211 | return(0); | ||
212 | } | ||
213 | |||
214 | __initcall(ubd0_init); | ||
215 | |||
216 | /* Only changed by fake_ide_setup which is a setup */ | 205 | /* Only changed by fake_ide_setup which is a setup */ |
217 | static int fake_ide = 0; | 206 | static int fake_ide = 0; |
218 | static struct proc_dir_entry *proc_ide_root = NULL; | 207 | static struct proc_dir_entry *proc_ide_root = NULL; |
@@ -293,6 +282,10 @@ static int parse_unit(char **ptr) | |||
293 | return(n); | 282 | return(n); |
294 | } | 283 | } |
295 | 284 | ||
285 | /* If *index_out == -1 at exit, the passed option was a general one; | ||
286 | * otherwise, the str pointer is used (and owned) inside ubd_devs array, so it | ||
287 | * should not be freed on exit. | ||
288 | */ | ||
296 | static int ubd_setup_common(char *str, int *index_out) | 289 | static int ubd_setup_common(char *str, int *index_out) |
297 | { | 290 | { |
298 | struct ubd *ubd_dev; | 291 | struct ubd *ubd_dev; |
@@ -480,8 +473,9 @@ int thread_fd = -1; | |||
480 | 473 | ||
481 | /* Changed by ubd_handler, which is serialized because interrupts only | 474 | /* Changed by ubd_handler, which is serialized because interrupts only |
482 | * happen on CPU 0. | 475 | * happen on CPU 0. |
476 | * XXX: currently unused. | ||
483 | */ | 477 | */ |
484 | int intr_count = 0; | 478 | static int intr_count = 0; |
485 | 479 | ||
486 | /* call ubd_finish if you need to serialize */ | 480 | /* call ubd_finish if you need to serialize */ |
487 | static void __ubd_finish(struct request *req, int error) | 481 | static void __ubd_finish(struct request *req, int error) |
@@ -554,7 +548,7 @@ void kill_io_thread(void) | |||
554 | 548 | ||
555 | __uml_exitcall(kill_io_thread); | 549 | __uml_exitcall(kill_io_thread); |
556 | 550 | ||
557 | static int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out) | 551 | static inline int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out) |
558 | { | 552 | { |
559 | char *file; | 553 | char *file; |
560 | 554 | ||
@@ -724,7 +718,7 @@ static int ubd_config(char *str) | |||
724 | } | 718 | } |
725 | if (n == -1) { | 719 | if (n == -1) { |
726 | ret = 0; | 720 | ret = 0; |
727 | goto out; | 721 | goto err_free; |
728 | } | 722 | } |
729 | 723 | ||
730 | mutex_lock(&ubd_lock); | 724 | mutex_lock(&ubd_lock); |
@@ -821,6 +815,7 @@ out: | |||
821 | return err; | 815 | return err; |
822 | } | 816 | } |
823 | 817 | ||
818 | /* All these are called by mconsole in process context and without ubd-specific locks. */ | ||
824 | static struct mc_device ubd_mc = { | 819 | static struct mc_device ubd_mc = { |
825 | .name = "ubd", | 820 | .name = "ubd", |
826 | .config = ubd_config, | 821 | .config = ubd_config, |
@@ -829,7 +824,7 @@ static struct mc_device ubd_mc = { | |||
829 | .remove = ubd_remove, | 824 | .remove = ubd_remove, |
830 | }; | 825 | }; |
831 | 826 | ||
832 | static int ubd_mc_init(void) | 827 | static int __init ubd_mc_init(void) |
833 | { | 828 | { |
834 | mconsole_register_dev(&ubd_mc); | 829 | mconsole_register_dev(&ubd_mc); |
835 | return 0; | 830 | return 0; |
@@ -837,13 +832,24 @@ static int ubd_mc_init(void) | |||
837 | 832 | ||
838 | __initcall(ubd_mc_init); | 833 | __initcall(ubd_mc_init); |
839 | 834 | ||
835 | static int __init ubd0_init(void) | ||
836 | { | ||
837 | struct ubd *ubd_dev = &ubd_devs[0]; | ||
838 | |||
839 | if(ubd_dev->file == NULL) | ||
840 | ubd_dev->file = "root_fs"; | ||
841 | return(0); | ||
842 | } | ||
843 | |||
844 | __initcall(ubd0_init); | ||
845 | |||
840 | static struct platform_driver ubd_driver = { | 846 | static struct platform_driver ubd_driver = { |
841 | .driver = { | 847 | .driver = { |
842 | .name = DRIVER_NAME, | 848 | .name = DRIVER_NAME, |
843 | }, | 849 | }, |
844 | }; | 850 | }; |
845 | 851 | ||
846 | int ubd_init(void) | 852 | static int __init ubd_init(void) |
847 | { | 853 | { |
848 | int i; | 854 | int i; |
849 | 855 | ||
@@ -871,7 +877,7 @@ int ubd_init(void) | |||
871 | 877 | ||
872 | late_initcall(ubd_init); | 878 | late_initcall(ubd_init); |
873 | 879 | ||
874 | int ubd_driver_init(void){ | 880 | static int __init ubd_driver_init(void){ |
875 | unsigned long stack; | 881 | unsigned long stack; |
876 | int err; | 882 | int err; |
877 | 883 | ||
@@ -1378,8 +1384,8 @@ void do_io(struct io_thread_req *req) | |||
1378 | */ | 1384 | */ |
1379 | int kernel_fd = -1; | 1385 | int kernel_fd = -1; |
1380 | 1386 | ||
1381 | /* Only changed by the io thread */ | 1387 | /* Only changed by the io thread. XXX: currently unused. */ |
1382 | int io_count = 0; | 1388 | static int io_count = 0; |
1383 | 1389 | ||
1384 | int io_thread(void *arg) | 1390 | int io_thread(void *arg) |
1385 | { | 1391 | { |