Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 065a6d68c71af2a3bdd080fa5aa353b76eede8f5 56 lines 1.1 kB view raw
1#ifndef _LINUX_USER_NAMESPACE_H 2#define _LINUX_USER_NAMESPACE_H 3 4#include <linux/kref.h> 5#include <linux/nsproxy.h> 6#include <linux/sched.h> 7#include <linux/err.h> 8 9#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 8) 10#define UIDHASH_SZ (1 << UIDHASH_BITS) 11 12struct user_namespace { 13 struct kref kref; 14 struct hlist_head uidhash_table[UIDHASH_SZ]; 15 struct user_struct *creator; 16}; 17 18extern struct user_namespace init_user_ns; 19 20#ifdef CONFIG_USER_NS 21 22static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 23{ 24 if (ns) 25 kref_get(&ns->kref); 26 return ns; 27} 28 29extern int create_user_ns(struct cred *new); 30extern void free_user_ns(struct kref *kref); 31 32static inline void put_user_ns(struct user_namespace *ns) 33{ 34 if (ns) 35 kref_put(&ns->kref, free_user_ns); 36} 37 38#else 39 40static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 41{ 42 return &init_user_ns; 43} 44 45static inline int create_user_ns(struct cred *new) 46{ 47 return -EINVAL; 48} 49 50static inline void put_user_ns(struct user_namespace *ns) 51{ 52} 53 54#endif 55 56#endif /* _LINUX_USER_H */