aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2006-10-31 01:07:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-31 11:07:00 -0500
commitd8d7c28ec0b50ac57ddc909ae6eca1519473f300 (patch)
treedd5c142fb98ed51c521a46fc95a04ee8cf7b7fe1
parent0bf16bffeef65622603af22151156807323d7dc7 (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>
-rw-r--r--arch/um/drivers/ubd_kern.c44
-rw-r--r--arch/um/include/mconsole_kern.h1
-rw-r--r--arch/um/kernel/tt/tracer.c1
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
203struct ubd ubd_devs[MAX_DEV] = { [ 0 ... MAX_DEV - 1 ] = DEFAULT_UBD }; 203struct ubd ubd_devs[MAX_DEV] = { [ 0 ... MAX_DEV - 1 ] = DEFAULT_UBD };
204 204
205static 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 */
217static int fake_ide = 0; 206static int fake_ide = 0;
218static struct proc_dir_entry *proc_ide_root = NULL; 207static 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 */
296static int ubd_setup_common(char *str, int *index_out) 289static 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 */
484int intr_count = 0; 478static int intr_count = 0;
485 479
486/* call ubd_finish if you need to serialize */ 480/* call ubd_finish if you need to serialize */
487static void __ubd_finish(struct request *req, int error) 481static 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
557static int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out) 551static 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. */
824static struct mc_device ubd_mc = { 819static 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
832static int ubd_mc_init(void) 827static 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
835static 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
840static struct platform_driver ubd_driver = { 846static struct platform_driver ubd_driver = {
841 .driver = { 847 .driver = {
842 .name = DRIVER_NAME, 848 .name = DRIVER_NAME,
843 }, 849 },
844}; 850};
845 851
846int ubd_init(void) 852static 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
872late_initcall(ubd_init); 878late_initcall(ubd_init);
873 879
874int ubd_driver_init(void){ 880static 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 */
1379int kernel_fd = -1; 1385int kernel_fd = -1;
1380 1386
1381/* Only changed by the io thread */ 1387/* Only changed by the io thread. XXX: currently unused. */
1382int io_count = 0; 1388static int io_count = 0;
1383 1389
1384int io_thread(void *arg) 1390int 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. */
17struct mc_device { 18struct 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 {
176int signal_index[32]; 176int signal_index[32];
177int nsignals = 0; 177int nsignals = 0;
178int debug_trace = 0; 178int debug_trace = 0;
179extern int io_nsignals, io_count, intr_count;
180 179
181extern void signal_usr1(int sig); 180extern void signal_usr1(int sig);
182 181