aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-08 15:19:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-08 15:19:57 -0500
commit972b2c719990f91eb3b2310d44ef8a2d38955a14 (patch)
treeb25a250ec5bec4b7b6355d214642d8b57c5cab32 /fs/proc
parent02550d61f49266930e674286379d3601006b2893 (diff)
parentc3aa077648e147783a7a53b409578234647db853 (diff)
Merge branch 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
* 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (165 commits) reiserfs: Properly display mount options in /proc/mounts vfs: prevent remount read-only if pending removes vfs: count unlinked inodes vfs: protect remounting superblock read-only vfs: keep list of mounts for each superblock vfs: switch ->show_options() to struct dentry * vfs: switch ->show_path() to struct dentry * vfs: switch ->show_devname() to struct dentry * vfs: switch ->show_stats to struct dentry * switch security_path_chmod() to struct path * vfs: prefer ->dentry->d_sb to ->mnt->mnt_sb vfs: trim includes a bit switch mnt_namespace ->root to struct mount vfs: take /proc/*/mounts and friends to fs/proc_namespace.c vfs: opencode mntget() mnt_set_mountpoint() vfs: spread struct mount - remaining argument of next_mnt() vfs: move fsnotify junk to struct mount vfs: move mnt_devname vfs: move mnt_list to struct mount vfs: switch pnode.h macros to struct mount * ...
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c116
-rw-r--r--fs/proc/generic.c8
-rw-r--r--fs/proc/inode.c1
-rw-r--r--fs/proc/namespaces.c1
-rw-r--r--fs/proc/proc_net.c2
5 files changed, 6 insertions, 122 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 851ba3dcdc29..a1dddda999f2 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -101,7 +101,7 @@
101struct pid_entry { 101struct pid_entry {
102 char *name; 102 char *name;
103 int len; 103 int len;
104 mode_t mode; 104 umode_t mode;
105 const struct inode_operations *iop; 105 const struct inode_operations *iop;
106 const struct file_operations *fop; 106 const struct file_operations *fop;
107 union proc_op op; 107 union proc_op op;
@@ -631,120 +631,6 @@ static const struct inode_operations proc_def_inode_operations = {
631 .setattr = proc_setattr, 631 .setattr = proc_setattr,
632}; 632};
633 633
634static int mounts_open_common(struct inode *inode, struct file *file,
635 const struct seq_operations *op)
636{
637 struct task_struct *task = get_proc_task(inode);
638 struct nsproxy *nsp;
639 struct mnt_namespace *ns = NULL;
640 struct path root;
641 struct proc_mounts *p;
642 int ret = -EINVAL;
643
644 if (task) {
645 rcu_read_lock();
646 nsp = task_nsproxy(task);
647 if (nsp) {
648 ns = nsp->mnt_ns;
649 if (ns)
650 get_mnt_ns(ns);
651 }
652 rcu_read_unlock();
653 if (ns && get_task_root(task, &root) == 0)
654 ret = 0;
655 put_task_struct(task);
656 }
657
658 if (!ns)
659 goto err;
660 if (ret)
661 goto err_put_ns;
662
663 ret = -ENOMEM;
664 p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL);
665 if (!p)
666 goto err_put_path;
667
668 file->private_data = &p->m;
669 ret = seq_open(file, op);
670 if (ret)
671 goto err_free;
672
673 p->m.private = p;
674 p->ns = ns;
675 p->root = root;
676 p->m.poll_event = ns->event;
677
678 return 0;
679
680 err_free:
681 kfree(p);
682 err_put_path:
683 path_put(&root);
684 err_put_ns:
685 put_mnt_ns(ns);
686 err:
687 return ret;
688}
689
690static int mounts_release(struct inode *inode, struct file *file)
691{
692 struct proc_mounts *p = file->private_data;
693 path_put(&p->root);
694 put_mnt_ns(p->ns);
695 return seq_release(inode, file);
696}
697
698static unsigned mounts_poll(struct file *file, poll_table *wait)
699{
700 struct proc_mounts *p = file->private_data;
701 unsigned res = POLLIN | POLLRDNORM;
702
703 poll_wait(file, &p->ns->poll, wait);
704 if (mnt_had_events(p))
705 res |= POLLERR | POLLPRI;
706
707 return res;
708}
709
710static int mounts_open(struct inode *inode, struct file *file)
711{
712 return mounts_open_common(inode, file, &mounts_op);
713}
714
715static const struct file_operations proc_mounts_operations = {
716 .open = mounts_open,
717 .read = seq_read,
718 .llseek = seq_lseek,
719 .release = mounts_release,
720 .poll = mounts_poll,
721};
722
723static int mountinfo_open(struct inode *inode, struct file *file)
724{
725 return mounts_open_common(inode, file, &mountinfo_op);
726}
727
728static const struct file_operations proc_mountinfo_operations = {
729 .open = mountinfo_open,
730 .read = seq_read,
731 .llseek = seq_lseek,
732 .release = mounts_release,
733 .poll = mounts_poll,
734};
735
736static int mountstats_open(struct inode *inode, struct file *file)
737{
738 return mounts_open_common(inode, file, &mountstats_op);
739}
740
741static const struct file_operations proc_mountstats_operations = {
742 .open = mountstats_open,
743 .read = seq_read,
744 .llseek = seq_lseek,
745 .release = mounts_release,
746};
747
748#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */ 634#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */
749 635
750static ssize_t proc_info_read(struct file * file, char __user * buf, 636static ssize_t proc_info_read(struct file * file, char __user * buf,
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 10090d9c7ad5..2edf34f2eb61 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -597,7 +597,7 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
597 597
598static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent, 598static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
599 const char *name, 599 const char *name,
600 mode_t mode, 600 umode_t mode,
601 nlink_t nlink) 601 nlink_t nlink)
602{ 602{
603 struct proc_dir_entry *ent = NULL; 603 struct proc_dir_entry *ent = NULL;
@@ -659,7 +659,7 @@ struct proc_dir_entry *proc_symlink(const char *name,
659} 659}
660EXPORT_SYMBOL(proc_symlink); 660EXPORT_SYMBOL(proc_symlink);
661 661
662struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 662struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
663 struct proc_dir_entry *parent) 663 struct proc_dir_entry *parent)
664{ 664{
665 struct proc_dir_entry *ent; 665 struct proc_dir_entry *ent;
@@ -699,7 +699,7 @@ struct proc_dir_entry *proc_mkdir(const char *name,
699} 699}
700EXPORT_SYMBOL(proc_mkdir); 700EXPORT_SYMBOL(proc_mkdir);
701 701
702struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 702struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
703 struct proc_dir_entry *parent) 703 struct proc_dir_entry *parent)
704{ 704{
705 struct proc_dir_entry *ent; 705 struct proc_dir_entry *ent;
@@ -728,7 +728,7 @@ struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
728} 728}
729EXPORT_SYMBOL(create_proc_entry); 729EXPORT_SYMBOL(create_proc_entry);
730 730
731struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, 731struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
732 struct proc_dir_entry *parent, 732 struct proc_dir_entry *parent,
733 const struct file_operations *proc_fops, 733 const struct file_operations *proc_fops,
734 void *data) 734 void *data)
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 7737c5468a40..51a176622b8f 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -77,7 +77,6 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
77static void proc_i_callback(struct rcu_head *head) 77static void proc_i_callback(struct rcu_head *head)
78{ 78{
79 struct inode *inode = container_of(head, struct inode, i_rcu); 79 struct inode *inode = container_of(head, struct inode, i_rcu);
80 INIT_LIST_HEAD(&inode->i_dentry);
81 kmem_cache_free(proc_inode_cachep, PROC_I(inode)); 80 kmem_cache_free(proc_inode_cachep, PROC_I(inode));
82} 81}
83 82
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index be177f702acb..27da860115c6 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -9,7 +9,6 @@
9#include <linux/file.h> 9#include <linux/file.h>
10#include <linux/utsname.h> 10#include <linux/utsname.h>
11#include <net/net_namespace.h> 11#include <net/net_namespace.h>
12#include <linux/mnt_namespace.h>
13#include <linux/ipc_namespace.h> 12#include <linux/ipc_namespace.h>
14#include <linux/pid_namespace.h> 13#include <linux/pid_namespace.h>
15#include "internal.h" 14#include "internal.h"
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index f738024ccc8e..06e1cc17caf6 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -179,7 +179,7 @@ const struct file_operations proc_net_operations = {
179 179
180 180
181struct proc_dir_entry *proc_net_fops_create(struct net *net, 181struct proc_dir_entry *proc_net_fops_create(struct net *net,
182 const char *name, mode_t mode, const struct file_operations *fops) 182 const char *name, umode_t mode, const struct file_operations *fops)
183{ 183{
184 return proc_create(name, mode, net->proc_net, fops); 184 return proc_create(name, mode, net->proc_net, fops);
185} 185}