A cookie for anyone who can solve this C/macro problem...
John Baldwin
jhb at freebsd.org
Thu Apr 15 14:14:28 UTC 2010
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
More information about the freebsd-hackers
mailing list