• Home
  • Raw
  • Download

Lines Matching refs:ucounts

11 struct ucounts init_ucounts = {
134 static struct ucounts *find_ucounts(struct user_namespace *ns, kuid_t uid, struct hlist_head *hashe… in find_ucounts()
136 struct ucounts *ucounts; in find_ucounts() local
138 hlist_for_each_entry(ucounts, hashent, node) { in find_ucounts()
139 if (uid_eq(ucounts->uid, uid) && (ucounts->ns == ns)) in find_ucounts()
140 return ucounts; in find_ucounts()
145 static void hlist_add_ucounts(struct ucounts *ucounts) in hlist_add_ucounts() argument
147 struct hlist_head *hashent = ucounts_hashentry(ucounts->ns, ucounts->uid); in hlist_add_ucounts()
149 hlist_add_head(&ucounts->node, hashent); in hlist_add_ucounts()
153 struct ucounts *get_ucounts(struct ucounts *ucounts) in get_ucounts() argument
155 if (ucounts && atomic_add_negative(1, &ucounts->count)) { in get_ucounts()
156 put_ucounts(ucounts); in get_ucounts()
157 ucounts = NULL; in get_ucounts()
159 return ucounts; in get_ucounts()
162 struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) in alloc_ucounts()
165 struct ucounts *ucounts, *new; in alloc_ucounts() local
169 ucounts = find_ucounts(ns, uid, hashent); in alloc_ucounts()
170 if (!ucounts) { in alloc_ucounts()
182 ucounts = find_ucounts(ns, uid, hashent); in alloc_ucounts()
183 if (ucounts) { in alloc_ucounts()
192 overflow = atomic_add_negative(1, &ucounts->count); in alloc_ucounts()
195 put_ucounts(ucounts); in alloc_ucounts()
198 return ucounts; in alloc_ucounts()
201 void put_ucounts(struct ucounts *ucounts) in put_ucounts() argument
205 if (atomic_dec_and_lock_irqsave(&ucounts->count, &ucounts_lock, flags)) { in put_ucounts()
206 hlist_del_init(&ucounts->node); in put_ucounts()
208 put_user_ns(ucounts->ns); in put_ucounts()
209 kfree(ucounts); in put_ucounts()
227 struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, in inc_ucount()
230 struct ucounts *ucounts, *iter, *bad; in inc_ucount() local
232 ucounts = alloc_ucounts(ns, uid); in inc_ucount()
233 for (iter = ucounts; iter; iter = tns->ucounts) { in inc_ucount()
240 return ucounts; in inc_ucount()
243 for (iter = ucounts; iter != bad; iter = iter->ns->ucounts) in inc_ucount()
246 put_ucounts(ucounts); in inc_ucount()
250 void dec_ucount(struct ucounts *ucounts, enum ucount_type type) in dec_ucount() argument
252 struct ucounts *iter; in dec_ucount()
253 for (iter = ucounts; iter; iter = iter->ns->ucounts) { in dec_ucount()
257 put_ucounts(ucounts); in dec_ucount()
260 long inc_rlimit_ucounts(struct ucounts *ucounts, enum ucount_type type, long v) in inc_rlimit_ucounts() argument
262 struct ucounts *iter; in inc_rlimit_ucounts()
266 for (iter = ucounts; iter; iter = iter->ns->ucounts) { in inc_rlimit_ucounts()
270 else if (iter == ucounts) in inc_rlimit_ucounts()
277 bool dec_rlimit_ucounts(struct ucounts *ucounts, enum ucount_type type, long v) in dec_rlimit_ucounts() argument
279 struct ucounts *iter; in dec_rlimit_ucounts()
281 for (iter = ucounts; iter; iter = iter->ns->ucounts) { in dec_rlimit_ucounts()
284 if (iter == ucounts) in dec_rlimit_ucounts()
290 static void do_dec_rlimit_put_ucounts(struct ucounts *ucounts, in do_dec_rlimit_put_ucounts() argument
291 struct ucounts *last, enum ucount_type type) in do_dec_rlimit_put_ucounts()
293 struct ucounts *iter, *next; in do_dec_rlimit_put_ucounts()
294 for (iter = ucounts; iter != last; iter = next) { in do_dec_rlimit_put_ucounts()
297 next = iter->ns->ucounts; in do_dec_rlimit_put_ucounts()
303 void dec_rlimit_put_ucounts(struct ucounts *ucounts, enum ucount_type type) in dec_rlimit_put_ucounts() argument
305 do_dec_rlimit_put_ucounts(ucounts, NULL, type); in dec_rlimit_put_ucounts()
308 long inc_rlimit_get_ucounts(struct ucounts *ucounts, enum ucount_type type) in inc_rlimit_get_ucounts() argument
311 struct ucounts *iter; in inc_rlimit_get_ucounts()
315 for (iter = ucounts; iter; iter = iter->ns->ucounts) { in inc_rlimit_get_ucounts()
319 if (iter == ucounts) in inc_rlimit_get_ucounts()
336 do_dec_rlimit_put_ucounts(ucounts, iter, type); in inc_rlimit_get_ucounts()
340 bool is_ucounts_overlimit(struct ucounts *ucounts, enum ucount_type type, unsigned long rlimit) in is_ucounts_overlimit() argument
342 struct ucounts *iter; in is_ucounts_overlimit()
346 for (iter = ucounts; iter; iter = iter->ns->ucounts) { in is_ucounts_overlimit()