aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/task_mmu.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-06-26 03:25:48 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 12:58:24 -0400
commit662795deb854b31501e0ffb42b7f0cce802c134a (patch)
treed4849ad5ca7383ca9d0c9b6d46db83097d5dba85 /fs/proc/task_mmu.c
parent6e66b52bf587f0dd9a8e0a581b9570e5c1969e33 (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.c54
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
377struct seq_operations proc_pid_maps_op = { 377static 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
384struct seq_operations proc_pid_smaps_op = { 384static 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
391static 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
403static int maps_open(struct inode *inode, struct file *file)
404{
405 return do_maps_open(inode, file, &proc_pid_maps_op);
406}
407
408struct 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
392extern int show_numa_map(struct seq_file *m, void *v); 416extern int show_numa_map(struct seq_file *m, void *v);
393 417
394struct seq_operations proc_pid_numa_maps_op = { 418static 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
425static 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
430struct 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
438static int smaps_open(struct inode *inode, struct file *file)
439{
440 return do_maps_open(inode, file, &proc_pid_smaps_op);
441}
442
443struct file_operations proc_smaps_operations = {
444 .open = smaps_open,
445 .read = seq_read,
446 .llseek = seq_lseek,
447 .release = seq_release,
448};