diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-03-07 19:41:34 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2011-05-10 17:31:44 -0400 |
commit | 6b4e306aa3dc94a0545eb9279475b1ab6209a31f (patch) | |
tree | ca8c6dec0805076f0b5ba7c547e3cb2004e3aea2 /fs/proc/internal.h | |
parent | 0ee5623f9a6e52df90a78bd21179f8ab370e102e (diff) |
ns: proc files for namespace naming policy.
Create files under /proc/<pid>/ns/ to allow controlling the
namespaces of a process.
This addresses three specific problems that can make namespaces hard to
work with.
- Namespaces require a dedicated process to pin them in memory.
- It is not possible to use a namespace unless you are the child
of the original creator.
- Namespaces don't have names that userspace can use to talk about
them.
The namespace files under /proc/<pid>/ns/ can be opened and the
file descriptor can be used to talk about a specific namespace, and
to keep the specified namespace alive.
A namespace can be kept alive by either holding the file descriptor
open or bind mounting the file someplace else. aka:
mount --bind /proc/self/ns/net /some/filesystem/path
mount --bind /proc/self/fd/<N> /some/filesystem/path
This allows namespaces to be named with userspace policy.
It requires additional support to make use of these filedescriptors
and that will be comming in the following patches.
Acked-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/internal.h')
-rw-r--r-- | fs/proc/internal.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index c03e8d3a3a5b..96245a1b1a7c 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -119,3 +119,21 @@ struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); | |||
119 | */ | 119 | */ |
120 | int proc_readdir(struct file *, void *, filldir_t); | 120 | int proc_readdir(struct file *, void *, filldir_t); |
121 | struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); | 121 | struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); |
122 | |||
123 | |||
124 | |||
125 | /* Lookups */ | ||
126 | typedef struct dentry *instantiate_t(struct inode *, struct dentry *, | ||
127 | struct task_struct *, const void *); | ||
128 | int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir, | ||
129 | const char *name, int len, | ||
130 | instantiate_t instantiate, struct task_struct *task, const void *ptr); | ||
131 | int pid_revalidate(struct dentry *dentry, struct nameidata *nd); | ||
132 | struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task); | ||
133 | extern const struct dentry_operations pid_dentry_operations; | ||
134 | int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); | ||
135 | int proc_setattr(struct dentry *dentry, struct iattr *attr); | ||
136 | |||
137 | extern const struct inode_operations proc_ns_dir_inode_operations; | ||
138 | extern const struct file_operations proc_ns_dir_operations; | ||
139 | |||