struct nbd_reply not packed => trouble?
Yann Droneaud
ydroneaud at opteya.com
Tue Jan 15 04:59:05 EST 2013
Hi,
Le mardi 15 janvier 2013 à 07:59 +0800, 卜弋天 a écrit :
>
> 在 2013-1-11,0:42,"Yann Droneaud" <ydroneaud at opteya.com> 写道:
> >> - Any ideas for a platform where you would expect struct nbd_reply to
> >> be other than 4 + 4 + 8 = 16 bytes in size?
> >
> > Look for an ABI that require 'char' with either property:
> > - size > 1 byte
> > - alignment > 8 (16 bytes !)
> >
> >
>
> Do you mean this structure size will vary on different platform? If yes, why Linux does not packed here? Thanks
>
There's probably no such architecture for a general purpose processor
with the ABI properties I've mentionned. eg. (sizeof(char) > 1 ||
alignof(char) > 8).
And if one day Linux is going to be ported on such target, the packing
of the nbd_reply struct will be the smallest problem to fix.
Regards
--
Yann Droneaud
OPTEYA
More information about the Kernelnewbies
mailing list