bury struct proc_ns in fs/proc
[linux-2.6-block.git] / include / linux / proc_ns.h
CommitLineData
0bb80f24
DH
1/*
2 * procfs namespace bits
3 */
4#ifndef _LINUX_PROC_NS_H
5#define _LINUX_PROC_NS_H
6
7struct pid_namespace;
8struct nsproxy;
64964528 9struct ns_common;
0bb80f24
DH
10
11struct proc_ns_operations {
12 const char *name;
13 int type;
64964528
AV
14 struct ns_common *(*get)(struct task_struct *task);
15 void (*put)(struct ns_common *ns);
16 int (*install)(struct nsproxy *nsproxy, struct ns_common *ns);
0bb80f24
DH
17};
18
0bb80f24
DH
19extern const struct proc_ns_operations netns_operations;
20extern const struct proc_ns_operations utsns_operations;
21extern const struct proc_ns_operations ipcns_operations;
22extern const struct proc_ns_operations pidns_operations;
23extern const struct proc_ns_operations userns_operations;
24extern const struct proc_ns_operations mntns_operations;
25
26/*
27 * We always define these enumerators
28 */
29enum {
30 PROC_ROOT_INO = 1,
31 PROC_IPC_INIT_INO = 0xEFFFFFFFU,
32 PROC_UTS_INIT_INO = 0xEFFFFFFEU,
33 PROC_USER_INIT_INO = 0xEFFFFFFDU,
34 PROC_PID_INIT_INO = 0xEFFFFFFCU,
35};
36
37#ifdef CONFIG_PROC_FS
38
39extern int pid_ns_prepare_proc(struct pid_namespace *ns);
40extern void pid_ns_release_proc(struct pid_namespace *ns);
41extern struct file *proc_ns_fget(int fd);
f77c8014 42extern struct ns_common *get_proc_ns(struct inode *);
0bb80f24
DH
43extern int proc_alloc_inum(unsigned int *pino);
44extern void proc_free_inum(unsigned int inum);
45extern bool proc_ns_inode(struct inode *inode);
46
47#else /* CONFIG_PROC_FS */
48
49static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; }
50static inline void pid_ns_release_proc(struct pid_namespace *ns) {}
51
52static inline struct file *proc_ns_fget(int fd)
53{
54 return ERR_PTR(-EINVAL);
55}
56
f77c8014 57static inline struct ns_common *get_proc_ns(struct inode *inode) { return NULL; }
0bb80f24
DH
58
59static inline int proc_alloc_inum(unsigned int *inum)
60{
61 *inum = 1;
62 return 0;
63}
64static inline void proc_free_inum(unsigned int inum) {}
65static inline bool proc_ns_inode(struct inode *inode) { return false; }
66
67#endif /* CONFIG_PROC_FS */
68
6344c433
AV
69#define ns_alloc_inum(ns) proc_alloc_inum(&(ns)->inum)
70#define ns_free_inum(ns) proc_free_inum((ns)->inum)
71
0bb80f24 72#endif /* _LINUX_PROC_NS_H */