]> git.proxmox.com Git - mirror_qemu.git/commit - hw/block/fdc.c
fdc: avoid structure holes spotted by pahole
authorBlue Swirl <blauwirbel@gmail.com>
Sun, 7 Aug 2011 19:43:38 +0000 (19:43 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Sun, 21 Aug 2011 20:01:57 +0000 (20:01 +0000)
commit242cca4fdfadafca39fa918e78fea6ef89d6decc
treed83567b4e8c5e370fcc29511a2a00c30476294d1
parentfe87aa83c6d0c78bc29230ace4598363cdf4c835
fdc: avoid structure holes spotted by pahole

Edited report from pahole on amd64 host:
struct FDCtrl {
uint8_t                    version;              /*     0     1 */

/* XXX 7 bytes hole, try to pack */

qemu_irq                   irq;                  /*     8     8 */
int                        dma_chann;            /*    16     4 */

/* XXX 4 bytes hole, try to pack */
...
uint8_t                    status2;              /*    42     1 */

/* XXX 5 bytes hole, try to pack */

uint8_t *                  fifo;                 /*    48     8 */
...
uint8_t                    pwrd;                 /*    76     1 */

/* XXX 3 bytes hole, try to pack */

int                        sun4m;                /*    80     4 */
uint8_t                    num_floppies;         /*    84     1 */

/* XXX 3 bytes hole, try to pack */

FDrive                     drives[2];            /*    88    64 */
/* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */
int                        reset_sensei;         /*   152     4 */

/* size: 160, cachelines: 3 */
/* sum members: 134, holes: 5, sum holes: 22 */
/* padding: 4 */
/* last cacheline: 32 bytes */
}; /* definitions: 1 */

Fix by rearranging the structure to avoid padding.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/fdc.c