On Thu, 12 Nov 2009, Dag-Erling Smørgrav wrote:
So there used to be four chars in a row here (between if_description and
if_cspare). Are you sure moving the pointer in between doesn't increase the
structure size?
I can guarantee you that it does. On i386, for instance, there are now
three bytes of implicit padding between if_alloctype and if_description, and
one more between if_cspare and if_pspare, so struct ifnet has grown by four
bytes.
We should have CASSERTs for sizeof(struct ifnet) and other structs we really
care about.
We care less about ifnet than we used to, because ifnet is now allocated by
the kernel rather than drivers. However, if we want to take our KPI/KBI more
seriously, then CTASSERTs on other "public" kernel structures might well be a
good idea. On the other hand, CTASSERT errors on build are almost impervious
to mortal comprehension (if you haven't seen them before, they make little
sense to the reader), and will make it more difficult for people hacking on
our kernel to do so casually. Some sort of other static checker might make
more sense, and perhaps allow us to do more intelligent checking that just
"total size" -- we'd also like to detect rearrangement of sensitive structs
that would be size-preserving.
Robert
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"