move wm8400-regulator's probe function to .devinit.text
[linux-2.6/sactl.git] / include / linux / user_namespace.h
blob315bcd375224869a0e54cbaab27274588452d4d3
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 *creator;
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 int create_user_ns(struct cred *new);
30 extern void free_user_ns(struct kref *kref);
32 static inline void put_user_ns(struct user_namespace *ns)
34 if (ns)
35 kref_put(&ns->kref, free_user_ns);
38 #else
40 static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
42 return &init_user_ns;
45 static inline int create_user_ns(struct cred *new)
47 return -EINVAL;
50 static inline void put_user_ns(struct user_namespace *ns)
54 #endif
56 #endif /* _LINUX_USER_H */