Lines Matching refs:ns
20 static struct ucounts *inc_uts_namespaces(struct user_namespace *ns) in inc_uts_namespaces() argument
22 return inc_ucount(ns, current_euid(), UCOUNT_UTS_NAMESPACES); in inc_uts_namespaces()
36 refcount_set(&uts_ns->ns.count, 1); in create_uts_ns()
48 struct uts_namespace *ns; in clone_uts_ns() local
58 ns = create_uts_ns(); in clone_uts_ns()
59 if (!ns) in clone_uts_ns()
62 err = ns_alloc_inum(&ns->ns); in clone_uts_ns()
66 ns->ucounts = ucounts; in clone_uts_ns()
67 ns->ns.ops = &utsns_operations; in clone_uts_ns()
70 memcpy(&ns->name, &old_ns->name, sizeof(ns->name)); in clone_uts_ns()
71 ns->user_ns = get_user_ns(user_ns); in clone_uts_ns()
73 return ns; in clone_uts_ns()
76 kmem_cache_free(uts_ns_cache, ns); in clone_uts_ns()
106 void free_uts_ns(struct uts_namespace *ns) in free_uts_ns() argument
108 dec_uts_namespaces(ns->ucounts); in free_uts_ns()
109 put_user_ns(ns->user_ns); in free_uts_ns()
110 ns_free_inum(&ns->ns); in free_uts_ns()
111 kmem_cache_free(uts_ns_cache, ns); in free_uts_ns()
114 static inline struct uts_namespace *to_uts_ns(struct ns_common *ns) in to_uts_ns() argument
116 return container_of(ns, struct uts_namespace, ns); in to_uts_ns()
121 struct uts_namespace *ns = NULL; in utsns_get() local
127 ns = nsproxy->uts_ns; in utsns_get()
128 get_uts_ns(ns); in utsns_get()
132 return ns ? &ns->ns : NULL; in utsns_get()
135 static void utsns_put(struct ns_common *ns) in utsns_put() argument
137 put_uts_ns(to_uts_ns(ns)); in utsns_put()
143 struct uts_namespace *ns = to_uts_ns(new); in utsns_install() local
145 if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || in utsns_install()
149 get_uts_ns(ns); in utsns_install()
151 nsproxy->uts_ns = ns; in utsns_install()
155 static struct user_namespace *utsns_owner(struct ns_common *ns) in utsns_owner() argument
157 return to_uts_ns(ns)->user_ns; in utsns_owner()