This source file includes following definitions.
- put_nsproxy
- get_nsproxy
1
2 #ifndef _LINUX_NSPROXY_H
3 #define _LINUX_NSPROXY_H
4
5 #include <linux/spinlock.h>
6 #include <linux/sched.h>
7
8 struct mnt_namespace;
9 struct uts_namespace;
10 struct ipc_namespace;
11 struct pid_namespace;
12 struct cgroup_namespace;
13 struct fs_struct;
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 struct nsproxy {
32 atomic_t count;
33 struct uts_namespace *uts_ns;
34 struct ipc_namespace *ipc_ns;
35 struct mnt_namespace *mnt_ns;
36 struct pid_namespace *pid_ns_for_children;
37 struct net *net_ns;
38 struct cgroup_namespace *cgroup_ns;
39 };
40 extern struct nsproxy init_nsproxy;
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 int copy_namespaces(unsigned long flags, struct task_struct *tsk);
69 void exit_task_namespaces(struct task_struct *tsk);
70 void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
71 void free_nsproxy(struct nsproxy *ns);
72 int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
73 struct cred *, struct fs_struct *);
74 int __init nsproxy_cache_init(void);
75
76 static inline void put_nsproxy(struct nsproxy *ns)
77 {
78 if (atomic_dec_and_test(&ns->count)) {
79 free_nsproxy(ns);
80 }
81 }
82
83 static inline void get_nsproxy(struct nsproxy *ns)
84 {
85 atomic_inc(&ns->count);
86 }
87
88 #endif