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 | |
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')
-rw-r--r-- | fs/proc/base.c | 61 | ||||
-rw-r--r-- | fs/proc/internal.h | 4 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 54 | ||||
-rw-r--r-- | fs/proc/task_nommu.c | 21 |
4 files changed, 75 insertions, 65 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 29539c2268a3..c8636841bbcf 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -539,67 +539,6 @@ out: | |||
539 | goto exit; | 539 | goto exit; |
540 | } | 540 | } |
541 | 541 | ||
542 | extern struct seq_operations proc_pid_maps_op; | ||
543 | static int maps_open(struct inode *inode, struct file *file) | ||
544 | { | ||
545 | struct task_struct *task = proc_task(inode); | ||
546 | int ret = seq_open(file, &proc_pid_maps_op); | ||
547 | if (!ret) { | ||
548 | struct seq_file *m = file->private_data; | ||
549 | m->private = task; | ||
550 | } | ||
551 | return ret; | ||
552 | } | ||
553 | |||
554 | static struct file_operations proc_maps_operations = { | ||
555 | .open = maps_open, | ||
556 | .read = seq_read, | ||
557 | .llseek = seq_lseek, | ||
558 | .release = seq_release, | ||
559 | }; | ||
560 | |||
561 | #ifdef CONFIG_NUMA | ||
562 | extern struct seq_operations proc_pid_numa_maps_op; | ||
563 | static int numa_maps_open(struct inode *inode, struct file *file) | ||
564 | { | ||
565 | struct task_struct *task = proc_task(inode); | ||
566 | int ret = seq_open(file, &proc_pid_numa_maps_op); | ||
567 | if (!ret) { | ||
568 | struct seq_file *m = file->private_data; | ||
569 | m->private = task; | ||
570 | } | ||
571 | return ret; | ||
572 | } | ||
573 | |||
574 | static struct file_operations proc_numa_maps_operations = { | ||
575 | .open = numa_maps_open, | ||
576 | .read = seq_read, | ||
577 | .llseek = seq_lseek, | ||
578 | .release = seq_release, | ||
579 | }; | ||
580 | #endif | ||
581 | |||
582 | #ifdef CONFIG_MMU | ||
583 | extern struct seq_operations proc_pid_smaps_op; | ||
584 | static int smaps_open(struct inode *inode, struct file *file) | ||
585 | { | ||
586 | struct task_struct *task = proc_task(inode); | ||
587 | int ret = seq_open(file, &proc_pid_smaps_op); | ||
588 | if (!ret) { | ||
589 | struct seq_file *m = file->private_data; | ||
590 | m->private = task; | ||
591 | } | ||
592 | return ret; | ||
593 | } | ||
594 | |||
595 | static struct file_operations proc_smaps_operations = { | ||
596 | .open = smaps_open, | ||
597 | .read = seq_read, | ||
598 | .llseek = seq_lseek, | ||
599 | .release = seq_release, | ||
600 | }; | ||
601 | #endif | ||
602 | |||
603 | extern struct seq_operations mounts_op; | 542 | extern struct seq_operations mounts_op; |
604 | struct proc_mounts { | 543 | struct proc_mounts { |
605 | struct seq_file m; | 544 | struct seq_file m; |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 6264b7a3a9f0..548e7447ea47 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 | extern struct file_operations proc_maps_operations; | ||
41 | extern struct file_operations proc_numa_maps_operations; | ||
42 | extern struct file_operations proc_smaps_operations; | ||
43 | |||
40 | void free_proc_entry(struct proc_dir_entry *de); | 44 | void free_proc_entry(struct proc_dir_entry *de); |
41 | 45 | ||
42 | int proc_init_inodecache(void); | 46 | int proc_init_inodecache(void); |
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 | }; | ||
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 8f68827ed10e..af69f28277b6 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
@@ -156,9 +156,28 @@ static void *m_next(struct seq_file *m, void *v, loff_t *pos) | |||
156 | { | 156 | { |
157 | return NULL; | 157 | return NULL; |
158 | } | 158 | } |
159 | struct seq_operations proc_pid_maps_op = { | 159 | static struct seq_operations proc_pid_maps_op = { |
160 | .start = m_start, | 160 | .start = m_start, |
161 | .next = m_next, | 161 | .next = m_next, |
162 | .stop = m_stop, | 162 | .stop = m_stop, |
163 | .show = show_map | 163 | .show = show_map |
164 | }; | 164 | }; |
165 | |||
166 | static int maps_open(struct inode *inode, struct file *file) | ||
167 | { | ||
168 | int ret; | ||
169 | ret = seq_open(file, &proc_pid_maps_op); | ||
170 | if (!ret) { | ||
171 | struct seq_file *m = file->private_data; | ||
172 | m->private = NULL; | ||
173 | } | ||
174 | return ret; | ||
175 | } | ||
176 | |||
177 | struct file_operations proc_maps_operations = { | ||
178 | .open = maps_open, | ||
179 | .read = seq_read, | ||
180 | .llseek = seq_lseek, | ||
181 | .release = seq_release, | ||
182 | }; | ||
183 | |||