UAPI: (Scripted) Disintegrate include/linux
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / utsname.h
1 #ifndef _LINUX_UTSNAME_H
2 #define _LINUX_UTSNAME_H
3
4
5 #include <linux/sched.h>
6 #include <linux/kref.h>
7 #include <linux/nsproxy.h>
8 #include <linux/err.h>
9 #include <uapi/linux/utsname.h>
10
11 enum uts_proc {
12 UTS_PROC_OSTYPE,
13 UTS_PROC_OSRELEASE,
14 UTS_PROC_VERSION,
15 UTS_PROC_HOSTNAME,
16 UTS_PROC_DOMAINNAME,
17 };
18
19 struct user_namespace;
20 extern struct user_namespace init_user_ns;
21
22 struct uts_namespace {
23 struct kref kref;
24 struct new_utsname name;
25 struct user_namespace *user_ns;
26 };
27 extern struct uts_namespace init_uts_ns;
28
29 #ifdef CONFIG_UTS_NS
30 static inline void get_uts_ns(struct uts_namespace *ns)
31 {
32 kref_get(&ns->kref);
33 }
34
35 extern struct uts_namespace *copy_utsname(unsigned long flags,
36 struct task_struct *tsk);
37 extern void free_uts_ns(struct kref *kref);
38
39 static inline void put_uts_ns(struct uts_namespace *ns)
40 {
41 kref_put(&ns->kref, free_uts_ns);
42 }
43 #else
44 static inline void get_uts_ns(struct uts_namespace *ns)
45 {
46 }
47
48 static inline void put_uts_ns(struct uts_namespace *ns)
49 {
50 }
51
52 static inline struct uts_namespace *copy_utsname(unsigned long flags,
53 struct task_struct *tsk)
54 {
55 if (flags & CLONE_NEWUTS)
56 return ERR_PTR(-EINVAL);
57
58 return tsk->nsproxy->uts_ns;
59 }
60 #endif
61
62 #ifdef CONFIG_PROC_SYSCTL
63 extern void uts_proc_notify(enum uts_proc proc);
64 #else
65 static inline void uts_proc_notify(enum uts_proc proc)
66 {
67 }
68 #endif
69
70 static inline struct new_utsname *utsname(void)
71 {
72 return &current->nsproxy->uts_ns->name;
73 }
74
75 static inline struct new_utsname *init_utsname(void)
76 {
77 return &init_uts_ns.name;
78 }
79
80 extern struct rw_semaphore uts_sem;
81
82 #endif /* _LINUX_UTSNAME_H */