aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-05-06 17:50:58 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:13:00 -0400
commita5ed1ffa6c2480cdcf3f0aa945f0b8622fe4e90b (patch)
tree60bc11afebc2ede39683e3d08531856110872d5a
parent11100b1dfb6e9444d54d38e822753f59ee42a7e6 (diff)
uml: formatting fixes
Formatting fixes - style violations whitespace breakage emacs formatting comment removal Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/um/kernel/um_arch.c51
-rw-r--r--arch/um/os-Linux/main.c11
-rw-r--r--arch/um/sys-i386/bugs.c54
-rw-r--r--arch/um/sys-x86_64/bugs.c34
4 files changed, 67 insertions, 83 deletions
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 89c6dba731f8..299d75a41a7f 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -63,8 +63,8 @@ struct cpuinfo_um boot_cpu_data = {
63 63
64unsigned long thread_saved_pc(struct task_struct *task) 64unsigned long thread_saved_pc(struct task_struct *task)
65{ 65{
66 return(os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas, 66 return os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas,
67 task))); 67 task));
68} 68}
69 69
70static int show_cpuinfo(struct seq_file *m, void *v) 70static int show_cpuinfo(struct seq_file *m, void *v)
@@ -86,7 +86,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
86 loops_per_jiffy/(500000/HZ), 86 loops_per_jiffy/(500000/HZ),
87 (loops_per_jiffy/(5000/HZ)) % 100); 87 (loops_per_jiffy/(5000/HZ)) % 100);
88 88
89 return(0); 89 return 0;
90} 90}
91 91
92static void *c_start(struct seq_file *m, loff_t *pos) 92static void *c_start(struct seq_file *m, loff_t *pos)
@@ -212,12 +212,12 @@ __uml_setup("debug", no_skas_debug_setup,
212#ifdef CONFIG_SMP 212#ifdef CONFIG_SMP
213static int __init uml_ncpus_setup(char *line, int *add) 213static int __init uml_ncpus_setup(char *line, int *add)
214{ 214{
215 if (!sscanf(line, "%d", &ncpus)) { 215 if (!sscanf(line, "%d", &ncpus)) {
216 printf("Couldn't parse [%s]\n", line); 216 printf("Couldn't parse [%s]\n", line);
217 return -1; 217 return -1;
218 } 218 }
219 219
220 return 0; 220 return 0;
221} 221}
222 222
223__uml_setup("ncpus=", uml_ncpus_setup, 223__uml_setup("ncpus=", uml_ncpus_setup,
@@ -234,7 +234,7 @@ static int force_tt = 0;
234static int __init mode_tt_setup(char *line, int *add) 234static int __init mode_tt_setup(char *line, int *add)
235{ 235{
236 force_tt = 1; 236 force_tt = 1;
237 return(0); 237 return 0;
238} 238}
239 239
240#else 240#else
@@ -245,7 +245,7 @@ static int __init mode_tt_setup(char *line, int *add)
245static int __init mode_tt_setup(char *line, int *add) 245static int __init mode_tt_setup(char *line, int *add)
246{ 246{
247 printf("CONFIG_MODE_TT disabled - 'mode=tt' ignored\n"); 247 printf("CONFIG_MODE_TT disabled - 'mode=tt' ignored\n");
248 return(0); 248 return 0;
249} 249}
250 250
251#else 251#else
@@ -256,7 +256,7 @@ static int __init mode_tt_setup(char *line, int *add)
256static int __init mode_tt_setup(char *line, int *add) 256static int __init mode_tt_setup(char *line, int *add)
257{ 257{
258 printf("CONFIG_MODE_SKAS disabled - 'mode=tt' redundant\n"); 258 printf("CONFIG_MODE_SKAS disabled - 'mode=tt' redundant\n");
259 return(0); 259 return 0;
260} 260}
261 261
262#endif 262#endif
@@ -274,16 +274,15 @@ int mode_tt = DEFAULT_TT;
274 274
275static int __init Usage(char *line, int *add) 275static int __init Usage(char *line, int *add)
276{ 276{
277 const char **p; 277 const char **p;
278 278
279 printf(usage_string, init_utsname()->release); 279 printf(usage_string, init_utsname()->release);
280 p = &__uml_help_start; 280 p = &__uml_help_start;
281 while (p < &__uml_help_end) { 281 while (p < &__uml_help_end) {
282 printf("%s", *p); 282 printf("%s", *p);
283 p++; 283 p++;
284 } 284 }
285 exit(0); 285 exit(0);
286
287 return 0; 286 return 0;
288} 287}
289 288
@@ -379,8 +378,8 @@ int __init linux_main(int argc, char **argv)
379 set_task_sizes_skas, &task_size); 378 set_task_sizes_skas, &task_size);
380 379
381 /* 380 /*
382 * Setting up handlers to 'sig_info' struct 381 * Setting up handlers to 'sig_info' struct
383 */ 382 */
384 os_fill_handlinfo(handlinfo_kern); 383 os_fill_handlinfo(handlinfo_kern);
385 384
386 brk_start = (unsigned long) sbrk(0); 385 brk_start = (unsigned long) sbrk(0);
@@ -407,7 +406,7 @@ int __init linux_main(int argc, char **argv)
407 argv1_begin = argv[1]; 406 argv1_begin = argv[1];
408 argv1_end = &argv[1][strlen(argv[1])]; 407 argv1_end = &argv[1][strlen(argv[1])];
409#endif 408#endif
410 409
411 highmem = 0; 410 highmem = 0;
412 iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK; 411 iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
413 max_physmem = get_kmem_end() - uml_physmem - iomem_size - MIN_VMALLOC; 412 max_physmem = get_kmem_end() - uml_physmem - iomem_size - MIN_VMALLOC;
@@ -449,12 +448,12 @@ int __init linux_main(int argc, char **argv)
449 printf("Kernel virtual memory size shrunk to %lu bytes\n", 448 printf("Kernel virtual memory size shrunk to %lu bytes\n",
450 virtmem_size); 449 virtmem_size);
451 450
452 uml_postsetup(); 451 uml_postsetup();
453 452
454 task_protections((unsigned long) &init_thread_info); 453 task_protections((unsigned long) &init_thread_info);
455 os_flush_stdout(); 454 os_flush_stdout();
456 455
457 return(CHOOSE_MODE(start_uml_tt(), start_uml_skas())); 456 return CHOOSE_MODE(start_uml_tt(), start_uml_skas());
458} 457}
459 458
460extern int uml_exitcode; 459extern int uml_exitcode;
@@ -467,7 +466,7 @@ static int panic_exit(struct notifier_block *self, unsigned long unused1,
467 bust_spinlocks(0); 466 bust_spinlocks(0);
468 uml_exitcode = 1; 467 uml_exitcode = 1;
469 machine_halt(); 468 machine_halt();
470 return(0); 469 return 0;
471} 470}
472 471
473static struct notifier_block panic_exit_notifier = { 472static struct notifier_block panic_exit_notifier = {
@@ -482,14 +481,14 @@ void __init setup_arch(char **cmdline_p)
482 &panic_exit_notifier); 481 &panic_exit_notifier);
483 paging_init(); 482 paging_init();
484 strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 483 strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
485 *cmdline_p = command_line; 484 *cmdline_p = command_line;
486 setup_hostinfo(); 485 setup_hostinfo();
487} 486}
488 487
489void __init check_bugs(void) 488void __init check_bugs(void)
490{ 489{
491 arch_check_bugs(); 490 arch_check_bugs();
492 os_check_bugs(); 491 os_check_bugs();
493} 492}
494 493
495void apply_alternatives(struct alt_instr *start, struct alt_instr *end) 494void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 7aa4c2a7a593..2c089c2c63bf 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -218,7 +218,7 @@ int main(int argc, char **argv, char **envp)
218 ret = 1; 218 ret = 1;
219 } 219 }
220 printf("\n"); 220 printf("\n");
221 return(uml_exitcode); 221 return uml_exitcode;
222} 222}
223 223
224#define CAN_KMALLOC() \ 224#define CAN_KMALLOC() \
@@ -231,7 +231,7 @@ void *__wrap_malloc(int size)
231 void *ret; 231 void *ret;
232 232
233 if(!CAN_KMALLOC()) 233 if(!CAN_KMALLOC())
234 return(__real_malloc(size)); 234 return __real_malloc(size);
235 else if(size <= PAGE_SIZE) /* finding contiguos pages can be hard*/ 235 else if(size <= PAGE_SIZE) /* finding contiguos pages can be hard*/
236 ret = um_kmalloc(size); 236 ret = um_kmalloc(size);
237 else ret = um_vmalloc(size); 237 else ret = um_vmalloc(size);
@@ -242,16 +242,17 @@ void *__wrap_malloc(int size)
242 if(ret == NULL) 242 if(ret == NULL)
243 errno = ENOMEM; 243 errno = ENOMEM;
244 244
245 return(ret); 245 return ret;
246} 246}
247 247
248void *__wrap_calloc(int n, int size) 248void *__wrap_calloc(int n, int size)
249{ 249{
250 void *ptr = __wrap_malloc(n * size); 250 void *ptr = __wrap_malloc(n * size);
251 251
252 if(ptr == NULL) return(NULL); 252 if(ptr == NULL)
253 return NULL;
253 memset(ptr, 0, n * size); 254 memset(ptr, 0, n * size);
254 return(ptr); 255 return ptr;
255} 256}
256 257
257extern void __real_free(void *); 258extern void __real_free(void *);
diff --git a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c
index e524a087679f..cae0af14903a 100644
--- a/arch/um/sys-i386/bugs.c
+++ b/arch/um/sys-i386/bugs.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -32,21 +32,21 @@ static char token(int fd, char *buf, int len, char stop)
32 n = os_read_file(fd, ptr, sizeof(*ptr)); 32 n = os_read_file(fd, ptr, sizeof(*ptr));
33 c = *ptr++; 33 c = *ptr++;
34 if(n != sizeof(*ptr)){ 34 if(n != sizeof(*ptr)){
35 if(n == 0) return(0); 35 if(n == 0)
36 return 0;
36 printk("Reading /proc/cpuinfo failed, err = %d\n", -n); 37 printk("Reading /proc/cpuinfo failed, err = %d\n", -n);
37 if(n < 0) 38 if(n < 0)
38 return(n); 39 return n;
39 else 40 else return -EIO;
40 return(-EIO);
41 } 41 }
42 } while((c != '\n') && (c != stop) && (ptr < end)); 42 } while((c != '\n') && (c != stop) && (ptr < end));
43 43
44 if(ptr == end){ 44 if(ptr == end){
45 printk("Failed to find '%c' in /proc/cpuinfo\n", stop); 45 printk("Failed to find '%c' in /proc/cpuinfo\n", stop);
46 return(-1); 46 return -1;
47 } 47 }
48 *(ptr - 1) = '\0'; 48 *(ptr - 1) = '\0';
49 return(c); 49 return c;
50} 50}
51 51
52static int find_cpuinfo_line(int fd, char *key, char *scratch, int len) 52static int find_cpuinfo_line(int fd, char *key, char *scratch, int len)
@@ -58,25 +58,25 @@ static int find_cpuinfo_line(int fd, char *key, char *scratch, int len)
58 while(1){ 58 while(1){
59 c = token(fd, scratch, len - 1, ':'); 59 c = token(fd, scratch, len - 1, ':');
60 if(c <= 0) 60 if(c <= 0)
61 return(0); 61 return 0;
62 else if(c != ':'){ 62 else if(c != ':'){
63 printk("Failed to find ':' in /proc/cpuinfo\n"); 63 printk("Failed to find ':' in /proc/cpuinfo\n");
64 return(0); 64 return 0;
65 } 65 }
66 66
67 if(!strncmp(scratch, key, strlen(key))) 67 if(!strncmp(scratch, key, strlen(key)))
68 return(1); 68 return 1;
69 69
70 do { 70 do {
71 n = os_read_file(fd, &c, sizeof(c)); 71 n = os_read_file(fd, &c, sizeof(c));
72 if(n != sizeof(c)){ 72 if(n != sizeof(c)){
73 printk("Failed to find newline in " 73 printk("Failed to find newline in "
74 "/proc/cpuinfo, err = %d\n", -n); 74 "/proc/cpuinfo, err = %d\n", -n);
75 return(0); 75 return 0;
76 } 76 }
77 } while(c != '\n'); 77 } while(c != '\n');
78 } 78 }
79 return(0); 79 return 0;
80} 80}
81 81
82static int check_cpu_flag(char *feature, int *have_it) 82static int check_cpu_flag(char *feature, int *have_it)
@@ -96,7 +96,8 @@ static int check_cpu_flag(char *feature, int *have_it)
96 goto out; 96 goto out;
97 97
98 c = token(fd, buf, len - 1, ' '); 98 c = token(fd, buf, len - 1, ' ');
99 if(c < 0) goto out; 99 if(c < 0)
100 goto out;
100 else if(c != ' '){ 101 else if(c != ' '){
101 printk("Failed to find ' ' in /proc/cpuinfo\n"); 102 printk("Failed to find ' ' in /proc/cpuinfo\n");
102 goto out; 103 goto out;
@@ -104,7 +105,8 @@ static int check_cpu_flag(char *feature, int *have_it)
104 105
105 while(1){ 106 while(1){
106 c = token(fd, buf, len - 1, ' '); 107 c = token(fd, buf, len - 1, ' ');
107 if(c < 0) goto out; 108 if(c < 0)
109 goto out;
108 else if(c == '\n') break; 110 else if(c == '\n') break;
109 111
110 if(!strcmp(buf, feature)){ 112 if(!strcmp(buf, feature)){
@@ -113,8 +115,10 @@ static int check_cpu_flag(char *feature, int *have_it)
113 } 115 }
114 } 116 }
115 out: 117 out:
116 if(*have_it == 0) printk("No\n"); 118 if(*have_it == 0)
117 else if(*have_it == 1) printk("Yes\n"); 119 printk("No\n");
120 else if(*have_it == 1)
121 printk("Yes\n");
118 os_close_file(fd); 122 os_close_file(fd);
119 return 1; 123 return 1;
120} 124}
@@ -166,12 +170,13 @@ int arch_handle_signal(int sig, union uml_pt_regs *regs)
166 /* This is testing for a cmov (0x0f 0x4x) instruction causing a 170 /* This is testing for a cmov (0x0f 0x4x) instruction causing a
167 * SIGILL in init. 171 * SIGILL in init.
168 */ 172 */
169 if((sig != SIGILL) || (TASK_PID(get_current()) != 1)) return(0); 173 if((sig != SIGILL) || (TASK_PID(get_current()) != 1))
174 return 0;
170 175
171 if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) 176 if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2))
172 panic("SIGILL in init, could not read instructions!\n"); 177 panic("SIGILL in init, could not read instructions!\n");
173 if((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) 178 if((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40))
174 return(0); 179 return 0;
175 180
176 if(host_has_cmov == 0) 181 if(host_has_cmov == 0)
177 panic("SIGILL caused by cmov, which this processor doesn't " 182 panic("SIGILL caused by cmov, which this processor doesn't "
@@ -185,16 +190,5 @@ int arch_handle_signal(int sig, union uml_pt_regs *regs)
185 "implements it, boot a filesystem compiled for older " 190 "implements it, boot a filesystem compiled for older "
186 "processors"); 191 "processors");
187 else panic("Bad value for host_has_cmov (%d)", host_has_cmov); 192 else panic("Bad value for host_has_cmov (%d)", host_has_cmov);
188 return(0); 193 return 0;
189} 194}
190
191/*
192 * Overrides for Emacs so that we follow Linus's tabbing style.
193 * Emacs will notice this stuff at the end of the file and automatically
194 * adjust the settings for this buffer only. This must remain at the end
195 * of the file.
196 * ---------------------------------------------------------------------------
197 * Local variables:
198 * c-file-style: "linux"
199 * End:
200 */
diff --git a/arch/um/sys-x86_64/bugs.c b/arch/um/sys-x86_64/bugs.c
index 73ca62312fda..9fa5392e3122 100644
--- a/arch/um/sys-x86_64/bugs.c
+++ b/arch/um/sys-x86_64/bugs.c
@@ -21,7 +21,7 @@ void arch_check_bugs(void)
21 21
22int arch_handle_signal(int sig, union uml_pt_regs *regs) 22int arch_handle_signal(int sig, union uml_pt_regs *regs)
23{ 23{
24 return(0); 24 return 0;
25} 25}
26 26
27#define MAXTOKEN 64 27#define MAXTOKEN 64
@@ -41,21 +41,21 @@ static char token(int fd, char *buf, int len, char stop)
41 n = os_read_file(fd, ptr, sizeof(*ptr)); 41 n = os_read_file(fd, ptr, sizeof(*ptr));
42 c = *ptr++; 42 c = *ptr++;
43 if(n != sizeof(*ptr)){ 43 if(n != sizeof(*ptr)){
44 if(n == 0) return(0); 44 if(n == 0)
45 return 0;
45 printk("Reading /proc/cpuinfo failed, err = %d\n", -n); 46 printk("Reading /proc/cpuinfo failed, err = %d\n", -n);
46 if(n < 0) 47 if(n < 0)
47 return(n); 48 return n;
48 else 49 else return -EIO;
49 return(-EIO);
50 } 50 }
51 } while((c != '\n') && (c != stop) && (ptr < end)); 51 } while((c != '\n') && (c != stop) && (ptr < end));
52 52
53 if(ptr == end){ 53 if(ptr == end){
54 printk("Failed to find '%c' in /proc/cpuinfo\n", stop); 54 printk("Failed to find '%c' in /proc/cpuinfo\n", stop);
55 return(-1); 55 return -1;
56 } 56 }
57 *(ptr - 1) = '\0'; 57 *(ptr - 1) = '\0';
58 return(c); 58 return c;
59} 59}
60 60
61static int find_cpuinfo_line(int fd, char *key, char *scratch, int len) 61static int find_cpuinfo_line(int fd, char *key, char *scratch, int len)
@@ -67,33 +67,23 @@ static int find_cpuinfo_line(int fd, char *key, char *scratch, int len)
67 while(1){ 67 while(1){
68 c = token(fd, scratch, len - 1, ':'); 68 c = token(fd, scratch, len - 1, ':');
69 if(c <= 0) 69 if(c <= 0)
70 return(0); 70 return 0;
71 else if(c != ':'){ 71 else if(c != ':'){
72 printk("Failed to find ':' in /proc/cpuinfo\n"); 72 printk("Failed to find ':' in /proc/cpuinfo\n");
73 return(0); 73 return 0;
74 } 74 }
75 75
76 if(!strncmp(scratch, key, strlen(key))) 76 if(!strncmp(scratch, key, strlen(key)))
77 return(1); 77 return 1;
78 78
79 do { 79 do {
80 n = os_read_file(fd, &c, sizeof(c)); 80 n = os_read_file(fd, &c, sizeof(c));
81 if(n != sizeof(c)){ 81 if(n != sizeof(c)){
82 printk("Failed to find newline in " 82 printk("Failed to find newline in "
83 "/proc/cpuinfo, err = %d\n", -n); 83 "/proc/cpuinfo, err = %d\n", -n);
84 return(0); 84 return 0;
85 } 85 }
86 } while(c != '\n'); 86 } while(c != '\n');
87 } 87 }
88 return(0); 88 return 0;
89} 89}
90
91/* Overrides for Emacs so that we follow Linus's tabbing style.
92 * Emacs will notice this stuff at the end of the file and automatically
93 * adjust the settings for this buffer only. This must remain at the end
94 * of the file.
95 * ---------------------------------------------------------------------------
96 * Local variables:
97 * c-file-style: "linux"
98 * End:
99 */