aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/user_namespace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/user_namespace.h')
-rw-r--r--include/linux/user_namespace.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index faf467944baf..4e72922e5a75 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -6,14 +6,24 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/err.h> 7#include <linux/err.h>
8 8
9#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 7) 9#define UID_GID_MAP_MAX_EXTENTS 5
10#define UIDHASH_SZ (1 << UIDHASH_BITS) 10
11struct uid_gid_map { /* 64 bytes -- 1 cache line */
12 u32 nr_extents;
13 struct uid_gid_extent {
14 u32 first;
15 u32 lower_first;
16 u32 count;
17 } extent[UID_GID_MAP_MAX_EXTENTS];
18};
11 19
12struct user_namespace { 20struct user_namespace {
21 struct uid_gid_map uid_map;
22 struct uid_gid_map gid_map;
13 struct kref kref; 23 struct kref kref;
14 struct hlist_head uidhash_table[UIDHASH_SZ]; 24 struct user_namespace *parent;
15 struct user_struct *creator; 25 kuid_t owner;
16 struct work_struct destroyer; 26 kgid_t group;
17}; 27};
18 28
19extern struct user_namespace init_user_ns; 29extern struct user_namespace init_user_ns;
@@ -36,9 +46,11 @@ static inline void put_user_ns(struct user_namespace *ns)
36 kref_put(&ns->kref, free_user_ns); 46 kref_put(&ns->kref, free_user_ns);
37} 47}
38 48
39uid_t user_ns_map_uid(struct user_namespace *to, const struct cred *cred, uid_t uid); 49struct seq_operations;
40gid_t user_ns_map_gid(struct user_namespace *to, const struct cred *cred, gid_t gid); 50extern struct seq_operations proc_uid_seq_operations;
41 51extern struct seq_operations proc_gid_seq_operations;
52extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
53extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
42#else 54#else
43 55
44static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 56static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
@@ -55,17 +67,6 @@ static inline void put_user_ns(struct user_namespace *ns)
55{ 67{
56} 68}
57 69
58static inline uid_t user_ns_map_uid(struct user_namespace *to,
59 const struct cred *cred, uid_t uid)
60{
61 return uid;
62}
63static inline gid_t user_ns_map_gid(struct user_namespace *to,
64 const struct cred *cred, gid_t gid)
65{
66 return gid;
67}
68
69#endif 70#endif
70 71
71#endif /* _LINUX_USER_H */ 72#endif /* _LINUX_USER_H */