Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Sep 2016 09:47:12 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Cc:        Marcel Moolenaar <marcel@xcllnt.net>
Subject:   Re: Including <sys/disk*.h> without getting ioctl(2) defines
Message-ID:  <1513385.S0oC4mUWt4@ralph.baldwin.cx>
In-Reply-To: <etPan.57e9475f.18472693.e1fd@xcllnt.net>
References:  <etPan.57e9475f.18472693.e1fd@xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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/disklabel.h>, <=
sys/diskmbr.h> and <sys/diskpc98.h> and those headers themselves includ=
e <sys/ioccom.h> for ioctl(2) definitions. The <sys/ioccom.h> 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. <sys/bsdlabel.h>) and keep the FreeBSD-centric defini=
tions (e.g. for ioctl(2)) in the original header (e.g. <sys/disklabel.h=
>. 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 <disk/mbr.h>, <disk/pc98.h>, <disk/bsd.h>, <disk/gpt.h>, 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1513385.S0oC4mUWt4>