Lines Matching refs:ucounts
117 static struct ucounts *find_ucounts(struct user_namespace *ns, kuid_t uid, struct hlist_head *hashe… in find_ucounts()
119 struct ucounts *ucounts; in find_ucounts() local
121 hlist_for_each_entry(ucounts, hashent, node) { in find_ucounts()
122 if (uid_eq(ucounts->uid, uid) && (ucounts->ns == ns)) in find_ucounts()
123 return ucounts; in find_ucounts()
128 static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid) in get_ucounts()
131 struct ucounts *ucounts, *new; in get_ucounts() local
134 ucounts = find_ucounts(ns, uid, hashent); in get_ucounts()
135 if (!ucounts) { in get_ucounts()
147 ucounts = find_ucounts(ns, uid, hashent); in get_ucounts()
148 if (ucounts) { in get_ucounts()
152 ucounts = new; in get_ucounts()
155 if (ucounts->count == INT_MAX) in get_ucounts()
156 ucounts = NULL; in get_ucounts()
158 ucounts->count += 1; in get_ucounts()
160 return ucounts; in get_ucounts()
163 static void put_ucounts(struct ucounts *ucounts) in put_ucounts() argument
168 ucounts->count -= 1; in put_ucounts()
169 if (!ucounts->count) in put_ucounts()
170 hlist_del_init(&ucounts->node); in put_ucounts()
172 ucounts = NULL; in put_ucounts()
175 kfree(ucounts); in put_ucounts()
192 struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, in inc_ucount()
195 struct ucounts *ucounts, *iter, *bad; in inc_ucount() local
197 ucounts = get_ucounts(ns, uid); in inc_ucount()
198 for (iter = ucounts; iter; iter = tns->ucounts) { in inc_ucount()
205 return ucounts; in inc_ucount()
208 for (iter = ucounts; iter != bad; iter = iter->ns->ucounts) in inc_ucount()
211 put_ucounts(ucounts); in inc_ucount()
215 void dec_ucount(struct ucounts *ucounts, enum ucount_type type) in dec_ucount() argument
217 struct ucounts *iter; in dec_ucount()
218 for (iter = ucounts; iter; iter = iter->ns->ucounts) { in dec_ucount()
222 put_ucounts(ucounts); in dec_ucount()