diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-06-26 03:25:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 12:58:24 -0400 |
commit | 662795deb854b31501e0ffb42b7f0cce802c134a (patch) | |
tree | d4849ad5ca7383ca9d0c9b6d46db83097d5dba85 /fs/proc/task_mmu.c | |
parent | 6e66b52bf587f0dd9a8e0a581b9570e5c1969e33 (diff) |
[PATCH] proc: Move proc_maps_operations into task_mmu.c
All of the functions for proc_maps_operations are already defined in
task_mmu.c so move the operations structure to keep the functionality
together.
Since task_nommu.c implements a dummy version of /proc/<pid>/maps give it a
simplified version of proc_maps_operations that it can modify to best suit its
needs.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/proc/task_mmu.c')
-rw-r--r-- | fs/proc/task_mmu.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 91b7c15ab373..4187b4e9cdb3 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -374,27 +374,75 @@ static void *m_next(struct seq_file *m, void *v, loff_t *pos) | |||
374 | return (vma != tail_vma)? tail_vma: NULL; | 374 | return (vma != tail_vma)? tail_vma: NULL; |
375 | } | 375 | } |
376 | 376 | ||
377 | struct seq_operations proc_pid_maps_op = { | 377 | static struct seq_operations proc_pid_maps_op = { |
378 | .start = m_start, | 378 | .start = m_start, |
379 | .next = m_next, | 379 | .next = m_next, |
380 | .stop = m_stop, | 380 | .stop = m_stop, |
381 | .show = show_map | 381 | .show = show_map |
382 | }; | 382 | }; |
383 | 383 | ||
384 | struct seq_operations proc_pid_smaps_op = { | 384 | static struct seq_operations proc_pid_smaps_op = { |
385 | .start = m_start, | 385 | .start = m_start, |
386 | .next = m_next, | 386 | .next = m_next, |
387 | .stop = m_stop, | 387 | .stop = m_stop, |
388 | .show = show_smap | 388 | .show = show_smap |
389 | }; | 389 | }; |
390 | 390 | ||
391 | static int do_maps_open(struct inode *inode, struct file *file, | ||
392 | struct seq_operations *ops) | ||
393 | { | ||
394 | struct task_struct *task = proc_task(inode); | ||
395 | int ret = seq_open(file, ops); | ||
396 | if (!ret) { | ||
397 | struct seq_file *m = file->private_data; | ||
398 | m->private = task; | ||
399 | } | ||
400 | return ret; | ||
401 | } | ||
402 | |||
403 | static int maps_open(struct inode *inode, struct file *file) | ||
404 | { | ||
405 | return do_maps_open(inode, file, &proc_pid_maps_op); | ||
406 | } | ||
407 | |||
408 | struct file_operations proc_maps_operations = { | ||
409 | .open = maps_open, | ||
410 | .read = seq_read, | ||
411 | .llseek = seq_lseek, | ||
412 | .release = seq_release, | ||
413 | }; | ||
414 | |||
391 | #ifdef CONFIG_NUMA | 415 | #ifdef CONFIG_NUMA |
392 | extern int show_numa_map(struct seq_file *m, void *v); | 416 | extern int show_numa_map(struct seq_file *m, void *v); |
393 | 417 | ||
394 | struct seq_operations proc_pid_numa_maps_op = { | 418 | static struct seq_operations proc_pid_numa_maps_op = { |
395 | .start = m_start, | 419 | .start = m_start, |
396 | .next = m_next, | 420 | .next = m_next, |
397 | .stop = m_stop, | 421 | .stop = m_stop, |
398 | .show = show_numa_map | 422 | .show = show_numa_map |
399 | }; | 423 | }; |
424 | |||
425 | static int numa_maps_open(struct inode *inode, struct file *file) | ||
426 | { | ||
427 | return do_maps_open(inode, file, &proc_pid_numa_maps_op); | ||
428 | } | ||
429 | |||
430 | struct file_operations proc_numa_maps_operations = { | ||
431 | .open = numa_maps_open, | ||
432 | .read = seq_read, | ||
433 | .llseek = seq_lseek, | ||
434 | .release = seq_release, | ||
435 | }; | ||
400 | #endif | 436 | #endif |
437 | |||
438 | static int smaps_open(struct inode *inode, struct file *file) | ||
439 | { | ||
440 | return do_maps_open(inode, file, &proc_pid_smaps_op); | ||
441 | } | ||
442 | |||
443 | struct file_operations proc_smaps_operations = { | ||
444 | .open = smaps_open, | ||
445 | .read = seq_read, | ||
446 | .llseek = seq_lseek, | ||
447 | .release = seq_release, | ||
448 | }; | ||