diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-03-27 08:06:24 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-04-23 00:04:57 -0400 |
commit | a1a2c409b666befc58c2db9c7fbddf200f153470 (patch) | |
tree | 3ea8e4c8f1311436939492d70de23dcf185994de /fs/namespace.c | |
parent | 719f5d7f0b90ac2c8f8ca4232eb322b266fea01e (diff) |
[patch 5/7] vfs: mountinfo: allow using process root
Allow /proc/<pid>/mountinfo to use the root of <pid> to calculate
mountpoints.
- move definition of 'struct proc_mounts' to <linux/mnt_namespace.h>
- add the process's namespace and root to this structure
- pass a pointer to 'struct proc_mounts' into seq_operations
In addition the following cleanups are made:
- use a common open function for /proc/<pid>/{mounts,mountstat}
- surround namespace.c part of these proc files with #ifdef CONFIG_PROC_FS
- make the seq_operations structures const
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index cefa1d9939b0..dfdf51e81c1c 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -724,20 +724,21 @@ void save_mount_options(struct super_block *sb, char *options) | |||
724 | } | 724 | } |
725 | EXPORT_SYMBOL(save_mount_options); | 725 | EXPORT_SYMBOL(save_mount_options); |
726 | 726 | ||
727 | #ifdef CONFIG_PROC_FS | ||
727 | /* iterator */ | 728 | /* iterator */ |
728 | static void *m_start(struct seq_file *m, loff_t *pos) | 729 | static void *m_start(struct seq_file *m, loff_t *pos) |
729 | { | 730 | { |
730 | struct mnt_namespace *n = m->private; | 731 | struct proc_mounts *p = m->private; |
731 | 732 | ||
732 | down_read(&namespace_sem); | 733 | down_read(&namespace_sem); |
733 | return seq_list_start(&n->list, *pos); | 734 | return seq_list_start(&p->ns->list, *pos); |
734 | } | 735 | } |
735 | 736 | ||
736 | static void *m_next(struct seq_file *m, void *v, loff_t *pos) | 737 | static void *m_next(struct seq_file *m, void *v, loff_t *pos) |
737 | { | 738 | { |
738 | struct mnt_namespace *n = m->private; | 739 | struct proc_mounts *p = m->private; |
739 | 740 | ||
740 | return seq_list_next(v, &n->list, pos); | 741 | return seq_list_next(v, &p->ns->list, pos); |
741 | } | 742 | } |
742 | 743 | ||
743 | static void m_stop(struct seq_file *m, void *v) | 744 | static void m_stop(struct seq_file *m, void *v) |
@@ -794,7 +795,7 @@ static int show_vfsmnt(struct seq_file *m, void *v) | |||
794 | return err; | 795 | return err; |
795 | } | 796 | } |
796 | 797 | ||
797 | struct seq_operations mounts_op = { | 798 | const struct seq_operations mounts_op = { |
798 | .start = m_start, | 799 | .start = m_start, |
799 | .next = m_next, | 800 | .next = m_next, |
800 | .stop = m_stop, | 801 | .stop = m_stop, |
@@ -833,12 +834,13 @@ static int show_vfsstat(struct seq_file *m, void *v) | |||
833 | return err; | 834 | return err; |
834 | } | 835 | } |
835 | 836 | ||
836 | struct seq_operations mountstats_op = { | 837 | const struct seq_operations mountstats_op = { |
837 | .start = m_start, | 838 | .start = m_start, |
838 | .next = m_next, | 839 | .next = m_next, |
839 | .stop = m_stop, | 840 | .stop = m_stop, |
840 | .show = show_vfsstat, | 841 | .show = show_vfsstat, |
841 | }; | 842 | }; |
843 | #endif /* CONFIG_PROC_FS */ | ||
842 | 844 | ||
843 | /** | 845 | /** |
844 | * may_umount_tree - check if a mount tree is busy | 846 | * may_umount_tree - check if a mount tree is busy |