vhost-user-test: fix up rhel6 build
PATCH 1/1 vhost-user-test: fix up rhel6 build
Build on RHEL6 fails:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42875
Apparently unnamed unions couldn't use C99 named field initializers. Let's just name the payload union field.
Signed-off-by Michael S. Tsirkin <[email protected]>
--- tests/vhost-user-test.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tests/vhost-user-test.c +9 -9
@@ -98,7 +98,7 @@ typedef struct VhostUserMsg {struct vhost_vring_state state;struct vhost_vring_addr addr;VhostUserMemory memory; - }; + } payload; }QEMU_PACKED VhostUserMsg; static VhostUserMsg m __attribute__ ((unused));
@@ -242,23 +242,23 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)case VHOST_USER_GET_FEATURES :/* send back features to qemu */ msg.flags |=VHOST_USER_REPLY_MASK ; - msg.size =sizeof (m.u64); - msg.u64 =0x1ULL <<VHOST_F_LOG_ALL | + msg.size =sizeof (m.payload.u64); + msg.payload.u64 =0x1ULL <<VHOST_F_LOG_ALL |0x1ULL <<VHOST_USER_F_PROTOCOL_FEATURES ; p = (uint8_t *) &msg;qemu_chr_fe_write_all (chr, p,VHOST_USER_HDR_SIZE + msg.size);break ;case VHOST_USER_SET_FEATURES : -g_assert_cmpint (msg.u64 & (0x1ULL <<VHOST_USER_F_PROTOCOL_FEATURES ), +g_assert_cmpint (msg.payload.u64 & (0x1ULL <<VHOST_USER_F_PROTOCOL_FEATURES ), !=, 0ULL);break ;case VHOST_USER_GET_PROTOCOL_FEATURES :/* send back features to qemu */ msg.flags |=VHOST_USER_REPLY_MASK ; - msg.size =sizeof (m.u64); - msg.u64 =1 <<VHOST_USER_PROTOCOL_F_LOG_SHMFD ; + msg.size =sizeof (m.payload.u64); + msg.payload.u64 =1 <<VHOST_USER_PROTOCOL_F_LOG_SHMFD ; p = (uint8_t *) &msg;qemu_chr_fe_write_all (chr, p,VHOST_USER_HDR_SIZE + msg.size);break ;
@@ -266,15 +266,15 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)case VHOST_USER_GET_VRING_BASE :/* send back vring base to qemu */ msg.flags |=VHOST_USER_REPLY_MASK ; - msg.size =sizeof (m.state); - msg.state.num =0 ; + msg.size =sizeof (m.payload.state); + msg.payload.state.num =0 ; p = (uint8_t *) &msg;qemu_chr_fe_write_all (chr, p,VHOST_USER_HDR_SIZE + msg.size);break ;case VHOST_USER_SET_MEM_TABLE :/* received the mem table */ -memcpy (&s->memory, &msg.memory,sizeof (msg.memory)); +memcpy (&s->memory, &msg.payload.memory,sizeof (msg.payload.memory)); s->fds_num =qemu_chr_fe_get_msgfds (chr, s->fds,G_N_ELEMENTS (s->fds));/* signal the test that it can continue */
Signature · 1 line
MST
Quoted 10 lines · Michael S. Tsirkin
Build on RHEL6 fails:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42875Apparently unnamed unions couldn't use C99 named field initializers. Let's just name the payload union field.
Signed-off-by Michael S. Tsirkin <[email protected]>--- tests/vhost-user-test.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Reviewed-by Gonglei <[email protected]>
Quoted 7 lines · Gonglei
Quoted 6 lines · Michael S. Tsirkin
Build on RHEL6 fails:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42875Apparently unnamed unions couldn't use C99 named field initializers. Let's just name the payload union field.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Michael S. Tsirkin <[email protected]>--- tests/vhost-user-test.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)Reviewed-by Gonglei <[email protected]>
Tested-by would have more value :)