From owner-freebsd-arch@freebsd.org Mon Sep 26 18:05:06 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C515EBEAFAB for ; Mon, 26 Sep 2016 18:05:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A14AAC53 for ; Mon, 26 Sep 2016 18:05:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id E540710AF81; Mon, 26 Sep 2016 14:04:59 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Cc: Marcel Moolenaar Subject: Re: Including without getting ioctl(2) defines Date: Mon, 26 Sep 2016 09:47:12 -0700 Message-ID: <1513385.S0oC4mUWt4@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 26 Sep 2016 14:05:00 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2016 18:05:06 -0000 On Monday, September 26, 2016 09:05:51 AM Marcel Moolenaar wrote: > Background: > In order for a select set of FreeBSD utilities to compile on non-Free= BSD (specifically macOS and Linux) as build tools, we need some portabi= lity tweaks. >=20 > Problem: > mkimg(1) includes disk partitioning headers like , <= sys/diskmbr.h> and and those headers themselves includ= e for ioctl(2) definitions. The header do= es not typically exist on the host we=E2=80=99re being, causing build f= ailures. >=20 > Proposal: > What I like is to be able to use FreeBSD=E2=80=99s headers, but not p= ull in FreeBSD-specifics like ioctl(2) definitions. >=20 > Solutions: > 1. Split off the definitions relating to the partitioning into a sepa= rate header (e.g. ) and keep the FreeBSD-centric defini= tions (e.g. for ioctl(2)) in the original header (e.g. . The original header will include the new header so that there=E2=80=99= s no change to applications that include the original header. Portable = tools like mkimg can include the new split-off header to get just the s= tructure definitions and defines. I think this. It is similar to the 'fooreg.h' vs 'foovar.h' split in s= ome drivers with fooreg.h generally being a standalone, portable header and= foovar.h defining FreeBSD-specific structures (softc, etc.). I'd even be inclined to use some kind of sensible namespace for the hea= der names like , , , , etc= . While you are at it, please have these split out headers avoid conflict= ing names unlike diskmbr.h and diskpc98.h. (We can use compat #define's in= diskmbr.h and diskpc98.h if needed to provide API compat.) --=20 John Baldwin