Received: from eggs.gnu.org ([2001:4830:134:3::10]:41372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP9QF-0003UX-Ot for qemu-devel@nongnu.org; Fri, 29 Jan 2016 08:49:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aP9QE-0001IR-IC for qemu-devel@nongnu.org; Fri, 29 Jan 2016 08:49:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41711) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP9QE-0001II-DS for qemu-devel@nongnu.org; Fri, 29 Jan 2016 08:49:10 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 0AB128E675 for ; Fri, 29 Jan 2016 13:49:10 +0000 (UTC) From: Eric Blake Date: Fri, 29 Jan 2016 06:48:45 -0700 Message-Id: <1454075341-13658-10-git-send-email-eblake@redhat.com> In-Reply-To: <1454075341-13658-1-git-send-email-eblake@redhat.com> References: <1454075341-13658-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH v10 09/25] balloon: Improve use of qapi visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, armbru@redhat.com, "Michael S. Tsirkin" Rework the control flow of balloon_stats_get_all() to make it easier for a later patch to split visit_end_struct(). Also switch to the uint64 visitor to match the data type. Signed-off-by: Eric Blake --- v10: defer out_nested label to later patch, drop Marc-Andre's R-b v9: no change v8: no change v7: place earlier in series v6: new patch, split from RFC on v5 7/46 --- hw/virtio/virtio-balloon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 9671635..ba1d393 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -130,9 +130,11 @@ static void balloon_stats_get_all(Object *obj, struct Visitor *v, if (err) { goto out_end; } - for (i = 0; !err && i < VIRTIO_BALLOON_S_NR; i++) { - visit_type_int64(v, (int64_t *) &s->stats[i], balloon_stat_names[i], - &err); + for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) { + visit_type_uint64(v, &s->stats[i], balloon_stat_names[i], &err); + if (err) { + break; + } } error_propagate(errp, err); err = NULL; -- 2.5.0