From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFqbt-0002en-RL for qemu-devel@nongnu.org; Wed, 02 Dec 2009 09:55:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFqbo-0002ct-Tz for qemu-devel@nongnu.org; Wed, 02 Dec 2009 09:55:17 -0500 Received: from [199.232.76.173] (port=53958 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFqbo-0002cn-Ou for qemu-devel@nongnu.org; Wed, 02 Dec 2009 09:55:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23139) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFqbn-0001xn-OI for qemu-devel@nongnu.org; Wed, 02 Dec 2009 09:55:12 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nB2EtAPb001627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Dec 2009 09:55:10 -0500 Date: Wed, 2 Dec 2009 16:52:32 +0200 From: "Michael S. Tsirkin" Message-ID: <20091202145232.GF18519@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] Re: [PATCH 29/41] virtio-net: in_use and first_multi only handle unsigned values List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org On Wed, Dec 02, 2009 at 01:04:27PM +0100, Juan Quintela wrote: > And they were saved/loaded as unsigned already I'm not sure how does on save/load a value as unsigned. Could you please provide motivation for this and similar changes? Not that it matters very much, but int is slightly cleaner than uint32_t for something that is only 1 or 0. > Signed-off-by: Juan Quintela > --- > hw/virtio-net.c | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/virtio-net.c b/hw/virtio-net.c > index 05cc67f..589ea80 100644 > --- a/hw/virtio-net.c > +++ b/hw/virtio-net.c > @@ -50,8 +50,8 @@ typedef struct VirtIONet > uint8_t nouni; > uint8_t nobcast; > struct { > - int in_use; > - int first_multi; > + uint32_t in_use; > + uint32_t first_multi; > uint8_t multi_overflow; > uint8_t uni_overflow; > uint8_t *macs; > @@ -715,7 +715,7 @@ static void virtio_net_save(QEMUFile *f, void *opaque) > qemu_put_be16s(f, &n->status); > qemu_put_8s(f, &n->promisc); > qemu_put_8s(f, &n->allmulti); > - qemu_put_be32(f, n->mac_table.in_use); > + 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); > @@ -756,7 +756,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) > } > > if (version_id >= 5) { > - n->mac_table.in_use = qemu_get_be32(f); > + qemu_get_be32s(f, &n->mac_table.in_use); > qemu_get_buffer(f, n->mac_table.macs, > n->mac_table.in_use * ETH_ALEN); > } > -- > 1.6.5.2