x86: local.h fix checkpatch warnings
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / linux / user_namespace.h
blobb5f41d4c2eec71a3d3c786128f0f980f0b41317d
1 #ifndef _LINUX_USER_NAMESPACE_H
2 #define _LINUX_USER_NAMESPACE_H
4 #include <linux/kref.h>
5 #include <linux/nsproxy.h>
6 #include <linux/sched.h>
7 #include <linux/err.h>
9 #define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 8)
10 #define UIDHASH_SZ (1 << UIDHASH_BITS)
12 struct user_namespace {
13 struct kref kref;
14 struct hlist_head uidhash_table[UIDHASH_SZ];
15 struct user_struct *root_user;
18 extern struct user_namespace init_user_ns;
20 #ifdef CONFIG_USER_NS
22 static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
24 if (ns)
25 kref_get(&ns->kref);
26 return ns;
29 extern struct user_namespace *copy_user_ns(int flags,
30 struct user_namespace *old_ns);
31 extern void free_user_ns(struct kref *kref);
33 static inline void put_user_ns(struct user_namespace *ns)
35 if (ns)
36 kref_put(&ns->kref, free_user_ns);
39 #else
41 static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
43 return &init_user_ns;
46 static inline struct user_namespace *copy_user_ns(int flags,
47 struct user_namespace *old_ns)
49 if (flags & CLONE_NEWUSER)
50 return ERR_PTR(-EINVAL);
52 return old_ns;
55 static inline void put_user_ns(struct user_namespace *ns)
59 #endif
61 #endif /* _LINUX_USER_H */