diff options
author | David Howells <dhowells@redhat.com> | 2013-04-11 20:50:06 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-01 17:29:39 -0400 |
commit | 0bb80f240520c4148b623161e7856858c021696d (patch) | |
tree | eeb27af589bc12d5864bd2594e5eea59aabe37db | |
parent | c3bef7bcaaa7d9f6704fcd81a171c9f0c91a2259 (diff) |
proc: Split the namespace stuff out into linux/proc_ns.h
Split the proc namespace stuff out into linux/proc_ns.h.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: netdev@vger.kernel.org
cc: Serge E. Hallyn <serge.hallyn@ubuntu.com>
cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namespace.c | 6 | ||||
-rw-r--r-- | fs/proc/inode.c | 8 | ||||
-rw-r--r-- | fs/proc/namespaces.c | 17 | ||||
-rw-r--r-- | include/linux/proc_fs.h | 68 | ||||
-rw-r--r-- | include/linux/proc_ns.h | 74 | ||||
-rw-r--r-- | init/version.c | 2 | ||||
-rw-r--r-- | ipc/msgutil.c | 2 | ||||
-rw-r--r-- | ipc/namespace.c | 2 | ||||
-rw-r--r-- | kernel/nsproxy.c | 6 | ||||
-rw-r--r-- | kernel/pid.c | 1 | ||||
-rw-r--r-- | kernel/pid_namespace.c | 2 | ||||
-rw-r--r-- | kernel/user.c | 2 | ||||
-rw-r--r-- | kernel/user_namespace.c | 2 | ||||
-rw-r--r-- | kernel/utsname.c | 2 | ||||
-rw-r--r-- | net/core/net_namespace.c | 7 |
15 files changed, 109 insertions, 92 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index ed0708f2415f..0f0cf9379c9e 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/fs_struct.h> /* get_fs_root et.al. */ | 21 | #include <linux/fs_struct.h> /* get_fs_root et.al. */ |
22 | #include <linux/fsnotify.h> /* fsnotify_vfsmount_delete */ | 22 | #include <linux/fsnotify.h> /* fsnotify_vfsmount_delete */ |
23 | #include <linux/uaccess.h> | 23 | #include <linux/uaccess.h> |
24 | #include <linux/proc_fs.h> | 24 | #include <linux/proc_ns.h> |
25 | #include "pnode.h" | 25 | #include "pnode.h" |
26 | #include "internal.h" | 26 | #include "internal.h" |
27 | 27 | ||
@@ -1350,13 +1350,13 @@ static bool mnt_ns_loop(struct path *path) | |||
1350 | * mount namespace loop? | 1350 | * mount namespace loop? |
1351 | */ | 1351 | */ |
1352 | struct inode *inode = path->dentry->d_inode; | 1352 | struct inode *inode = path->dentry->d_inode; |
1353 | struct proc_inode *ei; | 1353 | struct proc_ns *ei; |
1354 | struct mnt_namespace *mnt_ns; | 1354 | struct mnt_namespace *mnt_ns; |
1355 | 1355 | ||
1356 | if (!proc_ns_inode(inode)) | 1356 | if (!proc_ns_inode(inode)) |
1357 | return false; | 1357 | return false; |
1358 | 1358 | ||
1359 | ei = PROC_I(inode); | 1359 | ei = get_proc_ns(inode); |
1360 | if (ei->ns_ops != &mntns_operations) | 1360 | if (ei->ns_ops != &mntns_operations) |
1361 | return false; | 1361 | return false; |
1362 | 1362 | ||
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index bd2f76427fec..073aea60cf8f 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -51,8 +51,8 @@ static void proc_evict_inode(struct inode *inode) | |||
51 | sysctl_head_put(head); | 51 | sysctl_head_put(head); |
52 | } | 52 | } |
53 | /* Release any associated namespace */ | 53 | /* Release any associated namespace */ |
54 | ns_ops = PROC_I(inode)->ns_ops; | 54 | ns_ops = PROC_I(inode)->ns.ns_ops; |
55 | ns = PROC_I(inode)->ns; | 55 | ns = PROC_I(inode)->ns.ns; |
56 | if (ns_ops && ns) | 56 | if (ns_ops && ns) |
57 | ns_ops->put(ns); | 57 | ns_ops->put(ns); |
58 | } | 58 | } |
@@ -73,8 +73,8 @@ static struct inode *proc_alloc_inode(struct super_block *sb) | |||
73 | ei->pde = NULL; | 73 | ei->pde = NULL; |
74 | ei->sysctl = NULL; | 74 | ei->sysctl = NULL; |
75 | ei->sysctl_entry = NULL; | 75 | ei->sysctl_entry = NULL; |
76 | ei->ns = NULL; | 76 | ei->ns.ns = NULL; |
77 | ei->ns_ops = NULL; | 77 | ei->ns.ns_ops = NULL; |
78 | inode = &ei->vfs_inode; | 78 | inode = &ei->vfs_inode; |
79 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 79 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
80 | return inode; | 80 | return inode; |
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; |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 28a4d7e78803..8f7d8f24141a 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
7 | #include <linux/magic.h> | 7 | #include <linux/magic.h> |
8 | #include <linux/atomic.h> | 8 | #include <linux/atomic.h> |
9 | #include <linux/proc_ns.h> | ||
9 | 10 | ||
10 | struct net; | 11 | struct net; |
11 | struct completion; | 12 | struct completion; |
@@ -24,18 +25,6 @@ struct mm_struct; | |||
24 | #define PROC_NUMBUF 13 | 25 | #define PROC_NUMBUF 13 |
25 | 26 | ||
26 | /* | 27 | /* |
27 | * We always define these enumerators | ||
28 | */ | ||
29 | |||
30 | enum { | ||
31 | PROC_ROOT_INO = 1, | ||
32 | PROC_IPC_INIT_INO = 0xEFFFFFFFU, | ||
33 | PROC_UTS_INIT_INO = 0xEFFFFFFEU, | ||
34 | PROC_USER_INIT_INO = 0xEFFFFFFDU, | ||
35 | PROC_PID_INIT_INO = 0xEFFFFFFCU, | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * This is not completely implemented yet. The idea is to | 28 | * This is not completely implemented yet. The idea is to |
40 | * create an in-memory tree (like the actual /proc filesystem | 29 | * create an in-memory tree (like the actual /proc filesystem |
41 | * tree) of these proc_dir_entries, so that we can dynamically | 30 | * tree) of these proc_dir_entries, so that we can dynamically |
@@ -81,10 +70,6 @@ struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | |||
81 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); | 70 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); |
82 | extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent); | 71 | extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent); |
83 | 72 | ||
84 | struct pid_namespace; | ||
85 | |||
86 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | ||
87 | extern void pid_ns_release_proc(struct pid_namespace *ns); | ||
88 | 73 | ||
89 | /* | 74 | /* |
90 | * proc_tty.c | 75 | * proc_tty.c |
@@ -132,12 +117,6 @@ extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, | |||
132 | 117 | ||
133 | extern void proc_set_size(struct proc_dir_entry *, loff_t); | 118 | extern void proc_set_size(struct proc_dir_entry *, loff_t); |
134 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); | 119 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); |
135 | |||
136 | extern struct file *proc_ns_fget(int fd); | ||
137 | extern bool proc_ns_inode(struct inode *inode); | ||
138 | |||
139 | extern int proc_alloc_inum(unsigned int *pino); | ||
140 | extern void proc_free_inum(unsigned int inum); | ||
141 | #else | 120 | #else |
142 | 121 | ||
143 | static inline void proc_flush_task(struct task_struct *task) | 122 | static inline void proc_flush_task(struct task_struct *task) |
@@ -168,50 +147,8 @@ struct tty_driver; | |||
168 | static inline void proc_tty_register_driver(struct tty_driver *driver) {}; | 147 | static inline void proc_tty_register_driver(struct tty_driver *driver) {}; |
169 | static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; | 148 | static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; |
170 | 149 | ||
171 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) | ||
172 | { | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static inline void pid_ns_release_proc(struct pid_namespace *ns) | ||
177 | { | ||
178 | } | ||
179 | |||
180 | static inline struct file *proc_ns_fget(int fd) | ||
181 | { | ||
182 | return ERR_PTR(-EINVAL); | ||
183 | } | ||
184 | |||
185 | static inline bool proc_ns_inode(struct inode *inode) | ||
186 | { | ||
187 | return false; | ||
188 | } | ||
189 | |||
190 | static inline int proc_alloc_inum(unsigned int *inum) | ||
191 | { | ||
192 | *inum = 1; | ||
193 | return 0; | ||
194 | } | ||
195 | static inline void proc_free_inum(unsigned int inum) | ||
196 | { | ||
197 | } | ||
198 | #endif /* CONFIG_PROC_FS */ | 150 | #endif /* CONFIG_PROC_FS */ |
199 | 151 | ||
200 | struct nsproxy; | ||
201 | struct proc_ns_operations { | ||
202 | const char *name; | ||
203 | int type; | ||
204 | void *(*get)(struct task_struct *task); | ||
205 | void (*put)(void *ns); | ||
206 | int (*install)(struct nsproxy *nsproxy, void *ns); | ||
207 | unsigned int (*inum)(void *ns); | ||
208 | }; | ||
209 | extern const struct proc_ns_operations netns_operations; | ||
210 | extern const struct proc_ns_operations utsns_operations; | ||
211 | extern const struct proc_ns_operations ipcns_operations; | ||
212 | extern const struct proc_ns_operations pidns_operations; | ||
213 | extern const struct proc_ns_operations userns_operations; | ||
214 | extern const struct proc_ns_operations mntns_operations; | ||
215 | 152 | ||
216 | union proc_op { | 153 | union proc_op { |
217 | int (*proc_get_link)(struct dentry *, struct path *); | 154 | int (*proc_get_link)(struct dentry *, struct path *); |
@@ -231,8 +168,7 @@ struct proc_inode { | |||
231 | struct proc_dir_entry *pde; | 168 | struct proc_dir_entry *pde; |
232 | struct ctl_table_header *sysctl; | 169 | struct ctl_table_header *sysctl; |
233 | struct ctl_table *sysctl_entry; | 170 | struct ctl_table *sysctl_entry; |
234 | void *ns; | 171 | struct proc_ns ns; |
235 | const struct proc_ns_operations *ns_ops; | ||
236 | struct inode vfs_inode; | 172 | struct inode vfs_inode; |
237 | }; | 173 | }; |
238 | 174 | ||
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h new file mode 100644 index 000000000000..34a1e105bef4 --- /dev/null +++ b/include/linux/proc_ns.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * procfs namespace bits | ||
3 | */ | ||
4 | #ifndef _LINUX_PROC_NS_H | ||
5 | #define _LINUX_PROC_NS_H | ||
6 | |||
7 | struct pid_namespace; | ||
8 | struct nsproxy; | ||
9 | |||
10 | struct proc_ns_operations { | ||
11 | const char *name; | ||
12 | int type; | ||
13 | void *(*get)(struct task_struct *task); | ||
14 | void (*put)(void *ns); | ||
15 | int (*install)(struct nsproxy *nsproxy, void *ns); | ||
16 | unsigned int (*inum)(void *ns); | ||
17 | }; | ||
18 | |||
19 | struct proc_ns { | ||
20 | void *ns; | ||
21 | const struct proc_ns_operations *ns_ops; | ||
22 | }; | ||
23 | |||
24 | extern const struct proc_ns_operations netns_operations; | ||
25 | extern const struct proc_ns_operations utsns_operations; | ||
26 | extern const struct proc_ns_operations ipcns_operations; | ||
27 | extern const struct proc_ns_operations pidns_operations; | ||
28 | extern const struct proc_ns_operations userns_operations; | ||
29 | extern const struct proc_ns_operations mntns_operations; | ||
30 | |||
31 | /* | ||
32 | * We always define these enumerators | ||
33 | */ | ||
34 | enum { | ||
35 | PROC_ROOT_INO = 1, | ||
36 | PROC_IPC_INIT_INO = 0xEFFFFFFFU, | ||
37 | PROC_UTS_INIT_INO = 0xEFFFFFFEU, | ||
38 | PROC_USER_INIT_INO = 0xEFFFFFFDU, | ||
39 | PROC_PID_INIT_INO = 0xEFFFFFFCU, | ||
40 | }; | ||
41 | |||
42 | #ifdef CONFIG_PROC_FS | ||
43 | |||
44 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | ||
45 | extern void pid_ns_release_proc(struct pid_namespace *ns); | ||
46 | extern struct file *proc_ns_fget(int fd); | ||
47 | extern struct proc_ns *get_proc_ns(struct inode *); | ||
48 | extern int proc_alloc_inum(unsigned int *pino); | ||
49 | extern void proc_free_inum(unsigned int inum); | ||
50 | extern bool proc_ns_inode(struct inode *inode); | ||
51 | |||
52 | #else /* CONFIG_PROC_FS */ | ||
53 | |||
54 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; } | ||
55 | static inline void pid_ns_release_proc(struct pid_namespace *ns) {} | ||
56 | |||
57 | static inline struct file *proc_ns_fget(int fd) | ||
58 | { | ||
59 | return ERR_PTR(-EINVAL); | ||
60 | } | ||
61 | |||
62 | static inline struct proc_ns *get_proc_ns(struct inode *inode) { return NULL; } | ||
63 | |||
64 | static inline int proc_alloc_inum(unsigned int *inum) | ||
65 | { | ||
66 | *inum = 1; | ||
67 | return 0; | ||
68 | } | ||
69 | static inline void proc_free_inum(unsigned int inum) {} | ||
70 | static inline bool proc_ns_inode(struct inode *inode) { return false; } | ||
71 | |||
72 | #endif /* CONFIG_PROC_FS */ | ||
73 | |||
74 | #endif /* _LINUX_PROC_NS_H */ | ||
diff --git a/init/version.c b/init/version.c index 58170f18912d..1a4718e500fe 100644 --- a/init/version.c +++ b/init/version.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/utsname.h> | 12 | #include <linux/utsname.h> |
13 | #include <generated/utsrelease.h> | 13 | #include <generated/utsrelease.h> |
14 | #include <linux/version.h> | 14 | #include <linux/version.h> |
15 | #include <linux/proc_fs.h> | 15 | #include <linux/proc_ns.h> |
16 | 16 | ||
17 | #ifndef CONFIG_KALLSYMS | 17 | #ifndef CONFIG_KALLSYMS |
18 | #define version(a) Version_ ## a | 18 | #define version(a) Version_ ## a |
diff --git a/ipc/msgutil.c b/ipc/msgutil.c index 5df8e4bf1db0..8f0201735f16 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/msg.h> | 16 | #include <linux/msg.h> |
17 | #include <linux/ipc_namespace.h> | 17 | #include <linux/ipc_namespace.h> |
18 | #include <linux/utsname.h> | 18 | #include <linux/utsname.h> |
19 | #include <linux/proc_fs.h> | 19 | #include <linux/proc_ns.h> |
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | 21 | ||
22 | #include "util.h" | 22 | #include "util.h" |
diff --git a/ipc/namespace.c b/ipc/namespace.c index 7c1fa451b0b0..7ee61bf44933 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/mount.h> | 13 | #include <linux/mount.h> |
14 | #include <linux/user_namespace.h> | 14 | #include <linux/user_namespace.h> |
15 | #include <linux/proc_fs.h> | 15 | #include <linux/proc_ns.h> |
16 | 16 | ||
17 | #include "util.h" | 17 | #include "util.h" |
18 | 18 | ||
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index afc0456f227a..364ceab15f0c 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/pid_namespace.h> | 22 | #include <linux/pid_namespace.h> |
23 | #include <net/net_namespace.h> | 23 | #include <net/net_namespace.h> |
24 | #include <linux/ipc_namespace.h> | 24 | #include <linux/ipc_namespace.h> |
25 | #include <linux/proc_fs.h> | 25 | #include <linux/proc_ns.h> |
26 | #include <linux/file.h> | 26 | #include <linux/file.h> |
27 | #include <linux/syscalls.h> | 27 | #include <linux/syscalls.h> |
28 | 28 | ||
@@ -241,7 +241,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype) | |||
241 | const struct proc_ns_operations *ops; | 241 | const struct proc_ns_operations *ops; |
242 | struct task_struct *tsk = current; | 242 | struct task_struct *tsk = current; |
243 | struct nsproxy *new_nsproxy; | 243 | struct nsproxy *new_nsproxy; |
244 | struct proc_inode *ei; | 244 | struct proc_ns *ei; |
245 | struct file *file; | 245 | struct file *file; |
246 | int err; | 246 | int err; |
247 | 247 | ||
@@ -250,7 +250,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype) | |||
250 | return PTR_ERR(file); | 250 | return PTR_ERR(file); |
251 | 251 | ||
252 | err = -EINVAL; | 252 | err = -EINVAL; |
253 | ei = PROC_I(file_inode(file)); | 253 | ei = get_proc_ns(file_inode(file)); |
254 | ops = ei->ns_ops; | 254 | ops = ei->ns_ops; |
255 | if (nstype && (ops->type != nstype)) | 255 | if (nstype && (ops->type != nstype)) |
256 | goto out; | 256 | goto out; |
diff --git a/kernel/pid.c b/kernel/pid.c index 047dc6264638..686255e2c39e 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/pid_namespace.h> | 36 | #include <linux/pid_namespace.h> |
37 | #include <linux/init_task.h> | 37 | #include <linux/init_task.h> |
38 | #include <linux/syscalls.h> | 38 | #include <linux/syscalls.h> |
39 | #include <linux/proc_ns.h> | ||
39 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
40 | 41 | ||
41 | #define pid_hashfn(nr, ns) \ | 42 | #define pid_hashfn(nr, ns) \ |
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index c1c3dc1c6023..4af28a849065 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/acct.h> | 16 | #include <linux/acct.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_ns.h> |
19 | #include <linux/reboot.h> | 19 | #include <linux/reboot.h> |
20 | #include <linux/export.h> | 20 | #include <linux/export.h> |
21 | 21 | ||
diff --git a/kernel/user.c b/kernel/user.c index e81978e8c03b..5bbb91988e69 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/export.h> | 17 | #include <linux/export.h> |
18 | #include <linux/user_namespace.h> | 18 | #include <linux/user_namespace.h> |
19 | #include <linux/proc_fs.h> | 19 | #include <linux/proc_ns.h> |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * userns count is 1 for root user, 1 for init_uts_ns, | 22 | * userns count is 1 for root user, 1 for init_uts_ns, |
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index b14f4d342043..51855f5f6311 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/nsproxy.h> | 9 | #include <linux/nsproxy.h> |
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
11 | #include <linux/user_namespace.h> | 11 | #include <linux/user_namespace.h> |
12 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_ns.h> |
13 | #include <linux/highuid.h> | 13 | #include <linux/highuid.h> |
14 | #include <linux/cred.h> | 14 | #include <linux/cred.h> |
15 | #include <linux/securebits.h> | 15 | #include <linux/securebits.h> |
diff --git a/kernel/utsname.c b/kernel/utsname.c index a47fc5de3113..2fc8576efaa8 100644 --- a/kernel/utsname.c +++ b/kernel/utsname.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/user_namespace.h> | 17 | #include <linux/user_namespace.h> |
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_ns.h> |
19 | 19 | ||
20 | static struct uts_namespace *create_uts_ns(void) | 20 | static struct uts_namespace *create_uts_ns(void) |
21 | { | 21 | { |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 80e271d9e64b..f97652036754 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -10,7 +10,8 @@ | |||
10 | #include <linux/idr.h> | 10 | #include <linux/idr.h> |
11 | #include <linux/rculist.h> | 11 | #include <linux/rculist.h> |
12 | #include <linux/nsproxy.h> | 12 | #include <linux/nsproxy.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/proc_ns.h> | ||
14 | #include <linux/file.h> | 15 | #include <linux/file.h> |
15 | #include <linux/export.h> | 16 | #include <linux/export.h> |
16 | #include <linux/user_namespace.h> | 17 | #include <linux/user_namespace.h> |
@@ -336,7 +337,7 @@ EXPORT_SYMBOL_GPL(__put_net); | |||
336 | 337 | ||
337 | struct net *get_net_ns_by_fd(int fd) | 338 | struct net *get_net_ns_by_fd(int fd) |
338 | { | 339 | { |
339 | struct proc_inode *ei; | 340 | struct proc_ns *ei; |
340 | struct file *file; | 341 | struct file *file; |
341 | struct net *net; | 342 | struct net *net; |
342 | 343 | ||
@@ -344,7 +345,7 @@ struct net *get_net_ns_by_fd(int fd) | |||
344 | if (IS_ERR(file)) | 345 | if (IS_ERR(file)) |
345 | return ERR_CAST(file); | 346 | return ERR_CAST(file); |
346 | 347 | ||
347 | ei = PROC_I(file_inode(file)); | 348 | ei = get_proc_ns(file_inode(file)); |
348 | if (ei->ns_ops == &netns_operations) | 349 | if (ei->ns_ops == &netns_operations) |
349 | net = get_net(ei->ns); | 350 | net = get_net(ei->ns); |
350 | else | 351 | else |