nlm: Ensure callback code also checks that the files match
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / utsname.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX_UTSNAME_H
2#define _LINUX_UTSNAME_H
3
b119f13f
CLG
4
5#include <linux/sched.h>
6#include <linux/kref.h>
7#include <linux/nsproxy.h>
58bfdd6d 8#include <linux/err.h>
607ca46e 9#include <uapi/linux/utsname.h>
b119f13f 10
f1ecf068
LDM
11enum uts_proc {
12 UTS_PROC_OSTYPE,
13 UTS_PROC_OSRELEASE,
14 UTS_PROC_VERSION,
15 UTS_PROC_HOSTNAME,
16 UTS_PROC_DOMAINNAME,
17};
18
59607db3
SH
19struct user_namespace;
20extern struct user_namespace init_user_ns;
21
4865ecf1
SH
22struct uts_namespace {
23 struct kref kref;
24 struct new_utsname name;
59607db3 25 struct user_namespace *user_ns;
98f842e6 26 unsigned int proc_inum;
4865ecf1
SH
27};
28extern struct uts_namespace init_uts_ns;
29
58bfdd6d 30#ifdef CONFIG_UTS_NS
4865ecf1
SH
31static inline void get_uts_ns(struct uts_namespace *ns)
32{
33 kref_get(&ns->kref);
34}
35
213dd266 36extern struct uts_namespace *copy_utsname(unsigned long flags,
bcf58e72 37 struct user_namespace *user_ns, struct uts_namespace *old_ns);
4865ecf1
SH
38extern void free_uts_ns(struct kref *kref);
39
40static inline void put_uts_ns(struct uts_namespace *ns)
41{
42 kref_put(&ns->kref, free_uts_ns);
43}
58bfdd6d
PE
44#else
45static inline void get_uts_ns(struct uts_namespace *ns)
46{
47}
48
49static inline void put_uts_ns(struct uts_namespace *ns)
50{
51}
52
53static inline struct uts_namespace *copy_utsname(unsigned long flags,
bcf58e72 54 struct user_namespace *user_ns, struct uts_namespace *old_ns)
58bfdd6d
PE
55{
56 if (flags & CLONE_NEWUTS)
57 return ERR_PTR(-EINVAL);
58
bcf58e72 59 return old_ns;
58bfdd6d
PE
60}
61#endif
62
f1ecf068
LDM
63#ifdef CONFIG_PROC_SYSCTL
64extern void uts_proc_notify(enum uts_proc proc);
65#else
66static inline void uts_proc_notify(enum uts_proc proc)
67{
68}
69#endif
70
0bdd7aab
SH
71static inline struct new_utsname *utsname(void)
72{
4865ecf1 73 return &current->nsproxy->uts_ns->name;
0bdd7aab
SH
74}
75
76static inline struct new_utsname *init_utsname(void)
77{
4865ecf1 78 return &init_uts_ns.name;
0bdd7aab
SH
79}
80
1da177e4 81extern struct rw_semaphore uts_sem;
b119f13f 82
b119f13f 83#endif /* _LINUX_UTSNAME_H */