Lines Matching full:user
47 * Get the key quota record for a user, allocating a new record if one doesn't
52 struct key_user *candidate = NULL, *user; in key_user_lookup() local
60 /* search the tree for a user record with a matching UID */ in key_user_lookup()
63 user = rb_entry(parent, struct key_user, node); in key_user_lookup()
65 if (uid_lt(uid, user->uid)) in key_user_lookup()
67 else if (uid_gt(uid, user->uid)) in key_user_lookup()
75 /* allocate a candidate user record if we don't already have in key_user_lookup()
79 user = NULL; in key_user_lookup()
90 /* if we get here, then the user record still hadn't appeared on the in key_user_lookup()
104 user = candidate; in key_user_lookup()
107 /* okay - we found a user record for this UID */ in key_user_lookup()
109 refcount_inc(&user->usage); in key_user_lookup()
113 return user; in key_user_lookup()
117 * Dispose of a user structure
119 void key_user_put(struct key_user *user) in key_user_put() argument
121 if (refcount_dec_and_lock(&user->usage, &key_user_lock)) { in key_user_put()
122 rb_erase(&user->node, &key_user_tree); in key_user_put()
125 kfree(user); in key_user_put()
209 * The user's key count quota is updated to reflect the creation of the key and
210 * the user's key data quota has the default for the key type reserved. The
229 struct key_user *user = NULL; in key_alloc() local
249 /* get hold of the key tracking for this user */ in key_alloc()
250 user = key_user_lookup(uid); in key_alloc()
251 if (!user) in key_alloc()
254 /* check that the user's quota permits allocation of another key and in key_alloc()
262 spin_lock(&user->lock); in key_alloc()
264 if (user->qnkeys + 1 > maxkeys || in key_alloc()
265 user->qnbytes + quotalen > maxbytes || in key_alloc()
266 user->qnbytes + quotalen < user->qnbytes) in key_alloc()
270 user->qnkeys++; in key_alloc()
271 user->qnbytes += quotalen; in key_alloc()
272 spin_unlock(&user->lock); in key_alloc()
290 key->user = user; in key_alloc()
317 atomic_inc(&user->nkeys); in key_alloc()
327 spin_lock(&user->lock); in key_alloc()
328 user->qnkeys--; in key_alloc()
329 user->qnbytes -= quotalen; in key_alloc()
330 spin_unlock(&user->lock); in key_alloc()
332 key_user_put(user); in key_alloc()
340 spin_lock(&user->lock); in key_alloc()
341 user->qnkeys--; in key_alloc()
342 user->qnbytes -= quotalen; in key_alloc()
343 spin_unlock(&user->lock); in key_alloc()
345 key_user_put(user); in key_alloc()
351 spin_unlock(&user->lock); in key_alloc()
352 key_user_put(user); in key_alloc()
363 * Adjust the amount of the owning user's key data quota that a key reserves.
378 unsigned maxbytes = uid_eq(key->user->uid, GLOBAL_ROOT_UID) ? in key_payload_reserve()
381 spin_lock(&key->user->lock); in key_payload_reserve()
384 (key->user->qnbytes + delta >= maxbytes || in key_payload_reserve()
385 key->user->qnbytes + delta < key->user->qnbytes)) { in key_payload_reserve()
389 key->user->qnbytes += delta; in key_payload_reserve()
392 spin_unlock(&key->user->lock); in key_payload_reserve()
444 atomic_inc(&key->user->nikeys); in __key_instantiate_and_link()
601 atomic_inc(&key->user->nikeys); in key_reject_and_link()
1189 /* record the root user tracking */ in key_init()