Lines Matching refs:ucounts

121 static struct ucounts *find_ucounts(struct user_namespace *ns, kuid_t uid, struct hlist_head *hashe…  in find_ucounts()
123 struct ucounts *ucounts; in find_ucounts() local
125 hlist_for_each_entry(ucounts, hashent, node) { in find_ucounts()
126 if (uid_eq(ucounts->uid, uid) && (ucounts->ns == ns)) in find_ucounts()
127 return ucounts; in find_ucounts()
132 static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid) in get_ucounts()
135 struct ucounts *ucounts, *new; in get_ucounts() local
138 ucounts = find_ucounts(ns, uid, hashent); in get_ucounts()
139 if (!ucounts) { in get_ucounts()
151 ucounts = find_ucounts(ns, uid, hashent); in get_ucounts()
152 if (ucounts) { in get_ucounts()
156 ucounts = new; in get_ucounts()
159 if (ucounts->count == INT_MAX) in get_ucounts()
160 ucounts = NULL; in get_ucounts()
162 ucounts->count += 1; in get_ucounts()
164 return ucounts; in get_ucounts()
167 static void put_ucounts(struct ucounts *ucounts) in put_ucounts() argument
172 ucounts->count -= 1; in put_ucounts()
173 if (!ucounts->count) in put_ucounts()
174 hlist_del_init(&ucounts->node); in put_ucounts()
176 ucounts = NULL; in put_ucounts()
179 kfree(ucounts); in put_ucounts()
196 struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, in inc_ucount()
199 struct ucounts *ucounts, *iter, *bad; in inc_ucount() local
201 ucounts = get_ucounts(ns, uid); in inc_ucount()
202 for (iter = ucounts; iter; iter = tns->ucounts) { in inc_ucount()
209 return ucounts; in inc_ucount()
212 for (iter = ucounts; iter != bad; iter = iter->ns->ucounts) in inc_ucount()
215 put_ucounts(ucounts); in inc_ucount()
219 void dec_ucount(struct ucounts *ucounts, enum ucount_type type) in dec_ucount() argument
221 struct ucounts *iter; in dec_ucount()
222 for (iter = ucounts; iter; iter = iter->ns->ucounts) { in dec_ucount()
226 put_ucounts(ucounts); in dec_ucount()