From nobody Wed Aug 17 16:37:44 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M7DG21vp3z4Zs2s; Wed, 17 Aug 2022 16:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M7DG210f6z3pW3; Wed, 17 Aug 2022 16:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660754266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xOGAoyOgkvoONHr+R5P/jhIqC8lbiOKlREgsb7hq8A0=; b=ZN3r343zEaUmLGjmBl/BlKyECuqhL335CtmdM575bTd655uCBoDFizcqsjXmnBevk3+xiV f3y0DjUMeBo7BGS9FbcG6y+iIKztlQnvIZeOTmaNVDv1Fsncn51DkyyGxAokpcQNHdyyNZ 3ivbB+zVt3MgkKvu0susTskttGpcLUO6nJ9D9Q6zU5A77Ehf10boitZACOwqB76Nlis0zu ipiWtXPGfT7ERTyct9vLQ6E2+MvNBRichryMm4nAoP5NTSMBobLFQJ1jzOESotHKnKdZZB KhoM23c8nN/UX8dn1d4v9yDeDB3xO9naQ6L6HketLdChC1wh4CD+JWRFE/tX1Q== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4M7DG13ZYQz1RMd; Wed, 17 Aug 2022 16:37:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Wed, 17 Aug 2022 09:37:44 -0700 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: Gleb Smirnoff Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202208161940.27GJercD039480@gitrepo.freebsd.org> <62dca1e0-8d66-6291-149e-5785af0e2658@FreeBSD.org> From: John Baldwin Subject: Re: git: c93db4abf454 - main - udp: call UDP methods from UDP over IPv6 directly In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660754266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xOGAoyOgkvoONHr+R5P/jhIqC8lbiOKlREgsb7hq8A0=; b=lNp+IWwJbR5G0Yr8WyB+Byjq2GwPEDoJU2qdNU1Y+CVTRj/7C3tyjAomlFb/7gwGNdtUJG 3SSvC5TLEWE9PlYe8fJKot+Stz/A3P8cmXMp1XrKIJE9U5v/KmKGlz7pLvaX983n07ZYD6 oooVBskUAhGKv4E87KXguDKgLTZp+/1S3wv2ex9s19PmA2p2SYv8//1p4nK3pUbIzU9qWd ISOwQB1hnu4Nja2JYbH/wSRBtF7VqY2hPpF80yJpeD4cevIVVOGgkZf4/fdwXNaPT6ZJrZ dxYTOGekBHyBAqxsWFk6KEEvD6dAB2Dc9HheSXlY6FHain5E1kcmuarzPmXnKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660754266; a=rsa-sha256; cv=none; b=uz/k4ObA+m+jh1PGrGZAcGcVulejHuwvYhR4T6y6+d9zN07BVhYHScEzeUFtpdwb+P+Jzr ScNxqK6m2YdB7Ag0msUPNA92yY6HBzLSEmZXB13nxTRc0dc+en0xRaA4uGpb2EAU6rAH03 9qDq/Y6LwBAArO9h54czi66eHEUAzBY5bLF7YQsx1kY+aO1CIIko5LYOcLHg7K+jayybEC 5fmYnbv50fTsN6JBRTipvDm5nxuuqrWaIgzowNODZ+UZC8nVIggXvDtiiTjXKQmofCfmn0 zeJn80M7gnc4R2rjuRrWOfcVMkiIU3+x18uVxLYbM/dDoUYfSb2g2QlSDWmioQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N 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) = 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? 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. 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. 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) -- John Baldwin