Merge head 'drm-3264' of master.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6
[deliverable/linux.git] / include / linux / namespace.h
CommitLineData
1da177e4
LT
1#ifndef _NAMESPACE_H_
2#define _NAMESPACE_H_
3#ifdef __KERNEL__
4
5#include <linux/mount.h>
6#include <linux/sched.h>
7
8struct namespace {
9 atomic_t count;
10 struct vfsmount * root;
11 struct list_head list;
12 struct rw_semaphore sem;
13};
14
1da177e4
LT
15extern int copy_namespace(int, struct task_struct *);
16extern void __put_namespace(struct namespace *namespace);
17
18static inline void put_namespace(struct namespace *namespace)
19{
1ce88cf4
MS
20 if (atomic_dec_and_lock(&namespace->count, &vfsmount_lock))
21 /* releases vfsmount_lock */
1da177e4
LT
22 __put_namespace(namespace);
23}
24
25static inline void exit_namespace(struct task_struct *p)
26{
27 struct namespace *namespace = p->namespace;
28 if (namespace) {
29 task_lock(p);
30 p->namespace = NULL;
31 task_unlock(p);
32 put_namespace(namespace);
33 }
34}
35
36static inline void get_namespace(struct namespace *namespace)
37{
38 atomic_inc(&namespace->count);
39}
40
41#endif
42#endif
This page took 0.0631 seconds and 5 git commands to generate.