aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-01 00:37:32 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-04 14:34:17 -0500
commit64964528b24ea390824f0e5ce9d34b8d39b28cde (patch)
tree2de66d75468ad4ddecc7e175f86f1dbaae47ea9a /fs
parent3c0411846118a578de3a979faf2da3ab5fb81179 (diff)
make proc_ns_operations work with struct ns_common * instead of void *
We can do that now. And kill ->inum(), while we are at it - all instances are identical. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c13
-rw-r--r--fs/proc/inode.c2
-rw-r--r--fs/proc/namespaces.c8
3 files changed, 8 insertions, 15 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 5c21fdadabe4..b9c16c3f63f5 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3149,7 +3149,7 @@ found:
3149 return visible; 3149 return visible;
3150} 3150}
3151 3151
3152static void *mntns_get(struct task_struct *task) 3152static struct ns_common *mntns_get(struct task_struct *task)
3153{ 3153{
3154 struct ns_common *ns = NULL; 3154 struct ns_common *ns = NULL;
3155 struct nsproxy *nsproxy; 3155 struct nsproxy *nsproxy;
@@ -3165,12 +3165,12 @@ static void *mntns_get(struct task_struct *task)
3165 return ns; 3165 return ns;
3166} 3166}
3167 3167
3168static void mntns_put(void *ns) 3168static void mntns_put(struct ns_common *ns)
3169{ 3169{
3170 put_mnt_ns(to_mnt_ns(ns)); 3170 put_mnt_ns(to_mnt_ns(ns));
3171} 3171}
3172 3172
3173static int mntns_install(struct nsproxy *nsproxy, void *ns) 3173static int mntns_install(struct nsproxy *nsproxy, struct ns_common *ns)
3174{ 3174{
3175 struct fs_struct *fs = current->fs; 3175 struct fs_struct *fs = current->fs;
3176 struct mnt_namespace *mnt_ns = to_mnt_ns(ns); 3176 struct mnt_namespace *mnt_ns = to_mnt_ns(ns);
@@ -3203,17 +3203,10 @@ static int mntns_install(struct nsproxy *nsproxy, void *ns)
3203 return 0; 3203 return 0;
3204} 3204}
3205 3205
3206static unsigned int mntns_inum(void *ns)
3207{
3208 struct ns_common *p = ns;
3209 return p->inum;
3210}
3211
3212const struct proc_ns_operations mntns_operations = { 3206const struct proc_ns_operations mntns_operations = {
3213 .name = "mnt", 3207 .name = "mnt",
3214 .type = CLONE_NEWNS, 3208 .type = CLONE_NEWNS,
3215 .get = mntns_get, 3209 .get = mntns_get,
3216 .put = mntns_put, 3210 .put = mntns_put,
3217 .install = mntns_install, 3211 .install = mntns_install,
3218 .inum = mntns_inum,
3219}; 3212};
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 333080d7a671..43b703c6cd3b 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -33,7 +33,7 @@ static void proc_evict_inode(struct inode *inode)
33 struct proc_dir_entry *de; 33 struct proc_dir_entry *de;
34 struct ctl_table_header *head; 34 struct ctl_table_header *head;
35 const struct proc_ns_operations *ns_ops; 35 const struct proc_ns_operations *ns_ops;
36 void *ns; 36 struct ns_common *ns;
37 37
38 truncate_inode_pages_final(&inode->i_data); 38 truncate_inode_pages_final(&inode->i_data);
39 clear_inode(inode); 39 clear_inode(inode);
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index 89026095f2b5..995e8e98237d 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -64,7 +64,7 @@ static struct dentry *proc_ns_get_dentry(struct super_block *sb,
64 struct inode *inode; 64 struct inode *inode;
65 struct proc_inode *ei; 65 struct proc_inode *ei;
66 struct qstr qname = { .name = "", }; 66 struct qstr qname = { .name = "", };
67 void *ns; 67 struct ns_common *ns;
68 68
69 ns = ns_ops->get(task); 69 ns = ns_ops->get(task);
70 if (!ns) 70 if (!ns)
@@ -76,7 +76,7 @@ static struct dentry *proc_ns_get_dentry(struct super_block *sb,
76 return ERR_PTR(-ENOMEM); 76 return ERR_PTR(-ENOMEM);
77 } 77 }
78 78
79 inode = iget_locked(sb, ns_ops->inum(ns)); 79 inode = iget_locked(sb, ns->inum);
80 if (!inode) { 80 if (!inode) {
81 dput(dentry); 81 dput(dentry);
82 ns_ops->put(ns); 82 ns_ops->put(ns);
@@ -144,7 +144,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl
144 struct proc_inode *ei = PROC_I(inode); 144 struct proc_inode *ei = PROC_I(inode);
145 const struct proc_ns_operations *ns_ops = ei->ns.ns_ops; 145 const struct proc_ns_operations *ns_ops = ei->ns.ns_ops;
146 struct task_struct *task; 146 struct task_struct *task;
147 void *ns; 147 struct ns_common *ns;
148 char name[50]; 148 char name[50];
149 int res = -EACCES; 149 int res = -EACCES;
150 150
@@ -160,7 +160,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl
160 if (!ns) 160 if (!ns)
161 goto out_put_task; 161 goto out_put_task;
162 162
163 snprintf(name, sizeof(name), "%s:[%u]", ns_ops->name, ns_ops->inum(ns)); 163 snprintf(name, sizeof(name), "%s:[%u]", ns_ops->name, ns->inum);
164 res = readlink_copy(buffer, buflen, name); 164 res = readlink_copy(buffer, buflen, name);
165 ns_ops->put(ns); 165 ns_ops->put(ns);
166out_put_task: 166out_put_task: