diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 15:34:47 -0500 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 15:34:47 -0500 |
commit | 0a0fc0ddbe732779366ab6b1b879f62195e65967 (patch) | |
tree | 7b42490a676cf39ae0691b6859ecf7fd410f229b /fs/proc | |
parent | 4d5dbd0945d9e0833dd7964a3d6ee33157f7cc7a (diff) | |
parent | 3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff) |
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/array.c | 8 | ||||
-rw-r--r-- | fs/proc/base.c | 1 | ||||
-rw-r--r-- | fs/proc/generic.c | 49 | ||||
-rw-r--r-- | fs/proc/inode.c | 2 | ||||
-rw-r--r-- | fs/proc/internal.h | 4 | ||||
-rw-r--r-- | fs/proc/kcore.c | 1 | ||||
-rw-r--r-- | fs/proc/proc_devtree.c | 24 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 164 | ||||
-rw-r--r-- | fs/proc/root.c | 3 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 130 | ||||
-rw-r--r-- | fs/proc/vmcore.c | 6 |
11 files changed, 226 insertions, 166 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 3e1239e4b3..7eb1bd7f80 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -308,7 +308,7 @@ int proc_pid_status(struct task_struct *task, char * buffer) | |||
308 | buffer = task_sig(task, buffer); | 308 | buffer = task_sig(task, buffer); |
309 | buffer = task_cap(task, buffer); | 309 | buffer = task_cap(task, buffer); |
310 | buffer = cpuset_task_status_allowed(task, buffer); | 310 | buffer = cpuset_task_status_allowed(task, buffer); |
311 | #if defined(CONFIG_ARCH_S390) | 311 | #if defined(CONFIG_S390) |
312 | buffer = task_show_regs(task, buffer); | 312 | buffer = task_show_regs(task, buffer); |
313 | #endif | 313 | #endif |
314 | return buffer - orig; | 314 | return buffer - orig; |
@@ -330,7 +330,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
330 | unsigned long min_flt = 0, maj_flt = 0; | 330 | unsigned long min_flt = 0, maj_flt = 0; |
331 | cputime_t cutime, cstime, utime, stime; | 331 | cputime_t cutime, cstime, utime, stime; |
332 | unsigned long rsslim = 0; | 332 | unsigned long rsslim = 0; |
333 | unsigned long it_real_value = 0; | 333 | DEFINE_KTIME(it_real_value); |
334 | struct task_struct *t; | 334 | struct task_struct *t; |
335 | char tcomm[sizeof(task->comm)]; | 335 | char tcomm[sizeof(task->comm)]; |
336 | 336 | ||
@@ -386,7 +386,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
386 | utime = cputime_add(utime, task->signal->utime); | 386 | utime = cputime_add(utime, task->signal->utime); |
387 | stime = cputime_add(stime, task->signal->stime); | 387 | stime = cputime_add(stime, task->signal->stime); |
388 | } | 388 | } |
389 | it_real_value = task->signal->it_real_value; | 389 | it_real_value = task->signal->real_timer.expires; |
390 | } | 390 | } |
391 | ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0; | 391 | ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0; |
392 | read_unlock(&tasklist_lock); | 392 | read_unlock(&tasklist_lock); |
@@ -435,7 +435,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
435 | priority, | 435 | priority, |
436 | nice, | 436 | nice, |
437 | num_threads, | 437 | num_threads, |
438 | jiffies_to_clock_t(it_real_value), | 438 | (long) ktime_to_clock_t(it_real_value), |
439 | start_time, | 439 | start_time, |
440 | vsize, | 440 | vsize, |
441 | mm ? get_mm_rss(mm) : 0, | 441 | mm ? get_mm_rss(mm) : 0, |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 634355e169..20feb7568d 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/proc_fs.h> | 55 | #include <linux/proc_fs.h> |
56 | #include <linux/stat.h> | 56 | #include <linux/stat.h> |
57 | #include <linux/init.h> | 57 | #include <linux/init.h> |
58 | #include <linux/capability.h> | ||
58 | #include <linux/file.h> | 59 | #include <linux/file.h> |
59 | #include <linux/string.h> | 60 | #include <linux/string.h> |
60 | #include <linux/seq_file.h> | 61 | #include <linux/seq_file.h> |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index b638fb5007..20e5c4509a 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/bitops.h> | 21 | #include <linux/bitops.h> |
22 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
23 | 23 | ||
24 | #include "internal.h" | ||
25 | |||
24 | static ssize_t proc_file_read(struct file *file, char __user *buf, | 26 | static ssize_t proc_file_read(struct file *file, char __user *buf, |
25 | size_t nbytes, loff_t *ppos); | 27 | size_t nbytes, loff_t *ppos); |
26 | static ssize_t proc_file_write(struct file *file, const char __user *buffer, | 28 | static ssize_t proc_file_write(struct file *file, const char __user *buffer, |
@@ -54,6 +56,18 @@ proc_file_read(struct file *file, char __user *buf, size_t nbytes, | |||
54 | ssize_t n, count; | 56 | ssize_t n, count; |
55 | char *start; | 57 | char *start; |
56 | struct proc_dir_entry * dp; | 58 | struct proc_dir_entry * dp; |
59 | unsigned long long pos; | ||
60 | |||
61 | /* | ||
62 | * Gaah, please just use "seq_file" instead. The legacy /proc | ||
63 | * interfaces cut loff_t down to off_t for reads, and ignore | ||
64 | * the offset entirely for writes.. | ||
65 | */ | ||
66 | pos = *ppos; | ||
67 | if (pos > MAX_NON_LFS) | ||
68 | return 0; | ||
69 | if (nbytes > MAX_NON_LFS - pos) | ||
70 | nbytes = MAX_NON_LFS - pos; | ||
57 | 71 | ||
58 | dp = PDE(inode); | 72 | dp = PDE(inode); |
59 | if (!(page = (char*) __get_free_page(GFP_KERNEL))) | 73 | if (!(page = (char*) __get_free_page(GFP_KERNEL))) |
@@ -202,30 +216,17 @@ proc_file_write(struct file *file, const char __user *buffer, | |||
202 | static loff_t | 216 | static loff_t |
203 | proc_file_lseek(struct file *file, loff_t offset, int orig) | 217 | proc_file_lseek(struct file *file, loff_t offset, int orig) |
204 | { | 218 | { |
205 | lock_kernel(); | 219 | loff_t retval = -EINVAL; |
206 | 220 | switch (orig) { | |
207 | switch (orig) { | 221 | case 1: |
208 | case 0: | 222 | offset += file->f_pos; |
209 | if (offset < 0) | 223 | /* fallthrough */ |
210 | goto out; | 224 | case 0: |
211 | file->f_pos = offset; | 225 | if (offset < 0 || offset > MAX_NON_LFS) |
212 | unlock_kernel(); | 226 | break; |
213 | return(file->f_pos); | 227 | file->f_pos = retval = offset; |
214 | case 1: | 228 | } |
215 | if (offset + file->f_pos < 0) | 229 | return retval; |
216 | goto out; | ||
217 | file->f_pos += offset; | ||
218 | unlock_kernel(); | ||
219 | return(file->f_pos); | ||
220 | case 2: | ||
221 | goto out; | ||
222 | default: | ||
223 | goto out; | ||
224 | } | ||
225 | |||
226 | out: | ||
227 | unlock_kernel(); | ||
228 | return -EINVAL; | ||
229 | } | 230 | } |
230 | 231 | ||
231 | static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) | 232 | static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index e6a818a93f..6573f31f1f 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <asm/system.h> | 19 | #include <asm/system.h> |
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | 21 | ||
22 | extern void free_proc_entry(struct proc_dir_entry *); | 22 | #include "internal.h" |
23 | 23 | ||
24 | static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de) | 24 | static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de) |
25 | { | 25 | { |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 3e55198f98..95a1cf32b8 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -37,6 +37,10 @@ extern int proc_tgid_stat(struct task_struct *, char *); | |||
37 | extern int proc_pid_status(struct task_struct *, char *); | 37 | extern int proc_pid_status(struct task_struct *, char *); |
38 | extern int proc_pid_statm(struct task_struct *, char *); | 38 | extern int proc_pid_statm(struct task_struct *, char *); |
39 | 39 | ||
40 | void free_proc_entry(struct proc_dir_entry *de); | ||
41 | |||
42 | int proc_init_inodecache(void); | ||
43 | |||
40 | static inline struct task_struct *proc_task(struct inode *inode) | 44 | static inline struct task_struct *proc_task(struct inode *inode) |
41 | { | 45 | { |
42 | return PROC_I(inode)->task; | 46 | return PROC_I(inode)->task; |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 1c7da988fc..adc2cd9516 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/proc_fs.h> | 14 | #include <linux/proc_fs.h> |
15 | #include <linux/user.h> | 15 | #include <linux/user.h> |
16 | #include <linux/a.out.h> | 16 | #include <linux/a.out.h> |
17 | #include <linux/capability.h> | ||
17 | #include <linux/elf.h> | 18 | #include <linux/elf.h> |
18 | #include <linux/elfcore.h> | 19 | #include <linux/elfcore.h> |
19 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index fb117b7480..9bdd077d6f 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c | |||
@@ -81,6 +81,30 @@ void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop | |||
81 | __proc_device_tree_add_prop(pde, prop); | 81 | __proc_device_tree_add_prop(pde, prop); |
82 | } | 82 | } |
83 | 83 | ||
84 | void proc_device_tree_remove_prop(struct proc_dir_entry *pde, | ||
85 | struct property *prop) | ||
86 | { | ||
87 | remove_proc_entry(prop->name, pde); | ||
88 | } | ||
89 | |||
90 | void proc_device_tree_update_prop(struct proc_dir_entry *pde, | ||
91 | struct property *newprop, | ||
92 | struct property *oldprop) | ||
93 | { | ||
94 | struct proc_dir_entry *ent; | ||
95 | |||
96 | for (ent = pde->subdir; ent != NULL; ent = ent->next) | ||
97 | if (ent->data == oldprop) | ||
98 | break; | ||
99 | if (ent == NULL) { | ||
100 | printk(KERN_WARNING "device-tree: property \"%s\" " | ||
101 | " does not exist\n", oldprop->name); | ||
102 | } else { | ||
103 | ent->data = newprop; | ||
104 | ent->size = newprop->length; | ||
105 | } | ||
106 | } | ||
107 | |||
84 | /* | 108 | /* |
85 | * Process a node, adding entries for its children and its properties. | 109 | * Process a node, adding entries for its children and its properties. |
86 | */ | 110 | */ |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 5b6b0b6038..8f8014285a 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/time.h> | 20 | #include <linux/time.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/kernel_stat.h> | 22 | #include <linux/kernel_stat.h> |
23 | #include <linux/fs.h> | ||
23 | #include <linux/tty.h> | 24 | #include <linux/tty.h> |
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | #include <linux/mman.h> | 26 | #include <linux/mman.h> |
@@ -62,7 +63,6 @@ | |||
62 | */ | 63 | */ |
63 | extern int get_hardware_list(char *); | 64 | extern int get_hardware_list(char *); |
64 | extern int get_stram_list(char *); | 65 | extern int get_stram_list(char *); |
65 | extern int get_chrdev_list(char *); | ||
66 | extern int get_filesystem_list(char *); | 66 | extern int get_filesystem_list(char *); |
67 | extern int get_exec_domain_list(char *); | 67 | extern int get_exec_domain_list(char *); |
68 | extern int get_dma_list(char *); | 68 | extern int get_dma_list(char *); |
@@ -248,6 +248,154 @@ static int cpuinfo_open(struct inode *inode, struct file *file) | |||
248 | { | 248 | { |
249 | return seq_open(file, &cpuinfo_op); | 249 | return seq_open(file, &cpuinfo_op); |
250 | } | 250 | } |
251 | |||
252 | enum devinfo_states { | ||
253 | CHR_HDR, | ||
254 | CHR_LIST, | ||
255 | BLK_HDR, | ||
256 | BLK_LIST, | ||
257 | DEVINFO_DONE | ||
258 | }; | ||
259 | |||
260 | struct devinfo_state { | ||
261 | void *chrdev; | ||
262 | void *blkdev; | ||
263 | unsigned int num_records; | ||
264 | unsigned int cur_record; | ||
265 | enum devinfo_states state; | ||
266 | }; | ||
267 | |||
268 | static void *devinfo_start(struct seq_file *f, loff_t *pos) | ||
269 | { | ||
270 | struct devinfo_state *info = f->private; | ||
271 | |||
272 | if (*pos) { | ||
273 | if ((info) && (*pos <= info->num_records)) | ||
274 | return info; | ||
275 | return NULL; | ||
276 | } | ||
277 | info = kmalloc(sizeof(*info), GFP_KERNEL); | ||
278 | f->private = info; | ||
279 | info->chrdev = acquire_chrdev_list(); | ||
280 | info->blkdev = acquire_blkdev_list(); | ||
281 | info->state = CHR_HDR; | ||
282 | info->num_records = count_chrdev_list(); | ||
283 | info->num_records += count_blkdev_list(); | ||
284 | info->num_records += 2; /* Character and Block headers */ | ||
285 | *pos = 1; | ||
286 | info->cur_record = *pos; | ||
287 | return info; | ||
288 | } | ||
289 | |||
290 | static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos) | ||
291 | { | ||
292 | int idummy; | ||
293 | char *ndummy; | ||
294 | struct devinfo_state *info = f->private; | ||
295 | |||
296 | switch (info->state) { | ||
297 | case CHR_HDR: | ||
298 | info->state = CHR_LIST; | ||
299 | (*pos)++; | ||
300 | /*fallthrough*/ | ||
301 | case CHR_LIST: | ||
302 | if (get_chrdev_info(info->chrdev,&idummy,&ndummy)) { | ||
303 | /* | ||
304 | * The character dev list is complete | ||
305 | */ | ||
306 | info->state = BLK_HDR; | ||
307 | } else { | ||
308 | info->chrdev = get_next_chrdev(info->chrdev); | ||
309 | } | ||
310 | (*pos)++; | ||
311 | break; | ||
312 | case BLK_HDR: | ||
313 | info->state = BLK_LIST; | ||
314 | (*pos)++; | ||
315 | break; | ||
316 | case BLK_LIST: | ||
317 | if (get_blkdev_info(info->blkdev,&idummy,&ndummy)) { | ||
318 | /* | ||
319 | * The block dev list is complete | ||
320 | */ | ||
321 | info->state = DEVINFO_DONE; | ||
322 | } else { | ||
323 | info->blkdev = get_next_blkdev(info->blkdev); | ||
324 | } | ||
325 | (*pos)++; | ||
326 | break; | ||
327 | case DEVINFO_DONE: | ||
328 | (*pos)++; | ||
329 | info->cur_record = *pos; | ||
330 | info = NULL; | ||
331 | break; | ||
332 | default: | ||
333 | break; | ||
334 | } | ||
335 | if (info) | ||
336 | info->cur_record = *pos; | ||
337 | return info; | ||
338 | } | ||
339 | |||
340 | static void devinfo_stop(struct seq_file *f, void *v) | ||
341 | { | ||
342 | struct devinfo_state *info = f->private; | ||
343 | |||
344 | if (info) { | ||
345 | release_chrdev_list(info->chrdev); | ||
346 | release_blkdev_list(info->blkdev); | ||
347 | f->private = NULL; | ||
348 | kfree(info); | ||
349 | } | ||
350 | } | ||
351 | |||
352 | static int devinfo_show(struct seq_file *f, void *arg) | ||
353 | { | ||
354 | int major; | ||
355 | char *name; | ||
356 | struct devinfo_state *info = f->private; | ||
357 | |||
358 | switch(info->state) { | ||
359 | case CHR_HDR: | ||
360 | seq_printf(f,"Character devices:\n"); | ||
361 | /* fallthrough */ | ||
362 | case CHR_LIST: | ||
363 | if (!get_chrdev_info(info->chrdev,&major,&name)) | ||
364 | seq_printf(f,"%3d %s\n",major,name); | ||
365 | break; | ||
366 | case BLK_HDR: | ||
367 | seq_printf(f,"\nBlock devices:\n"); | ||
368 | /* fallthrough */ | ||
369 | case BLK_LIST: | ||
370 | if (!get_blkdev_info(info->blkdev,&major,&name)) | ||
371 | seq_printf(f,"%3d %s\n",major,name); | ||
372 | break; | ||
373 | default: | ||
374 | break; | ||
375 | } | ||
376 | |||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | static struct seq_operations devinfo_op = { | ||
381 | .start = devinfo_start, | ||
382 | .next = devinfo_next, | ||
383 | .stop = devinfo_stop, | ||
384 | .show = devinfo_show, | ||
385 | }; | ||
386 | |||
387 | static int devinfo_open(struct inode *inode, struct file *file) | ||
388 | { | ||
389 | return seq_open(file, &devinfo_op); | ||
390 | } | ||
391 | |||
392 | static struct file_operations proc_devinfo_operations = { | ||
393 | .open = devinfo_open, | ||
394 | .read = seq_read, | ||
395 | .llseek = seq_lseek, | ||
396 | .release = seq_release, | ||
397 | }; | ||
398 | |||
251 | static struct file_operations proc_cpuinfo_operations = { | 399 | static struct file_operations proc_cpuinfo_operations = { |
252 | .open = cpuinfo_open, | 400 | .open = cpuinfo_open, |
253 | .read = seq_read, | 401 | .read = seq_read, |
@@ -323,6 +471,7 @@ static struct file_operations proc_modules_operations = { | |||
323 | }; | 471 | }; |
324 | #endif | 472 | #endif |
325 | 473 | ||
474 | #ifdef CONFIG_SLAB | ||
326 | extern struct seq_operations slabinfo_op; | 475 | extern struct seq_operations slabinfo_op; |
327 | extern ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); | 476 | extern ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); |
328 | static int slabinfo_open(struct inode *inode, struct file *file) | 477 | static int slabinfo_open(struct inode *inode, struct file *file) |
@@ -336,6 +485,7 @@ static struct file_operations proc_slabinfo_operations = { | |||
336 | .llseek = seq_lseek, | 485 | .llseek = seq_lseek, |
337 | .release = seq_release, | 486 | .release = seq_release, |
338 | }; | 487 | }; |
488 | #endif | ||
339 | 489 | ||
340 | static int show_stat(struct seq_file *p, void *v) | 490 | static int show_stat(struct seq_file *p, void *v) |
341 | { | 491 | { |
@@ -448,14 +598,6 @@ static struct file_operations proc_stat_operations = { | |||
448 | .release = single_release, | 598 | .release = single_release, |
449 | }; | 599 | }; |
450 | 600 | ||
451 | static int devices_read_proc(char *page, char **start, off_t off, | ||
452 | int count, int *eof, void *data) | ||
453 | { | ||
454 | int len = get_chrdev_list(page); | ||
455 | len += get_blkdev_list(page+len, len); | ||
456 | return proc_calc_metrics(page, start, off, count, eof, len); | ||
457 | } | ||
458 | |||
459 | /* | 601 | /* |
460 | * /proc/interrupts | 602 | * /proc/interrupts |
461 | */ | 603 | */ |
@@ -580,7 +722,6 @@ void __init proc_misc_init(void) | |||
580 | #ifdef CONFIG_STRAM_PROC | 722 | #ifdef CONFIG_STRAM_PROC |
581 | {"stram", stram_read_proc}, | 723 | {"stram", stram_read_proc}, |
582 | #endif | 724 | #endif |
583 | {"devices", devices_read_proc}, | ||
584 | {"filesystems", filesystems_read_proc}, | 725 | {"filesystems", filesystems_read_proc}, |
585 | {"cmdline", cmdline_read_proc}, | 726 | {"cmdline", cmdline_read_proc}, |
586 | {"locks", locks_read_proc}, | 727 | {"locks", locks_read_proc}, |
@@ -596,11 +737,14 @@ void __init proc_misc_init(void) | |||
596 | entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); | 737 | entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); |
597 | if (entry) | 738 | if (entry) |
598 | entry->proc_fops = &proc_kmsg_operations; | 739 | entry->proc_fops = &proc_kmsg_operations; |
740 | create_seq_entry("devices", 0, &proc_devinfo_operations); | ||
599 | create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); | 741 | create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); |
600 | create_seq_entry("partitions", 0, &proc_partitions_operations); | 742 | create_seq_entry("partitions", 0, &proc_partitions_operations); |
601 | create_seq_entry("stat", 0, &proc_stat_operations); | 743 | create_seq_entry("stat", 0, &proc_stat_operations); |
602 | create_seq_entry("interrupts", 0, &proc_interrupts_operations); | 744 | create_seq_entry("interrupts", 0, &proc_interrupts_operations); |
745 | #ifdef CONFIG_SLAB | ||
603 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); | 746 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); |
747 | #endif | ||
604 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); | 748 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); |
605 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); | 749 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); |
606 | create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations); | 750 | create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations); |
diff --git a/fs/proc/root.c b/fs/proc/root.c index aef148f099..68896283c8 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | 20 | ||
21 | #include "internal.h" | ||
22 | |||
21 | struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver; | 23 | struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver; |
22 | 24 | ||
23 | #ifdef CONFIG_SYSCTL | 25 | #ifdef CONFIG_SYSCTL |
@@ -36,7 +38,6 @@ static struct file_system_type proc_fs_type = { | |||
36 | .kill_sb = kill_anon_super, | 38 | .kill_sb = kill_anon_super, |
37 | }; | 39 | }; |
38 | 40 | ||
39 | extern int __init proc_init_inodecache(void); | ||
40 | void __init proc_root_init(void) | 41 | void __init proc_root_init(void) |
41 | { | 42 | { |
42 | int err = proc_init_inodecache(); | 43 | int err = proc_init_inodecache(); |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index d2fa42006d..0eaad41f46 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -195,7 +195,7 @@ static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats | |||
195 | 195 | ||
196 | static int show_map(struct seq_file *m, void *v) | 196 | static int show_map(struct seq_file *m, void *v) |
197 | { | 197 | { |
198 | return show_map_internal(m, v, 0); | 198 | return show_map_internal(m, v, NULL); |
199 | } | 199 | } |
200 | 200 | ||
201 | static void smaps_pte_range(struct vm_area_struct *vma, pmd_t *pmd, | 201 | static void smaps_pte_range(struct vm_area_struct *vma, pmd_t *pmd, |
@@ -390,130 +390,12 @@ struct seq_operations proc_pid_smaps_op = { | |||
390 | }; | 390 | }; |
391 | 391 | ||
392 | #ifdef CONFIG_NUMA | 392 | #ifdef CONFIG_NUMA |
393 | 393 | extern int show_numa_map(struct seq_file *m, void *v); | |
394 | struct numa_maps { | ||
395 | unsigned long pages; | ||
396 | unsigned long anon; | ||
397 | unsigned long mapped; | ||
398 | unsigned long mapcount_max; | ||
399 | unsigned long node[MAX_NUMNODES]; | ||
400 | }; | ||
401 | |||
402 | /* | ||
403 | * Calculate numa node maps for a vma | ||
404 | */ | ||
405 | static struct numa_maps *get_numa_maps(const struct vm_area_struct *vma) | ||
406 | { | ||
407 | struct page *page; | ||
408 | unsigned long vaddr; | ||
409 | struct mm_struct *mm = vma->vm_mm; | ||
410 | int i; | ||
411 | struct numa_maps *md = kmalloc(sizeof(struct numa_maps), GFP_KERNEL); | ||
412 | |||
413 | if (!md) | ||
414 | return NULL; | ||
415 | md->pages = 0; | ||
416 | md->anon = 0; | ||
417 | md->mapped = 0; | ||
418 | md->mapcount_max = 0; | ||
419 | for_each_node(i) | ||
420 | md->node[i] =0; | ||
421 | |||
422 | for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) { | ||
423 | page = follow_page(mm, vaddr, 0); | ||
424 | if (page) { | ||
425 | int count = page_mapcount(page); | ||
426 | |||
427 | if (count) | ||
428 | md->mapped++; | ||
429 | if (count > md->mapcount_max) | ||
430 | md->mapcount_max = count; | ||
431 | md->pages++; | ||
432 | if (PageAnon(page)) | ||
433 | md->anon++; | ||
434 | md->node[page_to_nid(page)]++; | ||
435 | } | ||
436 | cond_resched(); | ||
437 | } | ||
438 | return md; | ||
439 | } | ||
440 | |||
441 | static int show_numa_map(struct seq_file *m, void *v) | ||
442 | { | ||
443 | struct task_struct *task = m->private; | ||
444 | struct vm_area_struct *vma = v; | ||
445 | struct mempolicy *pol; | ||
446 | struct numa_maps *md; | ||
447 | struct zone **z; | ||
448 | int n; | ||
449 | int first; | ||
450 | |||
451 | if (!vma->vm_mm) | ||
452 | return 0; | ||
453 | |||
454 | md = get_numa_maps(vma); | ||
455 | if (!md) | ||
456 | return 0; | ||
457 | |||
458 | seq_printf(m, "%08lx", vma->vm_start); | ||
459 | pol = get_vma_policy(task, vma, vma->vm_start); | ||
460 | /* Print policy */ | ||
461 | switch (pol->policy) { | ||
462 | case MPOL_PREFERRED: | ||
463 | seq_printf(m, " prefer=%d", pol->v.preferred_node); | ||
464 | break; | ||
465 | case MPOL_BIND: | ||
466 | seq_printf(m, " bind={"); | ||
467 | first = 1; | ||
468 | for (z = pol->v.zonelist->zones; *z; z++) { | ||
469 | |||
470 | if (!first) | ||
471 | seq_putc(m, ','); | ||
472 | else | ||
473 | first = 0; | ||
474 | seq_printf(m, "%d/%s", (*z)->zone_pgdat->node_id, | ||
475 | (*z)->name); | ||
476 | } | ||
477 | seq_putc(m, '}'); | ||
478 | break; | ||
479 | case MPOL_INTERLEAVE: | ||
480 | seq_printf(m, " interleave={"); | ||
481 | first = 1; | ||
482 | for_each_node(n) { | ||
483 | if (node_isset(n, pol->v.nodes)) { | ||
484 | if (!first) | ||
485 | seq_putc(m,','); | ||
486 | else | ||
487 | first = 0; | ||
488 | seq_printf(m, "%d",n); | ||
489 | } | ||
490 | } | ||
491 | seq_putc(m, '}'); | ||
492 | break; | ||
493 | default: | ||
494 | seq_printf(m," default"); | ||
495 | break; | ||
496 | } | ||
497 | seq_printf(m, " MaxRef=%lu Pages=%lu Mapped=%lu", | ||
498 | md->mapcount_max, md->pages, md->mapped); | ||
499 | if (md->anon) | ||
500 | seq_printf(m," Anon=%lu",md->anon); | ||
501 | |||
502 | for_each_online_node(n) { | ||
503 | if (md->node[n]) | ||
504 | seq_printf(m, " N%d=%lu", n, md->node[n]); | ||
505 | } | ||
506 | seq_putc(m, '\n'); | ||
507 | kfree(md); | ||
508 | if (m->count < m->size) /* vma is copied successfully */ | ||
509 | m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0; | ||
510 | return 0; | ||
511 | } | ||
512 | 394 | ||
513 | struct seq_operations proc_pid_numa_maps_op = { | 395 | struct seq_operations proc_pid_numa_maps_op = { |
514 | .start = m_start, | 396 | .start = m_start, |
515 | .next = m_next, | 397 | .next = m_next, |
516 | .stop = m_stop, | 398 | .stop = m_stop, |
517 | .show = show_numa_map | 399 | .show = show_numa_map |
518 | }; | 400 | }; |
519 | #endif | 401 | #endif |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 3b2e7b69e6..4063fb32f7 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/a.out.h> | 14 | #include <linux/a.out.h> |
15 | #include <linux/elf.h> | 15 | #include <linux/elf.h> |
16 | #include <linux/elfcore.h> | 16 | #include <linux/elfcore.h> |
17 | #include <linux/proc_fs.h> | ||
18 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
19 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |
20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
@@ -35,11 +34,14 @@ static size_t elfcorebuf_sz; | |||
35 | /* Total size of vmcore file. */ | 34 | /* Total size of vmcore file. */ |
36 | static u64 vmcore_size; | 35 | static u64 vmcore_size; |
37 | 36 | ||
37 | /* Stores the physical address of elf header of crash image. */ | ||
38 | unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | ||
39 | |||
38 | struct proc_dir_entry *proc_vmcore = NULL; | 40 | struct proc_dir_entry *proc_vmcore = NULL; |
39 | 41 | ||
40 | /* Reads a page from the oldmem device from given offset. */ | 42 | /* Reads a page from the oldmem device from given offset. */ |
41 | static ssize_t read_from_oldmem(char *buf, size_t count, | 43 | static ssize_t read_from_oldmem(char *buf, size_t count, |
42 | loff_t *ppos, int userbuf) | 44 | u64 *ppos, int userbuf) |
43 | { | 45 | { |
44 | unsigned long pfn, offset; | 46 | unsigned long pfn, offset; |
45 | size_t nr_bytes; | 47 | size_t nr_bytes; |