Patchwork [30/41] virtio-net: use save/load type chek functions for has_vent_hdr

login
register
mail settings
Submitter Juan Quintela
Date Dec. 2, 2009, 12:04 p.m.
Message ID <504bfa9bcd0d77c0858c72d3d93c63c4bc8163c5.1259754427.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/40036/
State New
Headers show

Comments

Juan Quintela - Dec. 2, 2009, 12:04 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/virtio-net.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 589ea80..c515e0e 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -718,7 +718,7 @@  static void virtio_net_save(QEMUFile *f, void *opaque)
     qemu_put_be32s(f, &n->mac_table.in_use);
     qemu_put_buffer(f, n->mac_table.macs, n->mac_table.in_use * ETH_ALEN);
     qemu_put_buffer(f, n->vlans, MAX_VLAN >> 3);
-    qemu_put_be32(f, n->has_vnet_hdr);
+    qemu_put_be32s(f, &n->has_vnet_hdr);
     qemu_put_8s(f, &n->mac_table.multi_overflow);
     qemu_put_8s(f, &n->mac_table.uni_overflow);
     qemu_put_8s(f, &n->alluni);
@@ -765,7 +765,8 @@  static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
         qemu_get_buffer(f, n->vlans, MAX_VLAN >> 3);

     if (version_id >= 7) {
-        if (qemu_get_be32(f) && !peer_has_vnet_hdr(n)) {
+        qemu_get_be32s(f, &n->has_vnet_hdr);
+        if (n->has_vnet_hdr && !peer_has_vnet_hdr(n)) {
             qemu_error("virtio-net: saved image requires vnet_hdr=on\n");
             return -1;
         }