Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jun 2019 18:24:47 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Bruce Evans <brde@optusnet.com.au>, Alan Somers <asomers@freebsd.org>,  Ian Lepore <ian@freebsd.org>, src-committers <src-committers@freebsd.org>,  svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r349233 - head/sys/sys
Message-ID:  <20190621181031.X814@besplex.bde.org>
In-Reply-To: <CANCZdfqKtEoH7HMT2AESaQ6LtaidodOsdZ6srwhWJ7djxbqNsA@mail.gmail.com>
References:  <201906201435.x5KEZTqH021513@repo.freebsd.org> <54f3bc97cbb485cdcc44b81c82c149ac9e46d42f.camel@freebsd.org> <CAOtMX2jt1M6mQNC_JekLMRfxgo2OxeR3VkfuQZHDgx%2B_vzFNWQ@mail.gmail.com> <20190621013236.N5105@besplex.bde.org> <CAOtMX2h3=f_hozsrL7NqGKYafsDMzny3Z-bQh5JJ6n71Y0-9Mg@mail.gmail.com> <20190621033049.D5823@besplex.bde.org> <CANCZdfqKtEoH7HMT2AESaQ6LtaidodOsdZ6srwhWJ7djxbqNsA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 20 Jun 2019, Warner Losh wrote:

> On Thu, Jun 20, 2019, 11:44 AM Bruce Evans <brde@optusnet.com.au> wrote:
>
>> On Thu, 20 Jun 2019, Alan Somers wrote:
>>
>>> On Thu, Jun 20, 2019 at 10:43 AM Bruce Evans <brde@optusnet.com.au>
>> wrote:
>>>> Summary: <sys/ioctl.h> and the headers that it includes should declare
>>>> minimal types to compile (so __int64_t is enough).  Most uses of this
>>>> header require including domain-specific headers which declare the
>>>> relevant data structures.
>>>
>>> Bruce, would you be satisfied by switching from <sys/types.h> to
>>> <sys/_types.h> and from int64_t to __int64_t?
>>
>> Not quite.  The kernel block number type is daddr_t, and [__]int64_t is
>> a hard coding of that.  Hard-coding of typedefs is good for reducing
>> namespace pollution, but it is not done for the nearby use of off_t.
>>
>> Unfortunately, daddr_t is only declared in <sys/types.h>.
>>
>> [... related type/units errors in ffs and ext2fs]
>> Using a generic int64_t type in all interfaces would avoid some of these
>> bugs, so I don't mind using it for the API.  Just add a note that it must
>> be large enough to represent all useful values of daddr_t.
>
> Maybe we should add a __daddr_t define to sys/_types.h? And the usual
> reshuffling. That would also fix the namespace pollution.

OK.  ABI's should use only fixed-width types to be stable, and APIs should
use only basic types to be stable, but avoiding typedefs (except to fixed-
width types) would be a larger project, with few existing examples.

Bruce



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