diff options
Diffstat (limited to 'arch/um/drivers')
-rw-r--r-- | arch/um/drivers/daemon_kern.c | 13 | ||||
-rw-r--r-- | arch/um/drivers/harddog_kern.c | 8 | ||||
-rw-r--r-- | arch/um/drivers/hostaudio_kern.c | 10 | ||||
-rw-r--r-- | arch/um/drivers/mcast_kern.c | 13 | ||||
-rw-r--r-- | arch/um/drivers/mconsole_kern.c | 140 | ||||
-rw-r--r-- | arch/um/drivers/pcap_kern.c | 13 | ||||
-rw-r--r-- | arch/um/drivers/slip_kern.c | 13 | ||||
-rw-r--r-- | arch/um/drivers/slirp_kern.c | 15 | ||||
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 2 |
9 files changed, 155 insertions, 72 deletions
diff --git a/arch/um/drivers/daemon_kern.c b/arch/um/drivers/daemon_kern.c index a61b7b46bc02..53d09ed78b42 100644 --- a/arch/um/drivers/daemon_kern.c +++ b/arch/um/drivers/daemon_kern.c | |||
@@ -95,18 +95,7 @@ static struct transport daemon_transport = { | |||
95 | static int register_daemon(void) | 95 | static int register_daemon(void) |
96 | { | 96 | { |
97 | register_transport(&daemon_transport); | 97 | register_transport(&daemon_transport); |
98 | return(1); | 98 | return 0; |
99 | } | 99 | } |
100 | 100 | ||
101 | __initcall(register_daemon); | 101 | __initcall(register_daemon); |
102 | |||
103 | /* | ||
104 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
105 | * Emacs will notice this stuff at the end of the file and automatically | ||
106 | * adjust the settings for this buffer only. This must remain at the end | ||
107 | * of the file. | ||
108 | * --------------------------------------------------------------------------- | ||
109 | * Local variables: | ||
110 | * c-file-style: "linux" | ||
111 | * End: | ||
112 | */ | ||
diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c index 49acb2badf32..d18a974735e6 100644 --- a/arch/um/drivers/harddog_kern.c +++ b/arch/um/drivers/harddog_kern.c | |||
@@ -104,7 +104,7 @@ static int harddog_release(struct inode *inode, struct file *file) | |||
104 | 104 | ||
105 | extern int ping_watchdog(int fd); | 105 | extern int ping_watchdog(int fd); |
106 | 106 | ||
107 | static ssize_t harddog_write(struct file *file, const char *data, size_t len, | 107 | static ssize_t harddog_write(struct file *file, const char __user *data, size_t len, |
108 | loff_t *ppos) | 108 | loff_t *ppos) |
109 | { | 109 | { |
110 | /* | 110 | /* |
@@ -118,6 +118,7 @@ static ssize_t harddog_write(struct file *file, const char *data, size_t len, | |||
118 | static int harddog_ioctl(struct inode *inode, struct file *file, | 118 | static int harddog_ioctl(struct inode *inode, struct file *file, |
119 | unsigned int cmd, unsigned long arg) | 119 | unsigned int cmd, unsigned long arg) |
120 | { | 120 | { |
121 | void __user *argp= (void __user *)arg; | ||
121 | static struct watchdog_info ident = { | 122 | static struct watchdog_info ident = { |
122 | WDIOC_SETTIMEOUT, | 123 | WDIOC_SETTIMEOUT, |
123 | 0, | 124 | 0, |
@@ -127,13 +128,12 @@ static int harddog_ioctl(struct inode *inode, struct file *file, | |||
127 | default: | 128 | default: |
128 | return -ENOTTY; | 129 | return -ENOTTY; |
129 | case WDIOC_GETSUPPORT: | 130 | case WDIOC_GETSUPPORT: |
130 | if(copy_to_user((struct harddog_info *)arg, &ident, | 131 | if(copy_to_user(argp, &ident, sizeof(ident))) |
131 | sizeof(ident))) | ||
132 | return -EFAULT; | 132 | return -EFAULT; |
133 | return 0; | 133 | return 0; |
134 | case WDIOC_GETSTATUS: | 134 | case WDIOC_GETSTATUS: |
135 | case WDIOC_GETBOOTSTATUS: | 135 | case WDIOC_GETBOOTSTATUS: |
136 | return put_user(0,(int *)arg); | 136 | return put_user(0,(int __user *)argp); |
137 | case WDIOC_KEEPALIVE: | 137 | case WDIOC_KEEPALIVE: |
138 | return(ping_watchdog(harddog_out_fd)); | 138 | return(ping_watchdog(harddog_out_fd)); |
139 | } | 139 | } |
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c index 59602b81b240..37232f908cd7 100644 --- a/arch/um/drivers/hostaudio_kern.c +++ b/arch/um/drivers/hostaudio_kern.c | |||
@@ -67,8 +67,8 @@ MODULE_PARM_DESC(mixer, MIXER_HELP); | |||
67 | 67 | ||
68 | /* /dev/dsp file operations */ | 68 | /* /dev/dsp file operations */ |
69 | 69 | ||
70 | static ssize_t hostaudio_read(struct file *file, char *buffer, size_t count, | 70 | static ssize_t hostaudio_read(struct file *file, char __user *buffer, |
71 | loff_t *ppos) | 71 | size_t count, loff_t *ppos) |
72 | { | 72 | { |
73 | struct hostaudio_state *state = file->private_data; | 73 | struct hostaudio_state *state = file->private_data; |
74 | void *kbuf; | 74 | void *kbuf; |
@@ -94,7 +94,7 @@ static ssize_t hostaudio_read(struct file *file, char *buffer, size_t count, | |||
94 | return(err); | 94 | return(err); |
95 | } | 95 | } |
96 | 96 | ||
97 | static ssize_t hostaudio_write(struct file *file, const char *buffer, | 97 | static ssize_t hostaudio_write(struct file *file, const char __user *buffer, |
98 | size_t count, loff_t *ppos) | 98 | size_t count, loff_t *ppos) |
99 | { | 99 | { |
100 | struct hostaudio_state *state = file->private_data; | 100 | struct hostaudio_state *state = file->private_data; |
@@ -152,7 +152,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file, | |||
152 | case SNDCTL_DSP_CHANNELS: | 152 | case SNDCTL_DSP_CHANNELS: |
153 | case SNDCTL_DSP_SUBDIVIDE: | 153 | case SNDCTL_DSP_SUBDIVIDE: |
154 | case SNDCTL_DSP_SETFRAGMENT: | 154 | case SNDCTL_DSP_SETFRAGMENT: |
155 | if(get_user(data, (int *) arg)) | 155 | if(get_user(data, (int __user *) arg)) |
156 | return(-EFAULT); | 156 | return(-EFAULT); |
157 | break; | 157 | break; |
158 | default: | 158 | default: |
@@ -168,7 +168,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file, | |||
168 | case SNDCTL_DSP_CHANNELS: | 168 | case SNDCTL_DSP_CHANNELS: |
169 | case SNDCTL_DSP_SUBDIVIDE: | 169 | case SNDCTL_DSP_SUBDIVIDE: |
170 | case SNDCTL_DSP_SETFRAGMENT: | 170 | case SNDCTL_DSP_SETFRAGMENT: |
171 | if(put_user(data, (int *) arg)) | 171 | if(put_user(data, (int __user *) arg)) |
172 | return(-EFAULT); | 172 | return(-EFAULT); |
173 | break; | 173 | break; |
174 | default: | 174 | default: |
diff --git a/arch/um/drivers/mcast_kern.c b/arch/um/drivers/mcast_kern.c index c9b078fba03e..3a7af18cf944 100644 --- a/arch/um/drivers/mcast_kern.c +++ b/arch/um/drivers/mcast_kern.c | |||
@@ -124,18 +124,7 @@ static struct transport mcast_transport = { | |||
124 | static int register_mcast(void) | 124 | static int register_mcast(void) |
125 | { | 125 | { |
126 | register_transport(&mcast_transport); | 126 | register_transport(&mcast_transport); |
127 | return(1); | 127 | return 0; |
128 | } | 128 | } |
129 | 129 | ||
130 | __initcall(register_mcast); | 130 | __initcall(register_mcast); |
131 | |||
132 | /* | ||
133 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
134 | * Emacs will notice this stuff at the end of the file and automatically | ||
135 | * adjust the settings for this buffer only. This must remain at the end | ||
136 | * of the file. | ||
137 | * --------------------------------------------------------------------------- | ||
138 | * Local variables: | ||
139 | * c-file-style: "linux" | ||
140 | * End: | ||
141 | */ | ||
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 1488816588ea..28e3760e8b98 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include "linux/namei.h" | 20 | #include "linux/namei.h" |
21 | #include "linux/proc_fs.h" | 21 | #include "linux/proc_fs.h" |
22 | #include "linux/syscalls.h" | 22 | #include "linux/syscalls.h" |
23 | #include "linux/list.h" | ||
24 | #include "linux/mm.h" | ||
23 | #include "linux/console.h" | 25 | #include "linux/console.h" |
24 | #include "asm/irq.h" | 26 | #include "asm/irq.h" |
25 | #include "asm/uaccess.h" | 27 | #include "asm/uaccess.h" |
@@ -347,6 +349,142 @@ static struct mc_device *mconsole_find_dev(char *name) | |||
347 | return(NULL); | 349 | return(NULL); |
348 | } | 350 | } |
349 | 351 | ||
352 | #define UNPLUGGED_PER_PAGE \ | ||
353 | ((PAGE_SIZE - sizeof(struct list_head)) / sizeof(unsigned long)) | ||
354 | |||
355 | struct unplugged_pages { | ||
356 | struct list_head list; | ||
357 | void *pages[UNPLUGGED_PER_PAGE]; | ||
358 | }; | ||
359 | |||
360 | static unsigned long long unplugged_pages_count = 0; | ||
361 | static struct list_head unplugged_pages = LIST_HEAD_INIT(unplugged_pages); | ||
362 | static int unplug_index = UNPLUGGED_PER_PAGE; | ||
363 | |||
364 | static int mem_config(char *str) | ||
365 | { | ||
366 | unsigned long long diff; | ||
367 | int err = -EINVAL, i, add; | ||
368 | char *ret; | ||
369 | |||
370 | if(str[0] != '=') | ||
371 | goto out; | ||
372 | |||
373 | str++; | ||
374 | if(str[0] == '-') | ||
375 | add = 0; | ||
376 | else if(str[0] == '+'){ | ||
377 | add = 1; | ||
378 | } | ||
379 | else goto out; | ||
380 | |||
381 | str++; | ||
382 | diff = memparse(str, &ret); | ||
383 | if(*ret != '\0') | ||
384 | goto out; | ||
385 | |||
386 | diff /= PAGE_SIZE; | ||
387 | |||
388 | for(i = 0; i < diff; i++){ | ||
389 | struct unplugged_pages *unplugged; | ||
390 | void *addr; | ||
391 | |||
392 | if(add){ | ||
393 | if(list_empty(&unplugged_pages)) | ||
394 | break; | ||
395 | |||
396 | unplugged = list_entry(unplugged_pages.next, | ||
397 | struct unplugged_pages, list); | ||
398 | if(unplug_index > 0) | ||
399 | addr = unplugged->pages[--unplug_index]; | ||
400 | else { | ||
401 | list_del(&unplugged->list); | ||
402 | addr = unplugged; | ||
403 | unplug_index = UNPLUGGED_PER_PAGE; | ||
404 | } | ||
405 | |||
406 | free_page((unsigned long) addr); | ||
407 | unplugged_pages_count--; | ||
408 | } | ||
409 | else { | ||
410 | struct page *page; | ||
411 | |||
412 | page = alloc_page(GFP_ATOMIC); | ||
413 | if(page == NULL) | ||
414 | break; | ||
415 | |||
416 | unplugged = page_address(page); | ||
417 | if(unplug_index == UNPLUGGED_PER_PAGE){ | ||
418 | INIT_LIST_HEAD(&unplugged->list); | ||
419 | list_add(&unplugged->list, &unplugged_pages); | ||
420 | unplug_index = 0; | ||
421 | } | ||
422 | else { | ||
423 | struct list_head *entry = unplugged_pages.next; | ||
424 | addr = unplugged; | ||
425 | |||
426 | unplugged = list_entry(entry, | ||
427 | struct unplugged_pages, | ||
428 | list); | ||
429 | unplugged->pages[unplug_index++] = addr; | ||
430 | err = os_drop_memory(addr, PAGE_SIZE); | ||
431 | if(err) | ||
432 | printk("Failed to release memory - " | ||
433 | "errno = %d\n", err); | ||
434 | } | ||
435 | |||
436 | unplugged_pages_count++; | ||
437 | } | ||
438 | } | ||
439 | |||
440 | err = 0; | ||
441 | out: | ||
442 | return err; | ||
443 | } | ||
444 | |||
445 | static int mem_get_config(char *name, char *str, int size, char **error_out) | ||
446 | { | ||
447 | char buf[sizeof("18446744073709551615")]; | ||
448 | int len = 0; | ||
449 | |||
450 | sprintf(buf, "%ld", uml_physmem); | ||
451 | CONFIG_CHUNK(str, size, len, buf, 1); | ||
452 | |||
453 | return len; | ||
454 | } | ||
455 | |||
456 | static int mem_id(char **str, int *start_out, int *end_out) | ||
457 | { | ||
458 | *start_out = 0; | ||
459 | *end_out = 0; | ||
460 | |||
461 | return 0; | ||
462 | } | ||
463 | |||
464 | static int mem_remove(int n) | ||
465 | { | ||
466 | return -EBUSY; | ||
467 | } | ||
468 | |||
469 | static struct mc_device mem_mc = { | ||
470 | .name = "mem", | ||
471 | .config = mem_config, | ||
472 | .get_config = mem_get_config, | ||
473 | .id = mem_id, | ||
474 | .remove = mem_remove, | ||
475 | }; | ||
476 | |||
477 | static int mem_mc_init(void) | ||
478 | { | ||
479 | if(can_drop_memory()) | ||
480 | mconsole_register_dev(&mem_mc); | ||
481 | else printk("Can't release memory to the host - memory hotplug won't " | ||
482 | "be supported\n"); | ||
483 | return 0; | ||
484 | } | ||
485 | |||
486 | __initcall(mem_mc_init); | ||
487 | |||
350 | #define CONFIG_BUF_SIZE 64 | 488 | #define CONFIG_BUF_SIZE 64 |
351 | 489 | ||
352 | static void mconsole_get_config(int (*get_config)(char *, char *, int, | 490 | static void mconsole_get_config(int (*get_config)(char *, char *, int, |
@@ -478,7 +616,7 @@ static void console_write(struct console *console, const char *string, | |||
478 | return; | 616 | return; |
479 | 617 | ||
480 | while(1){ | 618 | while(1){ |
481 | n = min(len, ARRAY_SIZE(console_buf) - console_index); | 619 | n = min((size_t)len, ARRAY_SIZE(console_buf) - console_index); |
482 | strncpy(&console_buf[console_index], string, n); | 620 | strncpy(&console_buf[console_index], string, n); |
483 | console_index += n; | 621 | console_index += n; |
484 | string += n; | 622 | string += n; |
diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c index 07c80f2156ef..466ff2c2f918 100644 --- a/arch/um/drivers/pcap_kern.c +++ b/arch/um/drivers/pcap_kern.c | |||
@@ -106,18 +106,7 @@ static struct transport pcap_transport = { | |||
106 | static int register_pcap(void) | 106 | static int register_pcap(void) |
107 | { | 107 | { |
108 | register_transport(&pcap_transport); | 108 | register_transport(&pcap_transport); |
109 | return(1); | 109 | return 0; |
110 | } | 110 | } |
111 | 111 | ||
112 | __initcall(register_pcap); | 112 | __initcall(register_pcap); |
113 | |||
114 | /* | ||
115 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
116 | * Emacs will notice this stuff at the end of the file and automatically | ||
117 | * adjust the settings for this buffer only. This must remain at the end | ||
118 | * of the file. | ||
119 | * --------------------------------------------------------------------------- | ||
120 | * Local variables: | ||
121 | * c-file-style: "linux" | ||
122 | * End: | ||
123 | */ | ||
diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c index a62f5ef445cf..163ee0d5f75e 100644 --- a/arch/um/drivers/slip_kern.c +++ b/arch/um/drivers/slip_kern.c | |||
@@ -93,18 +93,7 @@ static struct transport slip_transport = { | |||
93 | static int register_slip(void) | 93 | static int register_slip(void) |
94 | { | 94 | { |
95 | register_transport(&slip_transport); | 95 | register_transport(&slip_transport); |
96 | return(1); | 96 | return 0; |
97 | } | 97 | } |
98 | 98 | ||
99 | __initcall(register_slip); | 99 | __initcall(register_slip); |
100 | |||
101 | /* | ||
102 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
103 | * Emacs will notice this stuff at the end of the file and automatically | ||
104 | * adjust the settings for this buffer only. This must remain at the end | ||
105 | * of the file. | ||
106 | * --------------------------------------------------------------------------- | ||
107 | * Local variables: | ||
108 | * c-file-style: "linux" | ||
109 | * End: | ||
110 | */ | ||
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c index 33d7982be5d3..95e50c943e14 100644 --- a/arch/um/drivers/slirp_kern.c +++ b/arch/um/drivers/slirp_kern.c | |||
@@ -77,7 +77,7 @@ static int slirp_setup(char *str, char **mac_out, void *data) | |||
77 | int i=0; | 77 | int i=0; |
78 | 78 | ||
79 | *init = ((struct slirp_init) | 79 | *init = ((struct slirp_init) |
80 | { argw : { { "slirp", NULL } } }); | 80 | { .argw = { { "slirp", NULL } } }); |
81 | 81 | ||
82 | str = split_if_spec(str, mac_out, NULL); | 82 | str = split_if_spec(str, mac_out, NULL); |
83 | 83 | ||
@@ -116,18 +116,7 @@ static struct transport slirp_transport = { | |||
116 | static int register_slirp(void) | 116 | static int register_slirp(void) |
117 | { | 117 | { |
118 | register_transport(&slirp_transport); | 118 | register_transport(&slirp_transport); |
119 | return(1); | 119 | return 0; |
120 | } | 120 | } |
121 | 121 | ||
122 | __initcall(register_slirp); | 122 | __initcall(register_slirp); |
123 | |||
124 | /* | ||
125 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
126 | * Emacs will notice this stuff at the end of the file and automatically | ||
127 | * adjust the settings for this buffer only. This must remain at the end | ||
128 | * of the file. | ||
129 | * --------------------------------------------------------------------------- | ||
130 | * Local variables: | ||
131 | * c-file-style: "linux" | ||
132 | * End: | ||
133 | */ | ||
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 0336575d2448..0897852b09a3 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -891,7 +891,7 @@ int ubd_driver_init(void){ | |||
891 | SA_INTERRUPT, "ubd", ubd_dev); | 891 | SA_INTERRUPT, "ubd", ubd_dev); |
892 | if(err != 0) | 892 | if(err != 0) |
893 | printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err); | 893 | printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err); |
894 | return(err); | 894 | return 0; |
895 | } | 895 | } |
896 | 896 | ||
897 | device_initcall(ubd_driver_init); | 897 | device_initcall(ubd_driver_init); |