diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2006-10-31 01:07:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-31 11:07:00 -0500 |
commit | d8d7c28ec0b50ac57ddc909ae6eca1519473f300 (patch) | |
tree | dd5c142fb98ed51c521a46fc95a04ee8cf7b7fe1 /arch | |
parent | 0bf16bffeef65622603af22151156807323d7dc7 (diff) |
[PATCH] uml ubd driver: various little changes
Fix a small memory leak in ubd_config, and clearify the confusion which lead
to it.
Then, some little changes not affecting operations -
* move init functions together,
* add a comment about a potential problem in case of some evolution in the block layer,
* mark all initcalls as static __init functions
* mark an used once little function as inline
* document that mconsole methods are all called in process context (was
triggered when checking ubd mconsole methods).
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 44 | ||||
-rw-r--r-- | arch/um/include/mconsole_kern.h | 1 | ||||
-rw-r--r-- | arch/um/kernel/tt/tracer.c | 1 |
3 files changed, 26 insertions, 20 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 | { |
diff --git a/arch/um/include/mconsole_kern.h b/arch/um/include/mconsole_kern.h index d0b690197fd7..1ea6d928e1cd 100644 --- a/arch/um/include/mconsole_kern.h +++ b/arch/um/include/mconsole_kern.h | |||
@@ -14,6 +14,7 @@ struct mconsole_entry { | |||
14 | struct mc_request request; | 14 | struct mc_request request; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | /* All these methods are called in process context. */ | ||
17 | struct mc_device { | 18 | struct mc_device { |
18 | struct list_head list; | 19 | struct list_head list; |
19 | char *name; | 20 | char *name; |
diff --git a/arch/um/kernel/tt/tracer.c b/arch/um/kernel/tt/tracer.c index 9882342206ec..b9195355075a 100644 --- a/arch/um/kernel/tt/tracer.c +++ b/arch/um/kernel/tt/tracer.c | |||
@@ -176,7 +176,6 @@ struct { | |||
176 | int signal_index[32]; | 176 | int signal_index[32]; |
177 | int nsignals = 0; | 177 | int nsignals = 0; |
178 | int debug_trace = 0; | 178 | int debug_trace = 0; |
179 | extern int io_nsignals, io_count, intr_count; | ||
180 | 179 | ||
181 | extern void signal_usr1(int sig); | 180 | extern void signal_usr1(int sig); |
182 | 181 | ||