diff options
author | Jeff Dike <jdike@addtoit.com> | 2008-02-05 01:30:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:28 -0500 |
commit | 009ec2a915ba52f6b647c4076f4a2e259cba85aa (patch) | |
tree | fd2d805f13d8ea6345e03981079c9a9e1424a18c /arch/um/kernel/mem.c | |
parent | 8192ab42bf60e1e9b7efa046990e9cc5e4a95cf4 (diff) |
uml: style cleanup
Style fixes in elf-i386.h and arch/um/kernel/mem.c.
update the copyright
get rid of an emacs formatting comment
some formatting fixes
inclusion trimming
whitespace fixes
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>
Diffstat (limited to 'arch/um/kernel/mem.c')
-rw-r--r-- | arch/um/kernel/mem.c | 86 |
1 files changed, 41 insertions, 45 deletions
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index 1f8f0c195173..3eddc2091d4d 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c | |||
@@ -1,28 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/stddef.h" | 6 | #include <linux/stddef.h> |
7 | #include "linux/kernel.h" | 7 | #include <linux/bootmem.h> |
8 | #include "linux/mm.h" | 8 | #include <linux/gfp.h> |
9 | #include "linux/bootmem.h" | 9 | #include <linux/highmem.h> |
10 | #include "linux/swap.h" | 10 | #include <linux/mm.h> |
11 | #include "linux/highmem.h" | 11 | #include <linux/swap.h> |
12 | #include "linux/gfp.h" | 12 | #include <asm/fixmap.h> |
13 | #include "asm/page.h" | 13 | #include <asm/page.h> |
14 | #include "asm/fixmap.h" | ||
15 | #include "asm/pgalloc.h" | ||
16 | #include "kern_util.h" | ||
17 | #include "as-layout.h" | 14 | #include "as-layout.h" |
15 | #include "init.h" | ||
18 | #include "kern.h" | 16 | #include "kern.h" |
17 | #include "kern_util.h" | ||
19 | #include "mem_user.h" | 18 | #include "mem_user.h" |
20 | #include "um_uaccess.h" | ||
21 | #include "os.h" | 19 | #include "os.h" |
22 | #include "linux/types.h" | ||
23 | #include "linux/string.h" | ||
24 | #include "init.h" | ||
25 | #include "kern_constants.h" | ||
26 | 20 | ||
27 | /* allocated in paging_init, zeroed in mem_init, and unchanged thereafter */ | 21 | /* allocated in paging_init, zeroed in mem_init, and unchanged thereafter */ |
28 | unsigned long *empty_zero_page = NULL; | 22 | unsigned long *empty_zero_page = NULL; |
@@ -53,7 +47,7 @@ static void setup_highmem(unsigned long highmem_start, | |||
53 | int i; | 47 | int i; |
54 | 48 | ||
55 | highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT; | 49 | highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT; |
56 | for(i = 0; i < highmem_len >> PAGE_SHIFT; i++){ | 50 | for (i = 0; i < highmem_len >> PAGE_SHIFT; i++) { |
57 | page = &mem_map[highmem_pfn + i]; | 51 | page = &mem_map[highmem_pfn + i]; |
58 | ClearPageReserved(page); | 52 | ClearPageReserved(page); |
59 | init_page_count(page); | 53 | init_page_count(page); |
@@ -85,7 +79,7 @@ void __init mem_init(void) | |||
85 | #endif | 79 | #endif |
86 | num_physpages = totalram_pages; | 80 | num_physpages = totalram_pages; |
87 | max_pfn = totalram_pages; | 81 | max_pfn = totalram_pages; |
88 | printk(KERN_INFO "Memory: %luk available\n", | 82 | printk(KERN_INFO "Memory: %luk available\n", |
89 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10)); | 83 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10)); |
90 | kmalloc_ok = 1; | 84 | kmalloc_ok = 1; |
91 | 85 | ||
@@ -119,7 +113,7 @@ static void __init one_md_table_init(pud_t *pud) | |||
119 | #endif | 113 | #endif |
120 | } | 114 | } |
121 | 115 | ||
122 | static void __init fixrange_init(unsigned long start, unsigned long end, | 116 | static void __init fixrange_init(unsigned long start, unsigned long end, |
123 | pgd_t *pgd_base) | 117 | pgd_t *pgd_base) |
124 | { | 118 | { |
125 | pgd_t *pgd; | 119 | pgd_t *pgd; |
@@ -206,7 +200,8 @@ static void __init fixaddr_user_init( void) | |||
206 | paddr = (unsigned long)alloc_bootmem_low_pages( size); | 200 | paddr = (unsigned long)alloc_bootmem_low_pages( size); |
207 | memcpy( (void *)paddr, (void *)FIXADDR_USER_START, size); | 201 | memcpy( (void *)paddr, (void *)FIXADDR_USER_START, size); |
208 | paddr = __pa(paddr); | 202 | paddr = __pa(paddr); |
209 | for ( ; size > 0; size-=PAGE_SIZE, vaddr+=PAGE_SIZE, paddr+=PAGE_SIZE){ | 203 | for ( ; size > 0; size -= PAGE_SIZE, vaddr += PAGE_SIZE, |
204 | paddr += PAGE_SIZE) { | ||
210 | pgd = swapper_pg_dir + pgd_index(vaddr); | 205 | pgd = swapper_pg_dir + pgd_index(vaddr); |
211 | pud = pud_offset(pgd, vaddr); | 206 | pud = pud_offset(pgd, vaddr); |
212 | pmd = pmd_offset(pud, vaddr); | 207 | pmd = pmd_offset(pud, vaddr); |
@@ -223,7 +218,7 @@ void __init paging_init(void) | |||
223 | 218 | ||
224 | empty_zero_page = (unsigned long *) alloc_bootmem_low_pages(PAGE_SIZE); | 219 | empty_zero_page = (unsigned long *) alloc_bootmem_low_pages(PAGE_SIZE); |
225 | empty_bad_page = (unsigned long *) alloc_bootmem_low_pages(PAGE_SIZE); | 220 | empty_bad_page = (unsigned long *) alloc_bootmem_low_pages(PAGE_SIZE); |
226 | for(i = 0; i < ARRAY_SIZE(zones_size); i++) | 221 | for (i = 0; i < ARRAY_SIZE(zones_size); i++) |
227 | zones_size[i] = 0; | 222 | zones_size[i] = 0; |
228 | 223 | ||
229 | zones_size[ZONE_NORMAL] = (end_iomem >> PAGE_SHIFT) - | 224 | zones_size[ZONE_NORMAL] = (end_iomem >> PAGE_SHIFT) - |
@@ -253,26 +248,26 @@ struct page *arch_validate(struct page *page, gfp_t mask, int order) | |||
253 | int i; | 248 | int i; |
254 | 249 | ||
255 | again: | 250 | again: |
256 | if(page == NULL) | 251 | if (page == NULL) |
257 | return page; | 252 | return page; |
258 | if(PageHighMem(page)) | 253 | if (PageHighMem(page)) |
259 | return page; | 254 | return page; |
260 | 255 | ||
261 | addr = (unsigned long) page_address(page); | 256 | addr = (unsigned long) page_address(page); |
262 | for(i = 0; i < (1 << order); i++){ | 257 | for (i = 0; i < (1 << order); i++) { |
263 | current->thread.fault_addr = (void *) addr; | 258 | current->thread.fault_addr = (void *) addr; |
264 | if(__do_copy_to_user((void __user *) addr, &zero, | 259 | if (__do_copy_to_user((void __user *) addr, &zero, |
265 | sizeof(zero), | 260 | sizeof(zero), |
266 | ¤t->thread.fault_addr, | 261 | ¤t->thread.fault_addr, |
267 | ¤t->thread.fault_catcher)){ | 262 | ¤t->thread.fault_catcher)) { |
268 | if(!(mask & __GFP_WAIT)) | 263 | if (!(mask & __GFP_WAIT)) |
269 | return NULL; | 264 | return NULL; |
270 | else break; | 265 | else break; |
271 | } | 266 | } |
272 | addr += PAGE_SIZE; | 267 | addr += PAGE_SIZE; |
273 | } | 268 | } |
274 | 269 | ||
275 | if(i == (1 << order)) | 270 | if (i == (1 << order)) |
276 | return page; | 271 | return page; |
277 | page = alloc_pages(mask, order); | 272 | page = alloc_pages(mask, order); |
278 | goto again; | 273 | goto again; |
@@ -291,8 +286,8 @@ void free_initmem(void) | |||
291 | void free_initrd_mem(unsigned long start, unsigned long end) | 286 | void free_initrd_mem(unsigned long start, unsigned long end) |
292 | { | 287 | { |
293 | if (start < end) | 288 | if (start < end) |
294 | printk ("Freeing initrd memory: %ldk freed\n", | 289 | printk(KERN_INFO "Freeing initrd memory: %ldk freed\n", |
295 | (end - start) >> 10); | 290 | (end - start) >> 10); |
296 | for (; start < end; start += PAGE_SIZE) { | 291 | for (; start < end; start += PAGE_SIZE) { |
297 | ClearPageReserved(virt_to_page(start)); | 292 | ClearPageReserved(virt_to_page(start)); |
298 | init_page_count(virt_to_page(start)); | 293 | init_page_count(virt_to_page(start)); |
@@ -309,27 +304,28 @@ void show_mem(void) | |||
309 | int highmem = 0; | 304 | int highmem = 0; |
310 | struct page *page; | 305 | struct page *page; |
311 | 306 | ||
312 | printk("Mem-info:\n"); | 307 | printk(KERN_INFO "Mem-info:\n"); |
313 | show_free_areas(); | 308 | show_free_areas(); |
314 | printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); | 309 | printk(KERN_INFO "Free swap: %6ldkB\n", |
310 | nr_swap_pages<<(PAGE_SHIFT-10)); | ||
315 | pfn = max_mapnr; | 311 | pfn = max_mapnr; |
316 | while(pfn-- > 0) { | 312 | while (pfn-- > 0) { |
317 | page = pfn_to_page(pfn); | 313 | page = pfn_to_page(pfn); |
318 | total++; | 314 | total++; |
319 | if(PageHighMem(page)) | 315 | if (PageHighMem(page)) |
320 | highmem++; | 316 | highmem++; |
321 | if(PageReserved(page)) | 317 | if (PageReserved(page)) |
322 | reserved++; | 318 | reserved++; |
323 | else if(PageSwapCache(page)) | 319 | else if (PageSwapCache(page)) |
324 | cached++; | 320 | cached++; |
325 | else if(page_count(page)) | 321 | else if (page_count(page)) |
326 | shared += page_count(page) - 1; | 322 | shared += page_count(page) - 1; |
327 | } | 323 | } |
328 | printk("%d pages of RAM\n", total); | 324 | printk(KERN_INFO "%d pages of RAM\n", total); |
329 | printk("%d pages of HIGHMEM\n", highmem); | 325 | printk(KERN_INFO "%d pages of HIGHMEM\n", highmem); |
330 | printk("%d reserved pages\n", reserved); | 326 | printk(KERN_INFO "%d reserved pages\n", reserved); |
331 | printk("%d pages shared\n", shared); | 327 | printk(KERN_INFO "%d pages shared\n", shared); |
332 | printk("%d pages swap cached\n", cached); | 328 | printk(KERN_INFO "%d pages swap cached\n", cached); |
333 | } | 329 | } |
334 | 330 | ||
335 | /* Allocate and free page tables. */ | 331 | /* Allocate and free page tables. */ |
@@ -340,8 +336,8 @@ pgd_t *pgd_alloc(struct mm_struct *mm) | |||
340 | 336 | ||
341 | if (pgd) { | 337 | if (pgd) { |
342 | memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); | 338 | memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); |
343 | memcpy(pgd + USER_PTRS_PER_PGD, | 339 | memcpy(pgd + USER_PTRS_PER_PGD, |
344 | swapper_pg_dir + USER_PTRS_PER_PGD, | 340 | swapper_pg_dir + USER_PTRS_PER_PGD, |
345 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | 341 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); |
346 | } | 342 | } |
347 | return pgd; | 343 | return pgd; |