tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Per-cpu stats for network interfaces



> Date: Mon, 27 Jan 2020 23:35:01 -0800
> From: Jason Thorpe <thorpej%me.com@localhost>
> 
> Thanks for your feedback!  I've incorporated your suggestions.  The
> pattern now actually looks like:
> 
> 	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
> 	if_statinc_ref(nsr, if_opackets);
> 	// ...etc.
> 	IF_STAT_PUTREF(ifp);
> 
> net_stat_ref_t is a new opaque type declared in <sys/net_stats.h> to
> prevent anything subscripting it directly.

Can you make it `struct if_stat_ref *' instead of `net_stat_ref_t'?
That way it can still be opaque but there's no need to include an
extra header file for even the opaque uses of it, and nobody can ever
agree on or remember whether mumble_t means a mumble or a pointer to a
mumble.


Home | Main Index | Thread Index | Old Index