Lines Matching defs: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;
61 /* search the tree for a user record with a matching UID */
64 user = rb_entry(parent, struct key_user, node);
66 if (uid_lt(uid, user->uid))
68 else if (uid_gt(uid, user->uid))
76 /* allocate a candidate user record if we don't already have
80 user = NULL;
91 /* if we get here, then the user record still hadn't appeared on the
105 user = candidate;
108 /* okay - we found a user record for this UID */
110 refcount_inc(&user->usage);
114 return user;
118 * Dispose of a user structure
120 void key_user_put(struct key_user *user)
122 if (refcount_dec_and_lock(&user->usage, &key_user_lock)) {
123 rb_erase(&user->node, &key_user_tree);
126 kfree(user);
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;
250 /* get hold of the key tracking for this user */
251 user = key_user_lookup(uid);
252 if (!user)
255 /* check that the user's quota permits allocation of another key and
263 spin_lock(&user->lock);
265 if (user->qnkeys + 1 > maxkeys ||
266 user->qnbytes + quotalen > maxbytes ||
267 user->qnbytes + quotalen < user->qnbytes)
271 user->qnkeys++;
272 user->qnbytes += quotalen;
273 spin_unlock(&user->lock);
291 key->user = user;
321 atomic_inc(&user->nkeys);
331 spin_lock(&user->lock);
332 user->qnkeys--;
333 user->qnbytes -= quotalen;
334 spin_unlock(&user->lock);
336 key_user_put(user);
344 spin_lock(&user->lock);
345 user->qnkeys--;
346 user->qnbytes -= quotalen;
347 spin_unlock(&user->lock);
349 key_user_put(user);
355 spin_unlock(&user->lock);
356 key_user_put(user);
367 * Adjust the amount of the owning user's key data quota that a key reserves.
382 unsigned maxbytes = uid_eq(key->user->uid, GLOBAL_ROOT_UID) ?
385 spin_lock(&key->user->lock);
388 (key->user->qnbytes + delta > maxbytes ||
389 key->user->qnbytes + delta < key->user->qnbytes)) {
393 key->user->qnbytes += delta;
396 spin_unlock(&key->user->lock);
448 atomic_inc(&key->user->nikeys);
604 atomic_inc(&key->user->nikeys);
1271 /* record the root user tracking */