aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2008-02-05 01:30:41 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:25 -0500
commitc0a9290ecf0dbb89958cb3a3f78964015a7de402 (patch)
tree1a987905fe5047cd74966149fc11689713cd7bea
parent9226b8384776798986640ce07764d17ba66aa54f (diff)
uml: const and other tidying
This patch also does some improvements for uml code. Improvements include dropping unnecessary cast, killing some unnecessary code and still some constifying for pointers etc.. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/um/drivers/ubd_kern.c6
-rw-r--r--arch/um/include/kern_util.h2
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/kernel/process.c4
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c2
-rw-r--r--arch/um/os-Linux/mem.c7
-rw-r--r--arch/um/os-Linux/sigio.c2
7 files changed, 12 insertions, 13 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 9793e3da0f1d..7a252abbfead 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -229,7 +229,7 @@ static int proc_ide_read_media(char *page, char **start, off_t off, int count,
229 return len; 229 return len;
230} 230}
231 231
232static void make_ide_entries(char *dev_name) 232static void make_ide_entries(const char *dev_name)
233{ 233{
234 struct proc_dir_entry *dir, *ent; 234 struct proc_dir_entry *dir, *ent;
235 char name[64]; 235 char name[64];
@@ -244,7 +244,7 @@ static void make_ide_entries(char *dev_name)
244 ent->data = NULL; 244 ent->data = NULL;
245 ent->read_proc = proc_ide_read_media; 245 ent->read_proc = proc_ide_read_media;
246 ent->write_proc = NULL; 246 ent->write_proc = NULL;
247 sprintf(name,"ide0/%s", dev_name); 247 snprintf(name, sizeof(name), "ide0/%s", dev_name);
248 proc_symlink(dev_name, proc_ide_root, name); 248 proc_symlink(dev_name, proc_ide_root, name);
249} 249}
250 250
@@ -443,7 +443,7 @@ __uml_help(ubd_setup,
443" cluster filesystem and inappropriate at almost all other times.\n\n" 443" cluster filesystem and inappropriate at almost all other times.\n\n"
444); 444);
445 445
446static int udb_setup(char *str) 446static int udb_setup(const char *str)
447{ 447{
448 printk("udb%s specified on command line is almost certainly a ubd -> " 448 printk("udb%s specified on command line is almost certainly a ubd -> "
449 "udb TYPO\n", str); 449 "udb TYPO\n", str);
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h
index 74ce8e5370a6..aa27eb0f4586 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/kern_util.h
@@ -81,7 +81,7 @@ extern void do_uml_exitcalls(void);
81extern int attach_debugger(int idle_pid, int pid, int stop); 81extern int attach_debugger(int idle_pid, int pid, int stop);
82extern int config_gdb(char *str); 82extern int config_gdb(char *str);
83extern int remove_gdb(void); 83extern int remove_gdb(void);
84extern char *uml_strdup(char *string); 84extern char *uml_strdup(const char *string);
85extern void unprotect_kernel_mem(void); 85extern void unprotect_kernel_mem(void);
86extern void protect_kernel_mem(void); 86extern void protect_kernel_mem(void);
87extern void uml_cleanup(void); 87extern void uml_cleanup(void);
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index e3e72418f241..96072e27a0e7 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -65,7 +65,7 @@ static void setup_highmem(unsigned long highmem_start,
65void __init mem_init(void) 65void __init mem_init(void)
66{ 66{
67 /* clear the zero-page */ 67 /* clear the zero-page */
68 memset((void *) empty_zero_page, 0, PAGE_SIZE); 68 memset(empty_zero_page, 0, PAGE_SIZE);
69 69
70 /* Map in the area just after the brk now that kmalloc is about 70 /* Map in the area just after the brk now that kmalloc is about
71 * to be turned on. 71 * to be turned on.
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index c7ea7f2a8945..91bd68eaba20 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -60,8 +60,6 @@ unsigned long alloc_stack(int order, int atomic)
60 if (atomic) 60 if (atomic)
61 flags = GFP_ATOMIC; 61 flags = GFP_ATOMIC;
62 page = __get_free_pages(flags, order); 62 page = __get_free_pages(flags, order);
63 if (page == 0)
64 return 0;
65 63
66 return page; 64 return page;
67} 65}
@@ -331,7 +329,7 @@ void do_uml_exitcalls(void)
331 (*call)(); 329 (*call)();
332} 330}
333 331
334char *uml_strdup(char *string) 332char *uml_strdup(const char *string)
335{ 333{
336 return kstrdup(string, GFP_KERNEL); 334 return kstrdup(string, GFP_KERNEL);
337} 335}
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index 1037a3b6386e..1d847959d1d6 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -148,7 +148,7 @@ static int tuntap_open(void *data)
148 memset(&ifr, 0, sizeof(ifr)); 148 memset(&ifr, 0, sizeof(ifr));
149 ifr.ifr_flags = IFF_TAP | IFF_NO_PI; 149 ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
150 strlcpy(ifr.ifr_name, pri->dev_name, sizeof(ifr.ifr_name)); 150 strlcpy(ifr.ifr_name, pri->dev_name, sizeof(ifr.ifr_name));
151 if (ioctl(pri->fd, TUNSETIFF, (void *) &ifr) < 0) { 151 if (ioctl(pri->fd, TUNSETIFF, &ifr) < 0) {
152 err = -errno; 152 err = -errno;
153 printk(UM_KERN_ERR "TUNSETIFF failed, errno = %d\n", 153 printk(UM_KERN_ERR "TUNSETIFF failed, errno = %d\n",
154 errno); 154 errno);
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index c3b736adc1d9..9674ed1bef2f 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -30,7 +30,7 @@ static char *tempdir = NULL;
30 30
31static void __init find_tempdir(void) 31static void __init find_tempdir(void)
32{ 32{
33 char *dirs[] = { "TMP", "TEMP", "TMPDIR", NULL }; 33 const char *dirs[] = { "TMP", "TEMP", "TMPDIR", NULL };
34 int i; 34 int i;
35 char *dir = NULL; 35 char *dir = NULL;
36 36
@@ -59,9 +59,10 @@ static void __init find_tempdir(void)
59 * read the file as needed. If there's an error, -errno is returned; 59 * read the file as needed. If there's an error, -errno is returned;
60 * if the end of the file is reached, 0 is returned. 60 * if the end of the file is reached, 0 is returned.
61 */ 61 */
62static int next(int fd, char *buf, int size, char c) 62static int next(int fd, char *buf, size_t size, char c)
63{ 63{
64 int n, len; 64 ssize_t n;
65 size_t len;
65 char *ptr; 66 char *ptr;
66 67
67 while((ptr = strchr(buf, c)) == NULL){ 68 while((ptr = strchr(buf, c)) == NULL){
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index dc03e9cccb63..7243f5733772 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -407,7 +407,7 @@ static int async_pty(int master, int slave)
407 if((fcntl(slave, F_SETFL, flags | O_NONBLOCK) < 0)) 407 if((fcntl(slave, F_SETFL, flags | O_NONBLOCK) < 0))
408 return -errno; 408 return -errno;
409 409
410 return(0); 410 return 0;
411} 411}
412 412
413static void __init check_one_sigio(void (*proc)(int, int)) 413static void __init check_one_sigio(void (*proc)(int, int))