From owner-trustedbsd-cvs@FreeBSD.ORG Thu Sep 7 13:48:23 2006 Return-Path: X-Original-To: trustedbsd-cvs@freebsd.org Delivered-To: trustedbsd-cvs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 400A916A4E0 for ; Thu, 7 Sep 2006 13:48:23 +0000 (UTC) (envelope-from owner-perforce@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 171AD43D66 for ; Thu, 7 Sep 2006 13:48:14 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by cyrus.watson.org (Postfix) with ESMTP id 5AD9E46DA3 for ; Thu, 7 Sep 2006 09:48:13 -0400 (EDT) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id B9B4753B8D; Thu, 7 Sep 2006 13:27:22 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id B3D0916A4E1; Thu, 7 Sep 2006 13:27:22 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A9AD16A4DD for ; Thu, 7 Sep 2006 13:27:22 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B8AEB43D7C for ; Thu, 7 Sep 2006 13:27:02 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k87DR2oU010847 for ; Thu, 7 Sep 2006 13:27:02 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k87DR1LP010844 for perforce@freebsd.org; Thu, 7 Sep 2006 13:27:01 GMT (envelope-from millert@freebsd.org) Date: Thu, 7 Sep 2006 13:27:01 GMT Message-Id: <200609071327.k87DR1LP010844@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 105779 for review X-BeenThere: trustedbsd-cvs@FreeBSD.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: TrustedBSD CVS and Perforce commit message list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Sep 2006 13:48:23 -0000 http://perforce.freebsd.org/chv.cgi?CH=105779 Change 105779 by millert@millert_g5tower on 2006/09/07 13:26:42 Slightly less obfuscated label handle locking: Rename mutex in label handle from io_lock_data to lh_lock_data since it is part of the label handle and not an ipc_object struct. This means we need to define lh_lock, lh_unlock and lh_lock_init in terms of the mutex_* functions and not io_*. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.c#6 edit .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.h#3 edit .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/task.h#2 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.c#6 (text+ko) ==== @@ -71,7 +71,7 @@ /* Allocate new label handle, insert port and label. */ lh = (ipc_labelh_t)zalloc(ipc_labelh_zone); - io_lock_init(lh); + lh_lock_init(lh); lh->lh_port = port; lh->lh_label = *inl; lh->lh_type = LABELH_TYPE_USER; ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.h#3 (text+ko) ==== @@ -37,7 +37,7 @@ int lh_type; struct label lh_label; ipc_port_t lh_port; - decl_mutex_data(, io_lock_data) + decl_mutex_data(, lh_lock_data) } *ipc_labelh_t; #define LABELH_TYPE_KERN 0 @@ -60,8 +60,9 @@ extern zone_t ipc_labelh_zone; -#define lh_lock io_lock -#define lh_unlock io_unlock +#define lh_lock_init(lh) mutex_init(&(lh)->lh_lock_data, 0) +#define lh_lock(lh) mutex_lock(&(lh)->lh_lock_data) +#define lh_unlock(lh) mutex_unlock(&(lh)->lh_lock_data) /* * Check the number of references the label handle has left. ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/task.h#2 (text+ko) ==== @@ -215,8 +215,8 @@ #ifdef MAC #define maclabel label->lh_label -#define tasklabel_lock(task) io_lock((task)->label) -#define tasklabel_unlock(task) io_unlock((task)->label) +#define tasklabel_lock(task) lh_lock((task)->label) +#define tasklabel_unlock(task) lh_unlock((task)->label) extern void tasklabel_lock2(task_t a, task_t b); extern void tasklabel_unlock2(task_t a, task_t b);