From owner-p4-projects Thu Apr 4 11: 7:40 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0FE4637B421; Thu, 4 Apr 2002 11:07:29 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 3288137B41F for ; Thu, 4 Apr 2002 11:07:28 -0800 (PST) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g34J7RJ22362 for perforce@freebsd.org; Thu, 4 Apr 2002 11:07:27 -0800 (PST) (envelope-from jhb@freebsd.org) Date: Thu, 4 Apr 2002 11:07:27 -0800 (PST) Message-Id: <200204041907.g34J7RJ22362@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 9041 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=9041 Change 9041 by jhb@jhb_laptop on 2002/04/04 11:06:53 Integ from jhb_lock: - Change witness to use lock->lo_type instead of lock->lo_name for its lookups. - Fixup mutex and sx code accordingly. Affected files ... ... //depot/projects/smpng/sys/kern/kern_mutex.c#25 integrate ... //depot/projects/smpng/sys/kern/kern_sx.c#16 integrate ... //depot/projects/smpng/sys/kern/subr_witness.c#39 integrate ... //depot/projects/smpng/sys/sys/_lock.h#6 integrate ... //depot/projects/smpng/sys/sys/mutex.h#24 integrate Differences ... ==== //depot/projects/smpng/sys/kern/kern_mutex.c#25 (text+ko) ==== @@ -794,10 +794,12 @@ /* * Mutex initialization routine; initialize lock `m' of type contained in - * `opts' with options contained in `opts' and description `description.' + * `opts' with options contained in `opts' and name `name.' The optional + * lock type `type' is used as a general lock category name for use with + * witness. */ void -mtx_init(struct mtx *m, const char *description, int opts) +mtx_init(struct mtx *m, const char *name, const char *type, int opts) { struct lock_object *lock; @@ -817,7 +819,8 @@ lock->lo_class = &lock_class_mtx_spin; else lock->lo_class = &lock_class_mtx_sleep; - lock->lo_name = description; + lock->lo_name = name; + lock->lo_type = type != NULL ? type : name; if (opts & MTX_QUIET) lock->lo_flags = LO_QUIET; if (opts & MTX_RECURSE) ==== //depot/projects/smpng/sys/kern/kern_sx.c#16 (text+ko) ==== @@ -70,7 +70,7 @@ ("sx lock %s %p already initialized", description, sx)); bzero(sx, sizeof(*sx)); lock->lo_class = &lock_class_sx; - lock->lo_name = description; + lock->lo_type = lock->lo_name = description; lock->lo_flags = LO_WITNESS | LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE; sx->sx_lock = mtx_pool_find(sx); ==== //depot/projects/smpng/sys/kern/subr_witness.c#39 (text+ko) ==== @@ -311,7 +311,7 @@ mtx_lock(&all_mtx); STAILQ_FOREACH(lock, &all_locks, lo_list) { if (lock->lo_flags & LO_WITNESS) - lock->lo_witness = enroll(lock->lo_name, + lock->lo_witness = enroll(lock->lo_type, lock->lo_class); else lock->lo_witness = NULL; @@ -356,7 +356,7 @@ mtx_unlock(&all_mtx); if (!witness_cold && !witness_dead && panicstr == NULL && (lock->lo_flags & LO_WITNESS) != 0) - lock->lo_witness = enroll(lock->lo_name, class); + lock->lo_witness = enroll(lock->lo_type, class); else lock->lo_witness = NULL; } ==== //depot/projects/smpng/sys/sys/_lock.h#6 (text+ko) ==== @@ -33,7 +33,8 @@ struct lock_object { struct lock_class *lo_class; - const char *lo_name; + const char *lo_name; /* Individual lock name. */ + const char *lo_type; /* General lock type. */ u_int lo_flags; STAILQ_ENTRY(lock_object) lo_list; /* List of all locks in system. */ struct witness *lo_witness; ==== //depot/projects/smpng/sys/sys/mutex.h#24 (text+ko) ==== @@ -97,7 +97,7 @@ * [See below for descriptions] * */ -void mtx_init(struct mtx *m, const char *description, int opts); +void mtx_init(struct mtx *m, const char *name, const char *type, int opts); void mtx_destroy(struct mtx *m); void mtx_sysinit(void *arg); void mutex_init(void); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message