Lines Matching defs:ns

59 static struct ucounts *inc_time_namespaces(struct user_namespace *ns)
61 return inc_ucount(ns, current_euid(), UCOUNT_TIME_NAMESPACES);
81 struct time_namespace *ns;
91 ns = kmalloc(sizeof(*ns), GFP_KERNEL_ACCOUNT);
92 if (!ns)
95 refcount_set(&ns->ns.count, 1);
97 ns->vvar_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
98 if (!ns->vvar_page)
101 err = ns_alloc_inum(&ns->ns);
105 ns->ucounts = ucounts;
106 ns->ns.ops = &timens_operations;
107 ns->user_ns = get_user_ns(user_ns);
108 ns->offsets = old_ns->offsets;
109 ns->frozen_offsets = false;
110 return ns;
113 __free_page(ns->vvar_page);
115 kfree(ns);
180 struct time_namespace *ns)
183 struct timens_offset monotonic = offset_from_ts(ns->offsets.monotonic);
184 struct timens_offset boottime = offset_from_ts(ns->offsets.boottime);
220 struct time_namespace *ns)
225 if (ns == &init_time_ns)
229 if (likely(ns->frozen_offsets))
234 if (ns->frozen_offsets)
237 ns->frozen_offsets = true;
238 vdata = arch_get_vdso_data(page_address(ns->vvar_page));
241 timens_setup_vdso_data(&vdata[i], ns);
247 void free_time_ns(struct time_namespace *ns)
249 dec_time_namespaces(ns->ucounts);
250 put_user_ns(ns->user_ns);
251 ns_free_inum(&ns->ns);
252 __free_page(ns->vvar_page);
253 kfree(ns);
256 static struct time_namespace *to_time_ns(struct ns_common *ns)
258 return container_of(ns, struct time_namespace, ns);
263 struct time_namespace *ns = NULL;
269 ns = nsproxy->time_ns;
270 get_time_ns(ns);
274 return ns ? &ns->ns : NULL;
279 struct time_namespace *ns = NULL;
285 ns = nsproxy->time_ns_for_children;
286 get_time_ns(ns);
290 return ns ? &ns->ns : NULL;
293 static void timens_put(struct ns_common *ns)
295 put_time_ns(to_time_ns(ns));
298 void timens_commit(struct task_struct *tsk, struct time_namespace *ns)
300 timens_set_vvar_page(tsk, ns);
301 vdso_join_timens(tsk, ns);
307 struct time_namespace *ns = to_time_ns(new);
312 if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) ||
316 get_time_ns(ns);
318 nsproxy->time_ns = ns;
320 get_time_ns(ns);
322 nsproxy->time_ns_for_children = ns;
328 struct ns_common *nsc = &nsproxy->time_ns_for_children->ns;
329 struct time_namespace *ns = to_time_ns(nsc);
335 get_time_ns(ns);
337 nsproxy->time_ns = ns;
339 timens_commit(tsk, ns);
342 static struct user_namespace *timens_owner(struct ns_common *ns)
344 return to_time_ns(ns)->user_ns;
367 struct ns_common *ns;
370 ns = timens_for_children_get(p);
371 if (!ns)
373 time_ns = to_time_ns(ns);
383 struct ns_common *ns;
388 ns = timens_for_children_get(p);
389 if (!ns)
391 time_ns = to_time_ns(ns);
480 .ns.count = REFCOUNT_INIT(3),
482 .ns.inum = PROC_TIME_INIT_INO,
483 .ns.ops = &timens_operations,