Lines Matching refs:ucounts

114 static struct ucounts *find_ucounts(struct user_namespace *ns, kuid_t uid, struct hlist_head *hashe…  in find_ucounts()
116 struct ucounts *ucounts; in find_ucounts() local
118 hlist_for_each_entry(ucounts, hashent, node) { in find_ucounts()
119 if (uid_eq(ucounts->uid, uid) && (ucounts->ns == ns)) in find_ucounts()
120 return ucounts; in find_ucounts()
125 static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid) in get_ucounts()
128 struct ucounts *ucounts, *new; in get_ucounts() local
131 ucounts = find_ucounts(ns, uid, hashent); in get_ucounts()
132 if (!ucounts) { in get_ucounts()
144 ucounts = find_ucounts(ns, uid, hashent); in get_ucounts()
145 if (ucounts) { in get_ucounts()
149 ucounts = new; in get_ucounts()
152 if (ucounts->count == INT_MAX) in get_ucounts()
153 ucounts = NULL; in get_ucounts()
155 ucounts->count += 1; in get_ucounts()
157 return ucounts; in get_ucounts()
160 static void put_ucounts(struct ucounts *ucounts) in put_ucounts() argument
165 ucounts->count -= 1; in put_ucounts()
166 if (!ucounts->count) in put_ucounts()
167 hlist_del_init(&ucounts->node); in put_ucounts()
169 ucounts = NULL; in put_ucounts()
172 kfree(ucounts); in put_ucounts()
189 struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, in inc_ucount()
192 struct ucounts *ucounts, *iter, *bad; in inc_ucount() local
194 ucounts = get_ucounts(ns, uid); in inc_ucount()
195 for (iter = ucounts; iter; iter = tns->ucounts) { in inc_ucount()
202 return ucounts; in inc_ucount()
205 for (iter = ucounts; iter != bad; iter = iter->ns->ucounts) in inc_ucount()
208 put_ucounts(ucounts); in inc_ucount()
212 void dec_ucount(struct ucounts *ucounts, enum ucount_type type) in dec_ucount() argument
214 struct ucounts *iter; in dec_ucount()
215 for (iter = ucounts; iter; iter = iter->ns->ucounts) { in dec_ucount()
219 put_ucounts(ucounts); in dec_ucount()