tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: patch make struct protosw pr_input non-variadic
Date: Sat, 14 May 2016 16:47:28 +0000
From: Taylor R Campbell <campbell+netbsd-tech-net%mumble.net@localhost>
Date: Fri, 13 May 2016 23:14:13 +0000 (UTC)
From: christos%astron.com@localhost (Christos Zoulas)
In article <20160513195611.GA8625@pris>,
Tyler Retzlaff <rtr%netbsd.org@localhost> wrote:
>This patch:
>[...]
>* converts domain::dom_protosw to an array of pointers
Why? What's the point of the extra indirection? You could just stick
and & in front of the array element assignment.
[...]
Changing dom_protosw to be an array of pointers to struct protosw
instead of an array of struct protosw grants us flexibility in using
struct <protospecific>protosw structure and still get real type
checking for everything -- we simply fill dom_protosw with pointers to
an embedded struct protosw inside struct <protospecific>protosw.
I should add that I believe this indirection does not affect any hot
paths. For example, in the packet-processing path, ip_input still
uses the direct array, which dom_protosw is an array of pointers into;
the actual machine code in ip_input shouldn't change at all.
As far as I could tell, dom_protosw is used only in cold paths, such
as in ip_init, in domain_attach, in route-changing ctlinput packet
processing, &c., and only for linear scans through the whole array
anyway.
Home |
Main Index |
Thread Index |
Old Index