From owner-freebsd-arch@freebsd.org Tue Apr 7 17:21:53 2020 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC688276787 for ; Tue, 7 Apr 2020 17:21:53 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 48xZ2n4rlNz3ytj for ; Tue, 7 Apr 2020 17:21:53 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by mailman.nyi.freebsd.org (Postfix) id A63A6276783; Tue, 7 Apr 2020 17:21:53 +0000 (UTC) Delivered-To: arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5E99276782; Tue, 7 Apr 2020 17:21:53 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48xZ2m4YQKz3ytZ; Tue, 7 Apr 2020 17:21:52 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id B514A3C0199; Tue, 7 Apr 2020 17:21:51 +0000 (UTC) Date: Tue, 7 Apr 2020 17:21:51 +0000 From: Brooks Davis To: arch@freebsd.org, net@freebsd.org Subject: additional ifreq accessors? Message-ID: <20200407172151.GB72584@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LpQ9ahxlCli8rRTG" Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 48xZ2m4YQKz3ytZ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-5.53 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_DN_NONE(0.00)[]; AUTH_NA(1.00)[]; DMARC_NA(0.00)[freebsd.org]; IP_SCORE(-3.63)[ip: (-9.53), ipnet: 199.48.128.0/22(-4.76), asn: 36236(-3.81), country: US(-0.05)]; RCPT_COUNT_TWO(0.00)[2]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 17:21:54 -0000 --LpQ9ahxlCli8rRTG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In r331797 I added a public accessor for the ifru_data member of struct ifreq (using a union to access the right version of the struct depending on the caller's ABI and creating a pointer from the 32-bit version's integer representation). I've also recently exposed versions for ifru_buffer. All non-pointer members are currently accessed by treating the structure as a struct ifreq (even it's a struct ifreq32.) This works because the structure layout doesn't differ for other members and I believe it is safe even in the present of aggressive LTO because the actual type of the object in userspace can never be observed by the compiler. In CheriBSD, our initial port used 256-bit (wide and aligned) pointers. This caused padding to be inserted between ifr_name and ifr_ifru making the aliasing approach not work. As such I switched all access to ifr_ifru members to use accessors. We have decided that 256-bit is not viable for commercial deployment (duh) and are slowly removing 256-bit specific things from our tree. The full set of accessors can be seen at (just pretend the __capability qualifiers aren't there):=20 https://github.com/CTSRD-CHERI/cheribsd/blob/602d2c547b1cf917998833003ada80= b564861153/sys/net/if_var.h#L828-L849 My question for the lists is: should we adopt the more-technically-correct accessors in FreeBSD or stick with slightly-cheaper and more conventional aliasing approach[0]? If the former, I'll prepare a diff, if the latter I'll reduce my diffs locally. -- Brooks [0] To ensure use of the accessors in the kernel we don't define the macros used to make ifr_ifru pseudo-transparent when _KERNEL is defined. --LpQ9ahxlCli8rRTG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJejLauAAoJEKzQXbSebgfA1c8H/13DiXcKM4hvzMo2h8sUJORC 5OPkZ0PFN8cMY0Q0W/xKmZdHVCyExCu5SLyNt0pJg0CI9EiCqi6xmffanXTQxOJE qS6tDZ/G0fjxkcqT+a+AR//DaJ5TLioA0t4uRYnr9bP5twNq0CiG6H2buRWh7wn/ eAmz250hihJDMUsShHT5qjL5euoTyom2OXsid7RZwe2o0nArm2XKNfjLC8Aq3BRl rLCOhNfomUAm+lElzHYyoSPwY20JVylbkeZaE9PwG/G9egXZbXevko52z/Ya4r9G Weai1VMDoBe/vlm9MWtDV49GKsJzNptm5PBt0P3BBOHYkNXdgPjNpSB13D1QEYk= =p2o3 -----END PGP SIGNATURE----- --LpQ9ahxlCli8rRTG-- From owner-freebsd-arch@freebsd.org Tue Apr 7 17:26:52 2020 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18027276C70 for ; Tue, 7 Apr 2020 17:26:52 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 48xZ8W54dYz40LW for ; Tue, 7 Apr 2020 17:26:51 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: by mailman.nyi.freebsd.org (Postfix) id AE1A4276C6C; Tue, 7 Apr 2020 17:26:51 +0000 (UTC) Delivered-To: arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADC7B276C6B; Tue, 7 Apr 2020 17:26:51 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48xZ8V3j8Pz40LM; Tue, 7 Apr 2020 17:26:50 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id 69DB51AF13D; Tue, 7 Apr 2020 17:26:38 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id 037HQbd8062338 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 7 Apr 2020 17:26:38 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id 037HQbkk062337; Tue, 7 Apr 2020 17:26:37 GMT (envelope-from phk) To: Brooks Davis cc: arch@freebsd.org, net@freebsd.org Subject: Re: additional ifreq accessors? In-reply-to: <20200407172151.GB72584@spindle.one-eyed-alien.net> From: "Poul-Henning Kamp" References: <20200407172151.GB72584@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <62335.1586280397.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Tue, 07 Apr 2020 17:26:37 +0000 Message-ID: <62336.1586280397@critter.freebsd.dk> X-Rspamd-Queue-Id: 48xZ8V3j8Pz40LM X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of phk@critter.freebsd.dk designates 130.225.244.222 as permitted sender) smtp.mailfrom=phk@critter.freebsd.dk X-Spamd-Result: default: False [-0.56 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.79)[-0.794,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.dk]; NEURAL_HAM_LONG(-0.81)[-0.813,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(0.04)[ip: (0.06), ipnet: 130.225.0.0/16(0.08), asn: 1835(0.09), country: EU(-0.01)]; FORGED_SENDER(0.30)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU]; SUBJECT_ENDS_QUESTION(1.00)[]; FROM_NEQ_ENVFROM(0.00)[phk@phk.freebsd.dk,phk@critter.freebsd.dk] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 17:26:52 -0000 -------- In message <20200407172151.GB72584@spindle.one-eyed-alien.net>, Brooks Dav= is writes: >My question for the lists is: should we adopt the >more-technically-correct accessors in FreeBSD or stick with >slightly-cheaper and more conventional aliasing approach[0]? The accessors buys us much more code-isolation, so that would be my vote. -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-freebsd-arch@freebsd.org Tue Apr 7 17:32:50 2020 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B44A727708B for ; Tue, 7 Apr 2020 17:32:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 48xZHQ2b6hz40pW for ; Tue, 7 Apr 2020 17:32:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: by mailman.nyi.freebsd.org (Postfix) id 58B28277087; Tue, 7 Apr 2020 17:32:50 +0000 (UTC) Delivered-To: arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 586E2277086; Tue, 7 Apr 2020 17:32:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48xZHP59VTz40pV; Tue, 7 Apr 2020 17:32:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 519D2260253; Tue, 7 Apr 2020 19:32:47 +0200 (CEST) Subject: Re: additional ifreq accessors? To: Poul-Henning Kamp , Brooks Davis Cc: arch@freebsd.org, net@freebsd.org References: <20200407172151.GB72584@spindle.one-eyed-alien.net> <62336.1586280397@critter.freebsd.dk> From: Hans Petter Selasky Message-ID: Date: Tue, 7 Apr 2020 19:32:37 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <62336.1586280397@critter.freebsd.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 48xZHP59VTz40pV X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-3.98 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SUBJECT_ENDS_QUESTION(1.00)[]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(-2.68)[ip: (-9.21), ipnet: 2a01:4f8::/29(-2.61), asn: 24940(-1.58), country: DE(-0.02)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 17:32:50 -0000 On 2020-04-07 19:26, Poul-Henning Kamp wrote: > -------- > In message <20200407172151.GB72584@spindle.one-eyed-alien.net>, Brooks Davis writes: > >> My question for the lists is: should we adopt the >> more-technically-correct accessors in FreeBSD or stick with >> slightly-cheaper and more conventional aliasing approach[0]? > > The accessors buys us much more code-isolation, so that would be my vote. > Is there a reason for using "void *" here? char *ifr_addr_get_data(void *ifrp); --HPS From owner-freebsd-arch@freebsd.org Tue Apr 7 17:45:24 2020 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FE43277814 for ; Tue, 7 Apr 2020 17:45:24 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 48xZYw0qsxz41cY for ; Tue, 7 Apr 2020 17:45:24 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by mailman.nyi.freebsd.org (Postfix) id 1C663277812; Tue, 7 Apr 2020 17:45:24 +0000 (UTC) Delivered-To: arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C17A277811; Tue, 7 Apr 2020 17:45:24 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48xZYv33Rzz41cG; Tue, 7 Apr 2020 17:45:23 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 9ADCD3C0199; Tue, 7 Apr 2020 17:45:22 +0000 (UTC) Date: Tue, 7 Apr 2020 17:45:22 +0000 From: Brooks Davis To: Hans Petter Selasky Cc: Poul-Henning Kamp , arch@freebsd.org, net@freebsd.org Subject: Re: additional ifreq accessors? Message-ID: <20200407174522.GC72584@spindle.one-eyed-alien.net> References: <20200407172151.GB72584@spindle.one-eyed-alien.net> <62336.1586280397@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DIOMP1UsTsWJauNi" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 48xZYv33Rzz41cG X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-5.53 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; MIME_TRACE(0.00)[0:+,1:+,2:~]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; IP_SCORE(-3.63)[ip: (-9.53), ipnet: 199.48.128.0/22(-4.75), asn: 36236(-3.81), country: US(-0.05)] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 17:45:24 -0000 --DIOMP1UsTsWJauNi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 07, 2020 at 07:32:37PM +0200, Hans Petter Selasky wrote: > On 2020-04-07 19:26, Poul-Henning Kamp wrote: > > -------- > > In message <20200407172151.GB72584@spindle.one-eyed-alien.net>, Brooks = Davis writes: > >=20 > >> My question for the lists is: should we adopt the > >> more-technically-correct accessors in FreeBSD or stick with > >> slightly-cheaper and more conventional aliasing approach[0]? > >=20 > > The accessors buys us much more code-isolation, so that would be my vot= e. > >=20 >=20 > Is there a reason for using "void *" here? >=20 > char *ifr_addr_get_data(void *ifrp); Because the type is unknown at this point (it may be struct ifreq or struct ifreq32 (or in CheriBSD struct ifreq64)). By using "void *" here we avoid the need to insert a wrong cast. -- Brooks --DIOMP1UsTsWJauNi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJejLwxAAoJEKzQXbSebgfA6+8IAIYFrD81n/WNk0RSBzd1nxK3 TErSKOycIHe7/v6D7DUd0o9fSco7vIR7wLMbEmMkp/10ceNhD0/FlbSc1FTeqGL9 B7LiEH7pN9eKnuUqKZX/UbrAs2OAinxxNmvO4a0uQ/x72gp00Z0UqjYAM8gGCJl8 McqXdwEjY5VFFMdPywLC0SR1BiuExOghYHgpAAVa+P2mFYx+7AY+m2DsR0gJ4ZzE qhcF6IpapYJ4yKzcz9vRz10C9v22fZngz49ibmHxe0u0plFqKd3B/RTiELcvvs4K QeNd+GBjqj3djeipFHVo8YGv5kWpaq13Yl3ldXXFIkGc5ADaHoiSBD1PzeYFr1U= =80lf -----END PGP SIGNATURE----- --DIOMP1UsTsWJauNi-- From owner-freebsd-arch@freebsd.org Tue Apr 7 19:03:31 2020 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CC84279D8C for ; Tue, 7 Apr 2020 19:03:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 48xcJ255Yqz45hT for ; Tue, 7 Apr 2020 19:03:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id AEC68279D8A; Tue, 7 Apr 2020 19:03:30 +0000 (UTC) Delivered-To: arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE7AE279D89; Tue, 7 Apr 2020 19:03:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xcJ249N7z45hS; Tue, 7 Apr 2020 19:03:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f47.google.com with SMTP id x11so4291504otp.6; Tue, 07 Apr 2020 12:03:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=eUU7SXd9GSS3bbC8wDkfGY6FXFGD9w1iaFFvmAupod0=; b=o5iZvVUN+1DqtPic03w0Ci1JMPc6tCReTJtgMtbsWYfARZ1+cPT2DgmITZy4IEXydz he/Zh7g7P1pirM67YGha8JxJHFohp+T/DjQBQgqEIdUsMa5rh+nng9u1lWaqKebrnXjn S73zbwTsw9vAoKpf2sH85shxPjOJqgTuSmYi3qZKCsQLRUr195gb6deiYWjAxEKszvUZ Z9QQvMRtyoX5/fy8jp0R4RbUuLXd3CmOpNW9WkwUfQwkSi1tYrPZ744mpuwR8BbzdE0Q nOhVg+oHR9aLHGPA52YA0GjsEsP+BUmvQgTatI34ZkRkdSloFoweVk9Jl8MJyW182KC8 /WeA== X-Gm-Message-State: AGi0PuYBj7NhHpQCexNM1kFhIYicTvtNvn1qb1uLTKnywU+35jj4PT61 t5xRsfomTzxzwvJ5tvxiNoroBvC4 X-Google-Smtp-Source: APiQypJCIEvNF3aoT94tnPKAlSvydmLJbKlZYeB0faxzD0N0FWQI74KKMb1He9YhsRH9Og2cChP1ig== X-Received: by 2002:a9d:68c5:: with SMTP id i5mr2949906oto.266.1586286208271; Tue, 07 Apr 2020 12:03:28 -0700 (PDT) Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com. [209.85.210.44]) by smtp.gmail.com with ESMTPSA id a3sm1358331oop.36.2020.04.07.12.03.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Apr 2020 12:03:28 -0700 (PDT) Received: by mail-ot1-f44.google.com with SMTP id 60so1396891otl.12; Tue, 07 Apr 2020 12:03:28 -0700 (PDT) X-Received: by 2002:a05:6830:1f39:: with SMTP id e25mr2894767oth.135.1586286207862; Tue, 07 Apr 2020 12:03:27 -0700 (PDT) MIME-Version: 1.0 References: <20200407172151.GB72584@spindle.one-eyed-alien.net> <62336.1586280397@critter.freebsd.dk> <20200407174522.GC72584@spindle.one-eyed-alien.net> In-Reply-To: <20200407174522.GC72584@spindle.one-eyed-alien.net> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 7 Apr 2020 12:03:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: additional ifreq accessors? To: Brooks Davis Cc: Hans Petter Selasky , "freebsd-arch@freebsd.org" , net@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 48xcJ249N7z45hS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 19:03:31 -0000 On Tue, Apr 7, 2020 at 10:45 AM Brooks Davis wrote: > On Tue, Apr 07, 2020 at 07:32:37PM +0200, Hans Petter Selasky wrote: > > Is there a reason for using "void *" here? > > > > char *ifr_addr_get_data(void *ifrp); > > Because the type is unknown at this point (it may be struct ifreq or > struct ifreq32 (or in CheriBSD struct ifreq64)). By using "void *" here > we avoid the need to insert a wrong cast. I think the question (or my question anyway) is: why void*, and not a union pointer? A union pointer would never be a wrong cast for the caller, and inherent in this design is essentially treating the pointer as a union on the callee side of things. Thanks, Conrad