2005-04-16 15:20:36 -07:00
|
|
|
#ifndef _LINUX_UTSNAME_H
|
|
|
|
|
#define _LINUX_UTSNAME_H
|
|
|
|
|
|
2006-10-04 02:15:19 -07:00
|
|
|
|
|
|
|
|
#include <linux/sched.h>
|
|
|
|
|
#include <linux/kref.h>
|
|
|
|
|
#include <linux/nsproxy.h>
|
2008-02-08 04:18:21 -08:00
|
|
|
#include <linux/err.h>
|
2012-10-13 10:46:48 +01:00
|
|
|
#include <uapi/linux/utsname.h>
|
2006-10-04 02:15:19 -07:00
|
|
|
|
2011-11-02 13:39:22 -07:00
|
|
|
enum uts_proc {
|
|
|
|
|
UTS_PROC_OSTYPE,
|
|
|
|
|
UTS_PROC_OSRELEASE,
|
|
|
|
|
UTS_PROC_VERSION,
|
|
|
|
|
UTS_PROC_HOSTNAME,
|
|
|
|
|
UTS_PROC_DOMAINNAME,
|
|
|
|
|
};
|
|
|
|
|
|
2011-03-23 16:43:16 -07:00
|
|
|
struct user_namespace;
|
|
|
|
|
extern struct user_namespace init_user_ns;
|
|
|
|
|
|
2006-10-02 02:18:14 -07:00
|
|
|
struct uts_namespace {
|
|
|
|
|
struct kref kref;
|
|
|
|
|
struct new_utsname name;
|
2011-03-23 16:43:16 -07:00
|
|
|
struct user_namespace *user_ns;
|
2011-06-15 10:21:48 -07:00
|
|
|
unsigned int proc_inum;
|
2006-10-02 02:18:14 -07:00
|
|
|
};
|
|
|
|
|
extern struct uts_namespace init_uts_ns;
|
|
|
|
|
|
2008-02-08 04:18:21 -08:00
|
|
|
#ifdef CONFIG_UTS_NS
|
2006-10-02 02:18:14 -07:00
|
|
|
static inline void get_uts_ns(struct uts_namespace *ns)
|
|
|
|
|
{
|
|
|
|
|
kref_get(&ns->kref);
|
|
|
|
|
}
|
|
|
|
|
|
2007-07-15 23:41:15 -07:00
|
|
|
extern struct uts_namespace *copy_utsname(unsigned long flags,
|
2012-07-26 04:02:49 -07:00
|
|
|
struct user_namespace *user_ns, struct uts_namespace *old_ns);
|
2006-10-02 02:18:14 -07:00
|
|
|
extern void free_uts_ns(struct kref *kref);
|
|
|
|
|
|
|
|
|
|
static inline void put_uts_ns(struct uts_namespace *ns)
|
|
|
|
|
{
|
|
|
|
|
kref_put(&ns->kref, free_uts_ns);
|
|
|
|
|
}
|
2008-02-08 04:18:21 -08:00
|
|
|
#else
|
|
|
|
|
static inline void get_uts_ns(struct uts_namespace *ns)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void put_uts_ns(struct uts_namespace *ns)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct uts_namespace *copy_utsname(unsigned long flags,
|
2012-07-26 04:02:49 -07:00
|
|
|
struct user_namespace *user_ns, struct uts_namespace *old_ns)
|
2008-02-08 04:18:21 -08:00
|
|
|
{
|
|
|
|
|
if (flags & CLONE_NEWUTS)
|
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
2012-07-26 04:02:49 -07:00
|
|
|
return old_ns;
|
2008-02-08 04:18:21 -08:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2011-11-02 13:39:22 -07:00
|
|
|
#ifdef CONFIG_PROC_SYSCTL
|
|
|
|
|
extern void uts_proc_notify(enum uts_proc proc);
|
|
|
|
|
#else
|
|
|
|
|
static inline void uts_proc_notify(enum uts_proc proc)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-10-02 02:18:10 -07:00
|
|
|
static inline struct new_utsname *utsname(void)
|
|
|
|
|
{
|
2006-10-02 02:18:14 -07:00
|
|
|
return ¤t->nsproxy->uts_ns->name;
|
2006-10-02 02:18:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct new_utsname *init_utsname(void)
|
|
|
|
|
{
|
2006-10-02 02:18:14 -07:00
|
|
|
return &init_uts_ns.name;
|
2006-10-02 02:18:10 -07:00
|
|
|
}
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
extern struct rw_semaphore uts_sem;
|
2006-10-04 02:15:19 -07:00
|
|
|
|
|
|
|
|
#endif /* _LINUX_UTSNAME_H */
|