From patchwork Tue Jul 24 17:20:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 173037 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 186B02C0080 for ; Wed, 25 Jul 2012 05:32:04 +1000 (EST) Received: from localhost ([::1]:40163 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stiou-0005nL-Ie for incoming@patchwork.ozlabs.org; Tue, 24 Jul 2012 13:22:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stinl-0003dg-6i for qemu-devel@nongnu.org; Tue, 24 Jul 2012 13:21:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Stink-0000SP-6c for qemu-devel@nongnu.org; Tue, 24 Jul 2012 13:21:41 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:53639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stink-0000Fl-06 for qemu-devel@nongnu.org; Tue, 24 Jul 2012 13:21:40 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so12773613pbb.4 for ; Tue, 24 Jul 2012 10:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=HTkfUr6T6Dh3AoqoRiKccWKAP83kVsN2YvhPLIb9dNI=; b=tQUzOluFM/le+l8QD3XeqD379XUpo4F9KJIF89K9teGj93ux3wn8TNW8y3A/j2E3HJ 1H7xT/bTGAtSJlAnc8Lh7je+wfjZEx5b5mE3bpohej7j2ejxUO0twbhHAuZUf+Z/IHfe a5FC2RAAvR9CerqmWEQbMMchnn41SYIyt2IetFW64o/FRX9wdxKMVRRhO00xFpOodoQM wHGCoePt1A/pB1vcMT7Hu6OjMcfuPMlDXcdMcZFxygrSYIv5grVm5JU/olzIGWb0VGn+ 15Jz9OXZ+Hr0Z9RFSqey3GOhA0xQE/92KOSghFtTyLtnSu+OEGIn1FSUV4PkKdnCWTZ0 MOkA== Received: by 10.68.193.196 with SMTP id hq4mr4848519pbc.76.1343150499565; Tue, 24 Jul 2012 10:21:39 -0700 (PDT) Received: from loki.morrigu.org (cpe-72-179-62-111.austin.res.rr.com. [72.179.62.111]) by mx.google.com with ESMTPS id nh8sm12522083pbc.60.2012.07.24.10.21.36 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 10:21:38 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 24 Jul 2012 12:20:40 -0500 Message-Id: <1343150454-4677-9-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343150454-4677-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1343150454-4677-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: aliguori@us.ibm.com, quintela@redhat.com, owasserm@redhat.com, yamahata@valinux.co.jp, pbonzini@redhat.com, akong@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 08/22] qapi: qapi_visit.py, support for visiting non-pointer/embedded structs 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 Signed-off-by: Michael Roth Reviewed-by: Anthony Liguori --- scripts/qapi_visit.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/qapi_visit.py b/scripts/qapi_visit.py index 864acb2..8f8cdca 100644 --- a/scripts/qapi_visit.py +++ b/scripts/qapi_visit.py @@ -105,6 +105,15 @@ if (obj && (*obj)->%(prefix)shas_%(c_name)s) { if annotated: if isinstance(argentry['type'], types.ListType): ret += generate_visit_array_body(argname, argentry) + elif argentry.has_key(''): + tmp_ptr_name = "%s_%s_ptr" % (c_var(field_prefix).replace(".", ""), c_var(argname)) + ret += mcgen(''' +%(type)s *%(tmp_ptr)s = &(*obj)->%(c_prefix)s%(c_name)s; +visit_type_%(type)s(m, (obj && *obj) ? &%(tmp_ptr)s : NULL, "%(name)s", errp); +''', + c_prefix=c_var(field_prefix), prefix=field_prefix, + type=type_name(argentry['type']), c_name=c_var(argname), + name=argname, tmp_ptr=tmp_ptr_name) else: ret += mcgen(''' visit_type_%(type)s(m, obj ? &(*obj)->%(c_prefix)s%(c_name)s : NULL, "%(name)s", errp);