Date: Wed, 17 Aug 2022 17:41:57 +0100 From: Jessica Clarke <jrtc27@freebsd.org> To: John Baldwin <jhb@FreeBSD.org> Cc: Gleb Smirnoff <glebius@freebsd.org>, src-committers <src-committers@freebsd.org>, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: c93db4abf454 - main - udp: call UDP methods from UDP over IPv6 directly Message-ID: <7DA094FB-3E0F-4784-A538-CB2EE78A5275@freebsd.org> In-Reply-To: <a762616d-d539-2be0-c025-96aecd518360@FreeBSD.org> References: <202208161940.27GJercD039480@gitrepo.freebsd.org> <62dca1e0-8d66-6291-149e-5785af0e2658@FreeBSD.org> <Yv0VEQge6ttaC0Rv@FreeBSD.org> <a762616d-d539-2be0-c025-96aecd518360@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 17 Aug 2022, at 17:37, John Baldwin <jhb@FreeBSD.org> wrote: >=20 > On 8/17/22 9:19 AM, Gleb Smirnoff wrote: >> John, >> On Wed, Aug 17, 2022 at 09:04:08AM -0700, John Baldwin wrote: >> J> > diff --git a/sys/netinet6/udp6_usrreq.c = b/sys/netinet6/udp6_usrreq.c >> J> > index a7bdfce97707..6a3ac2abd90b 100644 >> J> > --- a/sys/netinet6/udp6_usrreq.c >> J> > +++ b/sys/netinet6/udp6_usrreq.c >> J> > @@ -131,12 +131,18 @@ VNET_DEFINE(int, zero_checksum_port) =3D = 0; >> J> > SYSCTL_INT(_net_inet6_udp6, OID_AUTO, rfc6935_port, CTLFLAG_VNET = | CTLFLAG_RW, >> J> > &VNET_NAME(zero_checksum_port), 0, >> J> > "Zero UDP checksum allowed for traffic to/from this port."); >> J> > + >> J> > + >> J> > +/* netinet/udp_usrreqs.c */ >> J> > +pr_abort_t udp_abort; >> J> > +pr_disconnect_t udp_disconnect; >> J> > +pr_send_t udp_send; >> J> > + >> J> >> J> Oof, can you please put these in a header instead? = <netinet/udp_var.h> would seem to be >> J> a good candidate. >> I actually don't want to share these functions to anybody. Sometimes = we are >> in a situation when two compilation units are historically separated, >> while they need to call into each other functions, which by design = are private. >=20 > Putting them in a header doesn't really change that. Anyone can add a = local > prototype and call it. Even better, they can add a _wrong_ prototype = and > call it with the wrong arguments. Or more likely, if the original = function changes > then previously working code breaks and the compiler won't catch this. = In this > specific case you mostly sidestep that due to using a typedef, but in = general the > wrong prototype problem is the reason to store prototypes in headers. >=20 > I'm not sure that "I don't trust other developers" is a valid reason = to avoid the > use of headers, or at least I'm not sure it outweighs "code breaks = without > the compiler noticing in the future". I'd rather signpost it in the = header > clarifying when it is allowed to be used (e.g. /* Shared between = udp*_usrreq.c. */ > or the like) Or if you really want to make it clearly signposted, add a = udp_usrreq_private.h. Jess
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7DA094FB-3E0F-4784-A538-CB2EE78A5275>