From patchwork Tue Jan 19 16:10:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 570027 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8BE0514030F for ; Wed, 20 Jan 2016 03:11:50 +1100 (AEDT) Received: from localhost ([::1]:37759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLYsm-00067L-DO for incoming@patchwork.ozlabs.org; Tue, 19 Jan 2016 11:11:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLYrv-0004TD-Na for qemu-devel@nongnu.org; Tue, 19 Jan 2016 11:10:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLYrr-000203-9J for qemu-devel@nongnu.org; Tue, 19 Jan 2016 11:10:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44481) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLYrr-0001zb-4w for qemu-devel@nongnu.org; Tue, 19 Jan 2016 11:10:51 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id DD2DEC0A8477 for ; Tue, 19 Jan 2016 16:10:50 +0000 (UTC) Received: from red.redhat.com (ovpn-113-211.phx2.redhat.com [10.3.113.211]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0JGAlYK008625; Tue, 19 Jan 2016 11:10:50 -0500 From: Eric Blake To: qemu-devel@nongnu.org Date: Tue, 19 Jan 2016 09:10:14 -0700 Message-Id: <1453219845-30939-7-git-send-email-eblake@redhat.com> In-Reply-To: <1453219845-30939-1-git-send-email-eblake@redhat.com> References: <1453219845-30939-1-git-send-email-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: marcandre.lureau@redhat.com, armbru@redhat.com, "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v9 06/37] balloon: Improve use of qapi visitor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Reviewed-by: Marc-André Lureau --- 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 9671635..1ce987a 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -130,10 +130,13 @@ 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) { + goto out_nested; + } } +out_nested: error_propagate(errp, err); err = NULL; visit_end_struct(v, &err);