Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 2001 16:51:59 +0100
From:      Eivind Eklund <eivind@FreeBSD.ORG>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        Boris Popov <bp@butya.kz>, freebsd-arch@FreeBSD.ORG, freebsd-fs@FreeBSD.ORG
Subject:   Re: vnode interlock API
Message-ID:  <20010213165159.A76093@thinksec.com>
In-Reply-To: <200102072126.OAA24284@usr08.primenet.com>; from tlambert@primenet.com on Wed, Feb 07, 2001 at 09:26:00PM %2B0000
References:  <Pine.BSF.4.21.0102061638280.82511-100000@lion.butya.kz> <200102072126.OAA24284@usr08.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010213165159.A76093>