aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/proc_ns.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/proc_ns.h')
-rw-r--r--include/linux/proc_ns.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
index 2837ff41cfe3..42dfc615dbf8 100644
--- a/include/linux/proc_ns.h
+++ b/include/linux/proc_ns.h
@@ -4,9 +4,11 @@
4#ifndef _LINUX_PROC_NS_H 4#ifndef _LINUX_PROC_NS_H
5#define _LINUX_PROC_NS_H 5#define _LINUX_PROC_NS_H
6 6
7#include <linux/ns_common.h>
8
7struct pid_namespace; 9struct pid_namespace;
8struct nsproxy; 10struct nsproxy;
9struct ns_common; 11struct path;
10 12
11struct proc_ns_operations { 13struct proc_ns_operations {
12 const char *name; 14 const char *name;
@@ -38,35 +40,38 @@ enum {
38 40
39extern int pid_ns_prepare_proc(struct pid_namespace *ns); 41extern int pid_ns_prepare_proc(struct pid_namespace *ns);
40extern void pid_ns_release_proc(struct pid_namespace *ns); 42extern void pid_ns_release_proc(struct pid_namespace *ns);
41extern struct file *proc_ns_fget(int fd);
42extern struct ns_common *get_proc_ns(struct inode *);
43extern int proc_alloc_inum(unsigned int *pino); 43extern int proc_alloc_inum(unsigned int *pino);
44extern void proc_free_inum(unsigned int inum); 44extern void proc_free_inum(unsigned int inum);
45extern bool proc_ns_inode(struct inode *inode);
46 45
47#else /* CONFIG_PROC_FS */ 46#else /* CONFIG_PROC_FS */
48 47
49static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; } 48static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; }
50static inline void pid_ns_release_proc(struct pid_namespace *ns) {} 49static inline void pid_ns_release_proc(struct pid_namespace *ns) {}
51 50
52static inline struct file *proc_ns_fget(int fd)
53{
54 return ERR_PTR(-EINVAL);
55}
56
57static inline struct ns_common *get_proc_ns(struct inode *inode) { return NULL; }
58
59static inline int proc_alloc_inum(unsigned int *inum) 51static inline int proc_alloc_inum(unsigned int *inum)
60{ 52{
61 *inum = 1; 53 *inum = 1;
62 return 0; 54 return 0;
63} 55}
64static inline void proc_free_inum(unsigned int inum) {} 56static inline void proc_free_inum(unsigned int inum) {}
65static inline bool proc_ns_inode(struct inode *inode) { return false; }
66 57
67#endif /* CONFIG_PROC_FS */ 58#endif /* CONFIG_PROC_FS */
68 59
69#define ns_alloc_inum(ns) proc_alloc_inum(&(ns)->inum) 60static inline int ns_alloc_inum(struct ns_common *ns)
61{
62 atomic_long_set(&ns->stashed, 0);
63 return proc_alloc_inum(&ns->inum);
64}
65
70#define ns_free_inum(ns) proc_free_inum((ns)->inum) 66#define ns_free_inum(ns) proc_free_inum((ns)->inum)
71 67
68extern struct file *proc_ns_fget(int fd);
69#define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private)
70extern void *ns_get_path(struct path *path, struct task_struct *task,
71 const struct proc_ns_operations *ns_ops);
72
73extern int ns_get_name(char *buf, size_t size, struct task_struct *task,
74 const struct proc_ns_operations *ns_ops);
75extern void nsfs_init(void);
76
72#endif /* _LINUX_PROC_NS_H */ 77#endif /* _LINUX_PROC_NS_H */