svn commit: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys

Warner Losh imp at bsdimp.com
Tue Aug 29 16:20:24 UTC 2017


On Tue, Aug 29, 2017 at 8:30 AM, John Baldwin <jhb at freebsd.org> wrote:

> On Monday, August 28, 2017 04:40:49 PM Maxim Sobolev wrote:
> > John, well, this depends on how you look at it. The padding element size
> is
> > "int", which when you account for the alignment has the nice property on
> > both 32 and 64-bit arches that no matter what kind of element you add
> > (char, short, int or void *), you only need to bring down MDNPAD by 1 to
> > keep the structure size the same.
>
> That's only true once.  Add a second pointer and this trick won't work
> again
> on 64-bit platforms.  It only worked this time by accident because there
> was
> unaccounted-for padding at the end of the structure, not on purpose.  In
> other places in the tree where ABI is more carefully maintained we use
> explicit spare pointers or spare longs instead (e.g. padding in
> kinfo_proc).
>

Yes, as someone that's lived through the 'All the World's a VAX' wars and
the 'All the world's 32-bit' wars or even the more ancient 16-bit -> 32-bit
wars, there's a reason we have uintptr_t and why it may not be an int...

Warner


More information about the svn-src-head mailing list