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>
9 struct user_namespace
{
11 struct user_namespace
*parent
;
12 struct user_struct
*creator
;
13 struct work_struct destroyer
;
16 extern struct user_namespace init_user_ns
;
20 static inline struct user_namespace
*get_user_ns(struct user_namespace
*ns
)
27 extern int create_user_ns(struct cred
*new);
28 extern void free_user_ns(struct kref
*kref
);
30 static inline void put_user_ns(struct user_namespace
*ns
)
33 kref_put(&ns
->kref
, free_user_ns
);
36 uid_t
user_ns_map_uid(struct user_namespace
*to
, const struct cred
*cred
, uid_t uid
);
37 gid_t
user_ns_map_gid(struct user_namespace
*to
, const struct cred
*cred
, gid_t gid
);
41 static inline struct user_namespace
*get_user_ns(struct user_namespace
*ns
)
46 static inline int create_user_ns(struct cred
*new)
51 static inline void put_user_ns(struct user_namespace
*ns
)
55 static inline uid_t
user_ns_map_uid(struct user_namespace
*to
,
56 const struct cred
*cred
, uid_t uid
)
60 static inline gid_t
user_ns_map_gid(struct user_namespace
*to
,
61 const struct cred
*cred
, gid_t gid
)
68 #endif /* _LINUX_USER_H */