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>
This commit is contained in:
@@ -119,3 +119,21 @@ struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *);
|
||||
*/
|
||||
int proc_readdir(struct file *, void *, filldir_t);
|
||||
struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
|
||||
|
||||
|
||||
|
||||
/* Lookups */
|
||||
typedef struct dentry *instantiate_t(struct inode *, struct dentry *,
|
||||
struct task_struct *, const void *);
|
||||
int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
|
||||
const char *name, int len,
|
||||
instantiate_t instantiate, struct task_struct *task, const void *ptr);
|
||||
int pid_revalidate(struct dentry *dentry, struct nameidata *nd);
|
||||
struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task);
|
||||
extern const struct dentry_operations pid_dentry_operations;
|
||||
int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
|
||||
int proc_setattr(struct dentry *dentry, struct iattr *attr);
|
||||
|
||||
extern const struct inode_operations proc_ns_dir_inode_operations;
|
||||
extern const struct file_operations proc_ns_dir_operations;
|
||||
|
||||
|
Reference in New Issue
Block a user