12 #include <linux/sched.h>
13 #include <linux/slab.h>
14 #include <linux/bitops.h>
17 #include <linux/export.h>
62 #define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 7)
63 #define UIDHASH_SZ (1 << UIDHASH_BITS)
64 #define UIDHASH_MASK (UIDHASH_SZ - 1)
65 #define __uidhashfn(uid) (((uid >> UIDHASH_BITS) + uid) & UIDHASH_MASK)
66 #define uidhashentry(uid) (uidhash_table + __uidhashfn((__kuid_val(uid))))
111 if (uid_eq(user->
uid, uid)) {
128 spin_unlock_irqrestore(&uidhash_lock,
flags);
147 spin_unlock_irqrestore(&uidhash_lock, flags);
160 free_user(up, flags);
170 spin_lock_irq(&uidhash_lock);
171 up = uid_hash_find(uid, hashent);
172 spin_unlock_irq(&uidhash_lock);
175 new = kmem_cache_zalloc(uid_cachep,
GFP_KERNEL);
186 spin_lock_irq(&uidhash_lock);
187 up = uid_hash_find(uid, hashent);
193 uid_hash_insert(
new, hashent);
196 spin_unlock_irq(&uidhash_lock);
205 static int __init uid_cache_init(
void)
216 spin_lock_irq(&uidhash_lock);
218 spin_unlock_irq(&uidhash_lock);