From patchwork Fri Oct 19 02:42:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 192498 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 EB7632C0093 for ; Fri, 19 Oct 2012 14:43:29 +1100 (EST) Received: from localhost ([::1]:57714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TP2Ys-0006ST-6C for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2012 22:43:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TP2Xq-0003vM-UJ for qemu-devel@nongnu.org; Thu, 18 Oct 2012 22:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TP2Xp-0002gf-PY for qemu-devel@nongnu.org; Thu, 18 Oct 2012 22:42:42 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:58994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TP2Xp-0002eS-Ix for qemu-devel@nongnu.org; Thu, 18 Oct 2012 22:42:41 -0400 Received: by mail-ob0-f173.google.com with SMTP id wc18so3049obb.4 for ; Thu, 18 Oct 2012 19:42:41 -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=6ox1CREDEj4GYMEAcKMtWxcVJjUCwu0YG3hFxdEpSV8=; b=xiS3UePFh49MfD/UsrEsmKNX19cOxFyu3XS7skFsewX7D1MDc7nXXAZnwnMKNcUrt2 0ZhO3tnXxMXYm8ZjWIYp8WZWXdoaOZWALsYI7IqXDMweIXvy7y57FN8/3WwlPuomm9NK YxwEhdtgcqHXzDDPjrjCfwApNoS0zvVYaPEqEgYPPW3TrqQaAxg0mGvf+NU/qK9rvLtb J6mcsmHg8CPC6OXaw5cYYjF+EHBpDpt5MSLXf+W5aHlQaRleoHSiO0VH/qB7QP/izJOq xUEaxrWvkrbzLX+t3WyghiTgqrmuBvQfjZOX4EGEyOWNqJNRrrgzuwx/EU6RAGQeh3aL I7KA== Received: by 10.60.22.66 with SMTP id b2mr21258993oef.116.1350614561261; Thu, 18 Oct 2012 19:42:41 -0700 (PDT) Received: from loki.austin.ibm.com ([32.97.110.59]) by mx.google.com with ESMTPS id m6sm475144obk.3.2012.10.18.19.42.39 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 19:42:40 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2012 21:42:01 -0500 Message-Id: <1350614540-28583-8-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350614540-28583-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1350614540-28583-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.214.173 Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, blauwirbel@gmail.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH 07/26] 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 Reviewed-by: Anthony Liguori Signed-off-by: Michael Roth --- scripts/qapi_visit.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/qapi_visit.py b/scripts/qapi_visit.py index 856df5e..c531a5a 100644 --- a/scripts/qapi_visit.py +++ b/scripts/qapi_visit.py @@ -145,6 +145,15 @@ if (obj && (*obj)->%(prefix)shas_%(c_name)s) { if annotated: if isinstance(argentry['type'], types.ListType): ret += generate_visit_carray_body(argname, argentry) + elif argentry.has_key('embedded') and argentry['embedded'] == 'true': + 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);