Lines Matching full:user
48 * Get the key quota record for a user, allocating a new record if one doesn't
53 struct key_user *candidate = NULL, *user; in key_user_lookup() local
61 /* search the tree for a user record with a matching UID */ in key_user_lookup()
64 user = rb_entry(parent, struct key_user, node); in key_user_lookup()
66 if (uid_lt(uid, user->uid)) in key_user_lookup()
68 else if (uid_gt(uid, user->uid)) in key_user_lookup()
76 /* allocate a candidate user record if we don't already have in key_user_lookup()
80 user = NULL; in key_user_lookup()
91 /* if we get here, then the user record still hadn't appeared on the in key_user_lookup()
105 user = candidate; in key_user_lookup()
108 /* okay - we found a user record for this UID */ in key_user_lookup()
110 refcount_inc(&user->usage); in key_user_lookup()
114 return user; in key_user_lookup()
118 * Dispose of a user structure
120 void key_user_put(struct key_user *user) in key_user_put() argument
122 if (refcount_dec_and_lock(&user->usage, &key_user_lock)) { in key_user_put()
123 rb_erase(&user->node, &key_user_tree); in key_user_put()
126 kfree(user); in key_user_put()
210 * The user's key count quota is updated to reflect the creation of the key and
211 * the user's key data quota has the default for the key type reserved. The
230 struct key_user *user = NULL; in key_alloc() local
250 /* get hold of the key tracking for this user */ in key_alloc()
251 user = key_user_lookup(uid); in key_alloc()
252 if (!user) in key_alloc()
255 /* check that the user's quota permits allocation of another key and in key_alloc()
263 spin_lock(&user->lock); in key_alloc()
265 if (user->qnkeys + 1 > maxkeys || in key_alloc()
266 user->qnbytes + quotalen > maxbytes || in key_alloc()
267 user->qnbytes + quotalen < user->qnbytes) in key_alloc()
271 user->qnkeys++; in key_alloc()
272 user->qnbytes += quotalen; in key_alloc()
273 spin_unlock(&user->lock); in key_alloc()
291 key->user = user; in key_alloc()
320 atomic_inc(&user->nkeys); in key_alloc()
330 spin_lock(&user->lock); in key_alloc()
331 user->qnkeys--; in key_alloc()
332 user->qnbytes -= quotalen; in key_alloc()
333 spin_unlock(&user->lock); in key_alloc()
335 key_user_put(user); in key_alloc()
343 spin_lock(&user->lock); in key_alloc()
344 user->qnkeys--; in key_alloc()
345 user->qnbytes -= quotalen; in key_alloc()
346 spin_unlock(&user->lock); in key_alloc()
348 key_user_put(user); in key_alloc()
354 spin_unlock(&user->lock); in key_alloc()
355 key_user_put(user); in key_alloc()
366 * Adjust the amount of the owning user's key data quota that a key reserves.
381 unsigned maxbytes = uid_eq(key->user->uid, GLOBAL_ROOT_UID) ? in key_payload_reserve()
384 spin_lock(&key->user->lock); in key_payload_reserve()
387 (key->user->qnbytes + delta > maxbytes || in key_payload_reserve()
388 key->user->qnbytes + delta < key->user->qnbytes)) { in key_payload_reserve()
392 key->user->qnbytes += delta; in key_payload_reserve()
395 spin_unlock(&key->user->lock); in key_payload_reserve()
447 atomic_inc(&key->user->nikeys); in __key_instantiate_and_link()
606 atomic_inc(&key->user->nikeys); in key_reject_and_link()
1213 /* record the root user tracking */ in key_init()