Lines Matching defs:user

51  * Get the key quota record for a user, allocating a new record if one doesn't
56 struct key_user *candidate = NULL, *user;
64 /* search the tree for a user record with a matching UID */
67 user = rb_entry(parent, struct key_user, node);
69 if (uid_lt(uid, user->uid))
71 else if (uid_gt(uid, user->uid))
79 /* allocate a candidate user record if we don't already have
83 user = NULL;
94 /* if we get here, then the user record still hadn't appeared on the
108 user = candidate;
111 /* okay - we found a user record for this UID */
113 atomic_inc(&user->usage);
117 return user;
121 * Dispose of a user structure
123 void key_user_put(struct key_user *user)
125 if (atomic_dec_and_lock(&user->usage, &key_user_lock)) {
126 rb_erase(&user->node, &key_user_tree);
129 kfree(user);
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
228 struct key_user *user = NULL;
248 /* get hold of the key tracking for this user */
249 user = key_user_lookup(uid);
250 if (!user)
253 /* check that the user's quota permits allocation of another key and
261 spin_lock(&user->lock);
263 if (user->qnkeys + 1 >= maxkeys ||
264 user->qnbytes + quotalen >= maxbytes ||
265 user->qnbytes + quotalen < user->qnbytes)
269 user->qnkeys++;
270 user->qnbytes += quotalen;
271 spin_unlock(&user->lock);
290 key->user = user;
312 atomic_inc(&user->nkeys);
322 spin_lock(&user->lock);
323 user->qnkeys--;
324 user->qnbytes -= quotalen;
325 spin_unlock(&user->lock);
327 key_user_put(user);
335 spin_lock(&user->lock);
336 user->qnkeys--;
337 user->qnbytes -= quotalen;
338 spin_unlock(&user->lock);
340 key_user_put(user);
346 spin_unlock(&user->lock);
347 key_user_put(user);
358 * Adjust the amount of the owning user's key data quota that a key reserves.
373 unsigned maxbytes = uid_eq(key->user->uid, GLOBAL_ROOT_UID) ?
376 spin_lock(&key->user->lock);
379 (key->user->qnbytes + delta >= maxbytes ||
380 key->user->qnbytes + delta < key->user->qnbytes)) {
384 key->user->qnbytes += delta;
387 spin_unlock(&key->user->lock);
427 atomic_inc(&key->user->nikeys);
558 atomic_inc(&key->user->nikeys);
1135 /* record the root user tracking */