From owner-freebsd-net@freebsd.org Tue Apr 7 19:03:31 2020 Return-Path: Delivered-To: freebsd-net@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 3CD2E279D8E 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 48xcJ258SGz45hV for ; Tue, 7 Apr 2020 19:03:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id AEE1F279D8B; Tue, 7 Apr 2020 19:03:30 +0000 (UTC) Delivered-To: net@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-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD 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