2 * procfs namespace bits
4 #ifndef _LINUX_PROC_NS_H
5 #define _LINUX_PROC_NS_H
10 struct proc_ns_operations {
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);
21 const struct proc_ns_operations *ns_ops;
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;
32 * We always define these enumerators
36 PROC_IPC_INIT_INO = 0xEFFFFFFFU,
37 PROC_UTS_INIT_INO = 0xEFFFFFFEU,
38 PROC_USER_INIT_INO = 0xEFFFFFFDU,
39 PROC_PID_INIT_INO = 0xEFFFFFFCU,
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);
52 #else /* CONFIG_PROC_FS */
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) {}
57 static inline struct file *proc_ns_fget(int fd)
59 return ERR_PTR(-EINVAL);
62 static inline struct proc_ns *get_proc_ns(struct inode *inode) { return NULL; }
64 static inline int proc_alloc_inum(unsigned int *inum)
69 static inline void proc_free_inum(unsigned int inum) {}
70 static inline bool proc_ns_inode(struct inode *inode) { return false; }
72 #endif /* CONFIG_PROC_FS */
74 #endif /* _LINUX_PROC_NS_H */