diff options
Diffstat (limited to 'fs/proc/namespaces.c')
| -rw-r--r-- | fs/proc/namespaces.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index 66b51c0383da..54bdc6701e9f 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c | |||
| @@ -51,7 +51,7 @@ static int ns_delete_dentry(const struct dentry *dentry) | |||
| 51 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | 51 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) |
| 52 | { | 52 | { |
| 53 | struct inode *inode = dentry->d_inode; | 53 | struct inode *inode = dentry->d_inode; |
| 54 | const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; | 54 | const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns.ns_ops; |
| 55 | 55 | ||
| 56 | return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", | 56 | return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", |
| 57 | ns_ops->name, inode->i_ino); | 57 | ns_ops->name, inode->i_ino); |
| @@ -95,8 +95,8 @@ static struct dentry *proc_ns_get_dentry(struct super_block *sb, | |||
| 95 | inode->i_op = &ns_inode_operations; | 95 | inode->i_op = &ns_inode_operations; |
| 96 | inode->i_mode = S_IFREG | S_IRUGO; | 96 | inode->i_mode = S_IFREG | S_IRUGO; |
| 97 | inode->i_fop = &ns_file_operations; | 97 | inode->i_fop = &ns_file_operations; |
| 98 | ei->ns_ops = ns_ops; | 98 | ei->ns.ns_ops = ns_ops; |
| 99 | ei->ns = ns; | 99 | ei->ns.ns = ns; |
| 100 | unlock_new_inode(inode); | 100 | unlock_new_inode(inode); |
| 101 | } else { | 101 | } else { |
| 102 | ns_ops->put(ns); | 102 | ns_ops->put(ns); |
| @@ -128,7 +128,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
| 128 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) | 128 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
| 129 | goto out_put_task; | 129 | goto out_put_task; |
| 130 | 130 | ||
| 131 | ns_path.dentry = proc_ns_get_dentry(sb, task, ei->ns_ops); | 131 | ns_path.dentry = proc_ns_get_dentry(sb, task, ei->ns.ns_ops); |
| 132 | if (IS_ERR(ns_path.dentry)) { | 132 | if (IS_ERR(ns_path.dentry)) { |
| 133 | error = ERR_CAST(ns_path.dentry); | 133 | error = ERR_CAST(ns_path.dentry); |
| 134 | goto out_put_task; | 134 | goto out_put_task; |
| @@ -148,7 +148,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl | |||
| 148 | { | 148 | { |
| 149 | struct inode *inode = dentry->d_inode; | 149 | struct inode *inode = dentry->d_inode; |
| 150 | struct proc_inode *ei = PROC_I(inode); | 150 | struct proc_inode *ei = PROC_I(inode); |
| 151 | const struct proc_ns_operations *ns_ops = ei->ns_ops; | 151 | const struct proc_ns_operations *ns_ops = ei->ns.ns_ops; |
| 152 | struct task_struct *task; | 152 | struct task_struct *task; |
| 153 | void *ns; | 153 | void *ns; |
| 154 | char name[50]; | 154 | char name[50]; |
| @@ -202,7 +202,7 @@ static struct dentry *proc_ns_instantiate(struct inode *dir, | |||
| 202 | ei = PROC_I(inode); | 202 | ei = PROC_I(inode); |
| 203 | inode->i_mode = S_IFLNK|S_IRWXUGO; | 203 | inode->i_mode = S_IFLNK|S_IRWXUGO; |
| 204 | inode->i_op = &proc_ns_link_inode_operations; | 204 | inode->i_op = &proc_ns_link_inode_operations; |
| 205 | ei->ns_ops = ns_ops; | 205 | ei->ns.ns_ops = ns_ops; |
| 206 | 206 | ||
| 207 | d_set_d_op(dentry, &pid_dentry_operations); | 207 | d_set_d_op(dentry, &pid_dentry_operations); |
| 208 | d_add(dentry, inode); | 208 | d_add(dentry, inode); |
| @@ -337,6 +337,11 @@ out_invalid: | |||
| 337 | return ERR_PTR(-EINVAL); | 337 | return ERR_PTR(-EINVAL); |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | struct proc_ns *get_proc_ns(struct inode *inode) | ||
| 341 | { | ||
| 342 | return &PROC_I(inode)->ns; | ||
| 343 | } | ||
| 344 | |||
| 340 | bool proc_ns_inode(struct inode *inode) | 345 | bool proc_ns_inode(struct inode *inode) |
| 341 | { | 346 | { |
| 342 | return inode->i_fop == &ns_file_operations; | 347 | return inode->i_fop == &ns_file_operations; |
