[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/41] virtio: change config_len type to int32_t
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 18/41] virtio: change config_len type to int32_t |
Date: |
Wed, 2 Dec 2009 13:04:16 +0100 |
size_t changes between 32 and 64 bits, making it bad for a field
that needs to be on the 'wire'. This value will never be near int32_t
limit.
Stored values are very small ints, it is backwards compatible
Signed-off-by: Juan Quintela <address@hidden>
---
hw/virtio.c | 4 ++--
hw/virtio.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/virtio.c b/hw/virtio.c
index bb93e8c..fd617ff 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -640,7 +640,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
qemu_put_8s(f, &vdev->isr);
qemu_put_be16s(f, &vdev->queue_sel);
qemu_put_be32s(f, &vdev->features);
- qemu_put_be32(f, vdev->config_len);
+ qemu_put_sbe32s(f, &vdev->config_len);
qemu_put_buffer(f, vdev->config, vdev->config_len);
qemu_put_sbe32s(f, &vdev->num_pci_queues);
@@ -697,7 +697,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
qemu_get_8s(f, &vdev->isr);
qemu_get_be16s(f, &vdev->queue_sel);
qemu_get_be32s(f, &vdev->features);
- vdev->config_len = qemu_get_be32(f);
+ qemu_get_sbe32s(f, &vdev->config_len);
qemu_get_buffer(f, vdev->config, vdev->config_len);
qemu_get_sbe32s(f, &vdev->num_pci_queues);
diff --git a/hw/virtio.h b/hw/virtio.h
index d849f44..f56f672 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -96,7 +96,7 @@ struct VirtIODevice
uint8_t isr;
uint16_t queue_sel;
uint32_t features;
- size_t config_len;
+ int32_t config_len;
void *config;
uint16_t config_vector;
int nvectors;
--
1.6.5.2
- [Qemu-devel] [PATCH 14/41] virtio: remove save/load_config for virtio, (continued)
[Qemu-devel] [PATCH 16/41] virtio: Add num_pci_queues field, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 17/41] virtio: split virtio_post_load() from virtio_load(), Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 18/41] virtio: change config_len type to int32_t,
Juan Quintela <=
[Qemu-devel] [PATCH 21/41] virtio: port to vmstate, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 19/41] virtio: use the right types for VirtQueue elements, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 20/41] virtio: abstract test for save/load values, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 22/41] virtio-net: change tx_timer_active to uint32_t, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 23/41] virtio-net: change mergeable_rx_bufs to uint32_t, Juan Quintela, 2009/12/02