win32: Fix compiler errors from u_int64_t
PATCH 1/1 win32: Fix compiler errors from u_int64_t
u_int64_t raises compiler error messages:
CC libhw32/virtio.o
/qemu/ar7/hw/virtio.c: In function ‘virtio_queue_get_avail_size’:
/qemu/ar7/hw/virtio.c:776: error: ‘u_int64_t’ undeclared (first use in this function) /qemu/ar7/hw/virtio.c:776: error: (Each undeclared identifier is reported only once /qemu/ar7/hw/virtio.c:776: error: for each function it appears in.)
Replacing u_int64_t by uint64_t helps.
--- hw/vhost.c | 6 +++--- hw/virtio.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
hw/vhost.c +3 -3
@@ -357,9 +357,9 @@ static int vhost_virtqueue_set_addr(struct vhost_dev *dev, {struct vhost_vring_addr addr = { .index = idx, - .desc_user_addr = (u_int64_t )(unsigned long )vq->desc, - .avail_user_addr = (u_int64_t )(unsigned long )vq->avail, - .used_user_addr = (u_int64_t )(unsigned long )vq->used, + .desc_user_addr = (uint64_t )(unsigned long )vq->desc, + .avail_user_addr = (uint64_t )(unsigned long )vq->avail, + .used_user_addr = (uint64_t )(unsigned long )vq->used, .log_guest_addr = vq->used_phys, .flags = enable_log ? (1 <<VHOST_VRING_F_LOG ) :0 , };
hw/virtio.c +1 -1
@@ -773,7 +773,7 @@ target_phys_addr_t virtio_queue_get_desc_size(VirtIODevice *vdev, int n)target_phys_addr_t virtio_queue_get_avail_size (VirtIODevice *vdev,int n) {return offsetof(VRingAvail , ring) + -sizeof (u_int64_t) * vdev->vq[n].vring.num; +sizeof (uint64_t ) * vdev->vq[n].vring.num; }target_phys_addr_t virtio_queue_get_used_size (VirtIODevice *vdev,int n)
Signature · 1 line
1.7.0
Anthony Liguori
AppliedQuoted 10 lines · Stefan Weil
u_int64_traises compiler error messages:CC
libhw32/virtio.o
/qemu/ar7/hw/virtio.c: In function ‘virtio_queue_get_avail_size’:
/qemu/ar7/hw/virtio.c:776: error: ‘u_int64_t’ undeclared (first use in this function) /qemu/ar7/hw/virtio.c:776: error: (Each undeclared identifier is reported only once /qemu/ar7/hw/virtio.c:776: error: for each function it appears in.)Replacing
u_int64_tbyuint64_thelps.
Curious. What platform/gcc are you on?
Applied. Thanks.
Regards,
Anthony Liguori
Quoted 39 lines
Cc Michael S. Tsirkin<[email protected]>Cc Anthony Liguori<[email protected]>Signed-off-by Stefan Weil<[email protected]>--- hw/vhost.c | 6 +++--- hw/virtio.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)hw/vhost.c +3
-3@@ -357,9 +357,9 @@ static int vhost_virtqueue_set_addr(struct vhost_dev *dev, {struct vhost_vring_addr addr = { .index = idx, - .desc_user_addr = (u_int64_t )(unsigned long )vq->desc, - .avail_user_addr = (u_int64_t )(unsigned long )vq->avail, - .used_user_addr = (u_int64_t )(unsigned long )vq->used, + .desc_user_addr = (uint64_t )(unsigned long )vq->desc, + .avail_user_addr = (uint64_t )(unsigned long )vq->avail, + .used_user_addr = (uint64_t )(unsigned long )vq->used, .log_guest_addr = vq->used_phys, .flags = enable_log ? (1 <<VHOST_VRING_F_LOG ) :0 , };hw/virtio.c +1
-1@@ -773,7 +773,7 @@ target_phys_addr_t virtio_queue_get_desc_size(VirtIODevice *vdev, int n)target_phys_addr_t virtio_queue_get_avail_size (VirtIODevice *vdev,int n) {return offsetof(VRingAvail , ring) + -sizeof (u_int64_t) * vdev->vq[n].vring.num; +sizeof (uint64_t ) * vdev->vq[n].vring.num; }target_phys_addr_t virtio_queue_get_used_size (VirtIODevice *vdev,int n)
Quoted 8 lines · Stefan Weil
u_int64_traises compiler error messages:CC
libhw32/virtio.o
/qemu/ar7/hw/virtio.c: In function ‘virtio_queue_get_avail_size’:
/qemu/ar7/hw/virtio.c:776: error: ‘u_int64_t’ undeclared (first use in this function) /qemu/ar7/hw/virtio.c:776: error: (Each undeclared identifier is reported only once /qemu/ar7/hw/virtio.c:776: error: for each function it appears in.)
Quoted 5 lines
Replacing
u_int64_tbyuint64_thelps.Cc Michael S. Tsirkin <[email protected]>Cc Anthony Liguori <[email protected]>Signed-off-by Stefan Weil <[email protected]>
Speaking of which, we have:
/scm/qemu/slirp/slirp.h:typedef uint64_t u_int64_t;
which we probably don't need either?
Quoted 37 lines
--- hw/vhost.c | 6 +++--- hw/virtio.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)hw/vhost.c +3
-3@@ -357,9 +357,9 @@ static int vhost_virtqueue_set_addr(struct vhost_dev *dev, {struct vhost_vring_addr addr = { .index = idx, - .desc_user_addr = (u_int64_t )(unsigned long )vq->desc, - .avail_user_addr = (u_int64_t )(unsigned long )vq->avail, - .used_user_addr = (u_int64_t )(unsigned long )vq->used, + .desc_user_addr = (uint64_t )(unsigned long )vq->desc, + .avail_user_addr = (uint64_t )(unsigned long )vq->avail, + .used_user_addr = (uint64_t )(unsigned long )vq->used, .log_guest_addr = vq->used_phys, .flags = enable_log ? (1 <<VHOST_VRING_F_LOG ) :0 , };hw/virtio.c +1
-1@@ -773,7 +773,7 @@ target_phys_addr_t virtio_queue_get_desc_size(VirtIODevice *vdev, int n)target_phys_addr_t virtio_queue_get_avail_size (VirtIODevice *vdev,int n) {return offsetof(VRingAvail , ring) + -sizeof (u_int64_t) * vdev->vq[n].vring.num; +sizeof (uint64_t ) * vdev->vq[n].vring.num; }target_phys_addr_t virtio_queue_get_used_size (VirtIODevice *vdev,int n)Signature · 1 line
1.7.0
Quoted 17 lines · Michael S. Tsirkin
Quoted 10 lines · Stefan Weil
u_int64_traises compiler error messages:CC
libhw32/virtio.o
/qemu/ar7/hw/virtio.c: In function ‘virtio_queue_get_avail_size’:
/qemu/ar7/hw/virtio.c:776: error: ‘u_int64_t’ undeclared (first use in this function)
/qemu/ar7/hw/virtio.c:776: error: (Each undeclared identifier is reported only once
/qemu/ar7/hw/virtio.c:776: error: for each function it appears in.)Quoted 5 lines
Replacing
u_int64_tbyuint64_thelps.Cc Michael S. Tsirkin <[email protected]>Cc Anthony Liguori <[email protected]>Signed-off-by Stefan Weil <[email protected]>
Quoted 6 lines
Speaking of which, we have:
/scm/qemu/slirp/slirp.h:typedefuint64_tu_int64_t;which we probably don't need either?
Right. I'd even prefer replacing all those u_int#_t types by the standard types uint#_t.
Is that ok, or would you prefer not to touch the slirp code (which makes heavy use of those types)?
Regards,
Stefan
Quoted 25 lines · Stefan Weil
Quoted 17 lines · Michael S. Tsirkin
Quoted 10 lines · Stefan Weil
u_int64_traises compiler error messages:CC
libhw32/virtio.o
/qemu/ar7/hw/virtio.c: In function ‘virtio_queue_get_avail_size’:
/qemu/ar7/hw/virtio.c:776: error: ‘u_int64_t’ undeclared (first use in this function)
/qemu/ar7/hw/virtio.c:776: error: (Each undeclared identifier is reported only once
/qemu/ar7/hw/virtio.c:776: error: for each function it appears in.)Quoted 5 lines
Replacing
u_int64_tbyuint64_thelps.Cc Michael S. Tsirkin <[email protected]>Cc Anthony Liguori <[email protected]>Signed-off-by Stefan Weil <[email protected]>Quoted 6 lines
Speaking of which, we have:
/scm/qemu/slirp/slirp.h:typedefuint64_tu_int64_t;which we probably don't need either?
Quoted 8 lines
Right. I'd even prefer replacing all those u_int#_t types by the standard types uint#_t.
Is that ok, or would you prefer not to touch the slirp code (which makes heavy use of those types)?
Regards,
Stefan
I don't think we should modify all of slirp code. However u_int64_t specifically seems unused.
Signature · 1 line
MST