lkml.org 
[lkml]   [2000]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH correction^2] Re: 2.4.0test - uid_hash_find()
On Mon, 9 Oct 2000, Guest section DW wrote:

> > -static inline struct user_struct *uid_hash_find(uid_t uid, unsigned int hashent)
> > +static inline struct user_struct *uid_hash_find(unsigned short uid, unsigned int hashent)
>
> Your labeling is confusing. linux.vanilla? linux-2.4.0-test9?
> Which is the original version?
> The --- is most recent.

AFAIK, the first should be the original unpatched kernel patch should
apply against, and the second should be the modified kernel you're
working on, a copy of the first. This is how Linus' patches look like,
IIRC, just without the vanilla.

> It looks like you did s/unsigned short/uid_t/ in the
> original tree instead of the patched one.

Yep. This is the last correction, applied it to a clean source tree
and it worked. FLW.

--- linux-2.4.0-test9/kernel/user.c Mon Oct 9 01:37:35 2000
+++ linux.vanilla/kernel/user.c Sun Oct 8 22:33:55 2000
@@ -51,22 +51,18 @@
*up->pprev = up->next;
}

-static inline struct user_struct *uid_hash_find(unsigned short uid, unsigned int hashent)
+static inline struct user_struct *uid_hash_find(uid_t uid, unsigned int hashent)
{
- struct user_struct *up, *next;
+ struct user_struct *up;

- next = uidhash[hashent];
- for (;;) {
- up = next;
- if (next) {
- next = up->next;
- if (up->uid != uid)
- continue;
- atomic_inc(&up->__count);
+ for (up = uidhash[hashent]; up ; up = up->next)
+ if (up->uid == uid)
+ {
+ atomic_inc(&up->__count);
+ return up;
}
- break;
- }
- return up;
+
+ return NULL;
}

/*
@@ -136,16 +132,11 @@

static int __init uid_cache_init(void)
{
- int i;
-
uid_cachep = kmem_cache_create("uid_cache", sizeof(struct user_struct),
0,
SLAB_HWCACHE_ALIGN, NULL, NULL);
if(!uid_cachep)
panic("Cannot create uid taskcount SLAB cache\n");
-
- for(i = 0; i < UIDHASH_SZ; i++)
- uidhash[i] = 0;

/* Insert the root user immediately - init already runs with this */
uid_hash_insert(&root_user, uidhashfn(0));
--
Dan Aloni
dax@karrde.org

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.073 / U:81.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site