mirror of
https://github.com/torvalds/linux.git
synced 2025-11-01 00:58:39 +02:00
time: support ns lookup
Support the generic ns lookup infrastructure to support file handles for namespaces. Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
488acdcec8
commit
b36c823b9a
3 changed files with 17 additions and 1 deletions
|
|
@ -33,6 +33,7 @@ struct time_namespace {
|
|||
extern struct time_namespace init_time_ns;
|
||||
|
||||
#ifdef CONFIG_TIME_NS
|
||||
void __init time_ns_init(void);
|
||||
extern int vdso_join_timens(struct task_struct *task,
|
||||
struct time_namespace *ns);
|
||||
extern void timens_commit(struct task_struct *tsk, struct time_namespace *ns);
|
||||
|
|
@ -108,6 +109,10 @@ static inline ktime_t timens_ktime_to_host(clockid_t clockid, ktime_t tim)
|
|||
}
|
||||
|
||||
#else
|
||||
static inline void __init time_ns_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int vdso_join_timens(struct task_struct *task,
|
||||
struct time_namespace *ns)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
#include <linux/randomize_kstack.h>
|
||||
#include <linux/pidfs.h>
|
||||
#include <linux/ptdump.h>
|
||||
#include <linux/time_namespace.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
|
|
@ -1072,6 +1073,7 @@ void start_kernel(void)
|
|||
fork_init();
|
||||
proc_caches_init();
|
||||
uts_ns_init();
|
||||
time_ns_init();
|
||||
key_init();
|
||||
security_init();
|
||||
dbg_late_init();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/seq_file.h>
|
||||
#include <linux/proc_ns.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/nstree.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/cred.h>
|
||||
|
|
@ -104,6 +105,7 @@ static struct time_namespace *clone_time_ns(struct user_namespace *user_ns,
|
|||
ns->user_ns = get_user_ns(user_ns);
|
||||
ns->offsets = old_ns->offsets;
|
||||
ns->frozen_offsets = false;
|
||||
ns_tree_add(ns);
|
||||
return ns;
|
||||
|
||||
fail_free_page:
|
||||
|
|
@ -250,11 +252,13 @@ static void timens_set_vvar_page(struct task_struct *task,
|
|||
|
||||
void free_time_ns(struct time_namespace *ns)
|
||||
{
|
||||
ns_tree_remove(ns);
|
||||
dec_time_namespaces(ns->ucounts);
|
||||
put_user_ns(ns->user_ns);
|
||||
ns_free_inum(&ns->ns);
|
||||
__free_page(ns->vvar_page);
|
||||
kfree(ns);
|
||||
/* Concurrent nstree traversal depends on a grace period. */
|
||||
kfree_rcu(ns, ns.ns_rcu);
|
||||
}
|
||||
|
||||
static struct time_namespace *to_time_ns(struct ns_common *ns)
|
||||
|
|
@ -487,3 +491,8 @@ struct time_namespace init_time_ns = {
|
|||
.ns.ops = &timens_operations,
|
||||
.frozen_offsets = true,
|
||||
};
|
||||
|
||||
void __init time_ns_init(void)
|
||||
{
|
||||
ns_tree_add(&init_time_ns);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue