Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2010 10:14:17 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Lawrence Stewart <lstewart@freebsd.org>, tuexen@freebsd.org, rrs@freebsd.org
Subject:   Re: A cookie for anyone who can solve this C/macro problem...
Message-ID:  <201004151014.17405.jhb@freebsd.org>
In-Reply-To: <4BC711DA.4080207@freebsd.org>
References:  <4BC711DA.4080207@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 15 April 2010 9:17:14 am Lawrence Stewart wrote:
> void
> newreno_ack_received(struct cc_var *ccv)
> {
> 	u_int cw = CCV_DO(ccv, snd_cwnd);
> 	...
> 	CCVC(ccv, snd_cwnd = blah);
> }
> 
> Of course, this falls apart if you try do this for example:
> 
> 	CCVC(ccv, snd_cwnd = min(blah, bleh));
> 
> 
> So... I'm sure there are some good ideas out there and would really 
> appreciate hearing about them.

If you want to go this route, you could use separate _SET and _GET macros ala 
PCPU_*().  Then you would end up with something like:

	u_int cw = CCV_GET(ccv, snd_cwnd);

	CCV_SET(ccv, snd_cwnd, min(blah, bleh));


-- 
John Baldwin



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