[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: virtio_scsi_cmd_req_cmd alignment
Il 07/04/2014 11:33, Michael S. Tsirkin ha scritto:
I just noticed that without a pack directive, the following is likely to cause compiler to add padding: struct virtio_scsi_req_cmd { // Device-readable part u8 lun[8]; le64 id; u8 task_attr; u8 prio; u8 crn; u8 cdb[cdb_size]; u8 dataout[]; // Device-writable part le32 sense_len; le32 residual; le16 status_qualifier; u8 status; u8 response; u8 sense[sense_size]; u8 datain[]; }; if cdb_size is 32 and sense_size is 96 as spec suggests, and with no dataout and datain, padding will be added at the tail of structure unless suppressed e.g. using the packed directive. In practice this is pseudo-code, but implementations might copy bits of this. That's unfortunate, I really assumed balloon is the only instance where structure fields aren't naturally aligned. Should we do something with it for 1.0? Or is an implementation note in the spec enough?
I think an implementation note is enough. Paolo
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]