From owner-freebsd-arch Tue Feb 13 7:52:54 2001 Delivered-To: freebsd-arch@freebsd.org Received: from vega.dmnshq.net (vega.dmnshq.net [194.19.34.94]) by hub.freebsd.org (Postfix) with ESMTP id 84F6937B491; Tue, 13 Feb 2001 07:52:44 -0800 (PST) Received: (from eivind@localhost) by vega.dmnshq.net (8.11.1/8.9.3) id f1DFpxP76498; Tue, 13 Feb 2001 16:51:59 +0100 (CET) (envelope-from eivind) Date: Tue, 13 Feb 2001 16:51:59 +0100 From: Eivind Eklund To: Terry Lambert Cc: Boris Popov , freebsd-arch@FreeBSD.ORG, freebsd-fs@FreeBSD.ORG Subject: Re: vnode interlock API Message-ID: <20010213165159.A76093@thinksec.com> References: <200102072126.OAA24284@usr08.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200102072126.OAA24284@usr08.primenet.com>; from tlambert@primenet.com on Wed, Feb 07, 2001 at 09:26:00PM +0000 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Feb 07, 2001 at 09:26:00PM +0000, Terry Lambert wrote: > > So, I suggest to introduce two macro definitions which will hide > > implementation details for interlocks: > > > > #define VI_LOCK(vp) mtx_enter(&(vp)->v_interlock, MTX_DEF) > > #define VI_UNLOCK(vp) mtx_exit(&(vp)->v_interlock, MTX_DEF) > > > > for RELENG_4 they will look like this: > > > > #define VI_LOCK(vp) simple_lock(&(vp)->v_interlock) > > #define VI_UNLOCK(vp) simple_unlock(&(vp)->v_interlock) > > > > Any comments, suggestions ? > > 4) You need to wrap the calls with "{ ... }"; this is because > it may be useful in the future to institute turnstile or > single wakeup semantics, and converting the macro into a > single statement instead of a statement block would mean > a potentially large amount of work would be needed to cope > with the change later, whereas, you seem to plan to already > need to touch all those spots now. This is not an issue. You can get a block that behaves as a single statement by doing do { ... } while (0), and this is the recommended way of writing blocks in macros (so the macros behaves like single statements instead of blocks.) Please do NOT introduce pure statement block wrapped macros. They make for strange semantics, and we are trying to get rid of them. Thanks. Eivind. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message