[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate
From: |
Juan Quintela |
Subject: |
[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate |
Date: |
Wed, 02 Dec 2009 19:38:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
"Michael S. Tsirkin" <address@hidden> wrote:
> On Wed, Dec 02, 2009 at 01:04:31PM +0100, Juan Quintela wrote:
>>
>> Signed-off-by: Juan Quintela <address@hidden>
>> ---
>> hw/virtio-net.c | 148
>> ++++++++++++++++++++++++-------------------------------
>> 1 files changed, 64 insertions(+), 84 deletions(-)
>>
>> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
>> index 4434827..3a59449 100644
>> --- a/hw/virtio-net.c
>> +++ b/hw/virtio-net.c
>> @@ -703,6 +703,38 @@ static void virtio_net_tx_timer(void *opaque)
>> virtio_net_flush_tx(n, n->tx_vq);
>> }
>>
>> +/* Restore an uint8_t from an uint32_t
>> + This is a Big hack, but it is how the old state did it.
>> + */
>> +
>> +static int get_uint8_from_uint32(QEMUFile *f, void *pv, size_t size)
>> +{
>> + uint8_t *v = pv;
>> + *v = qemu_get_be32(f);
>> + return 0;
>> +}
>> +
>> +static void put_unused(QEMUFile *f, void *pv, size_t size)
>> +{
>> + fprintf(stderr, "uint8_from_uint32 is used only for backwards
>> compatibility.\n");
>
> line too long
>
>> + fprintf(stderr, "Never should be used to write a new state.\n");
>> + exit(0);
>
> I don't understand. what is this dong?
it is used later.
current code is reading an uint32_t value into a int8_t value. As you
can guess that don't fit (that is the HACK part of it). That is only
needed for old versions that we are reading (get_* function has real
code). But we are supposed to never write old versions (*).
Thet that shouldn't happen ever.
> when
> is this called? Please supply a comment.
> Maybe call assert?
>
assert or exit is ok for me, what does people preffer?
Later, Juan.
(*): My next series will propose to change that and allow to write old
versions, but that didn't exist when this code was written, and
there are still no agreement about how/if doing it.
- [Qemu-devel] Re: [PATCH 29/41] virtio-net: in_use and first_multi only handle unsigned values, (continued)
[Qemu-devel] [PATCH 30/41] virtio-net: use save/load type chek functions for has_vent_hdr, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 32/41] virtio-net: split virtio_net_post_load, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 31/41] virtio-net: we know macs size at compile time, make it static, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 33/41] virtio-net: port to vmstate, Juan Quintela, 2009/12/02
[Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate, Michael S. Tsirkin, 2009/12/02
[Qemu-devel] [PATCH 34/41] virtio-console: port to vmstate, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 35/41] virtio-balloon: port to vmstate, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 36/41] virtio-blk: change rq type to VirtIOBlockReq, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 37/41] QLIST: Introduce QLIST_COPY_HEAD, Juan Quintela, 2009/12/02