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



> On Jan 12, 2017, at 7:16 AM, Taylor R Campbell <campbell+netbsd-tech-net%mumble.net@localhost> wrote:
> 
>   Date: Wed, 11 Jan 2017 12:55:26 -0800
>   From: Matt Thomas <matt%3am-software.com@localhost>
> 
>   Why not replace void (*pr_input)(struct mbuf *, ...); in protosw
>   with a union?  The first member of the union can be that and then
>   include the (mbuf *, int, int) as a secondary member.  
> 
> We did that for struct encapsw.  It doesn't provide the same type
> checking, however.  It would fail to detect the specific mistake that
> I saw Nakahara-san make during the encap work, of initializing one
> union member and then using another.
> 
> The change that rtr and I proposed would detect exactly that by
> causing inet6sw, by which the various xyz6_input routines are called,
> to have a different structure type altogether.

I don't think the additional ugliness is worth it.  Why not just

#define pr_input do_not_use

to prevent it's use?


Home | Main Index | Thread Index | Old Index