From patchwork Fri Oct 12 21:10:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 191236 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 9AFE02C0083 for ; Sat, 13 Oct 2012 09:16:19 +1100 (EST) Received: from localhost ([::1]:38849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMmXF-0007tv-R9 for incoming@patchwork.ozlabs.org; Fri, 12 Oct 2012 17:12:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMmW7-0005UU-CV for qemu-devel@nongnu.org; Fri, 12 Oct 2012 17:11:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMmW3-0005uS-6d for qemu-devel@nongnu.org; Fri, 12 Oct 2012 17:11:35 -0400 Received: from mail-ie0-f173.google.com ([209.85.223.173]:36593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMmW3-0005iK-33 for qemu-devel@nongnu.org; Fri, 12 Oct 2012 17:11:31 -0400 Received: by mail-ie0-f173.google.com with SMTP id 17so5335456iea.4 for ; Fri, 12 Oct 2012 14:11:30 -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=Qo96u4sO7Tsg5Q+j4RXZjy8SGLmLytdtPLZuQu8Kbrp7PTjJrfuhAmMEtDKTtWXX59 QJUlM6wPxpqZLDPY9T6oZ4zHQ12xqoYERP3LLonbfcU+N4f6IUIet0tt/Q2ueOaIuxAa w3dHpWEGUAEPNcg4x9GZa1k8UjISlb6CwdIHSPwowA8dtpyQsDUglRjzUUIyS1p6m54B 8koLokWdsCy38ySryXIljVsYZdihV3JVej+oPNCwMCrPKFCxkuwusLgtxjp9QsYGDjPM tKqqr9WgtVs0I9hwtexoPK4JUJBHjwcZE+vKZzVKJyf2l/mAVf88xpxKB1367VWbArOo Vd3g== Received: by 10.50.217.167 with SMTP id oz7mr3411982igc.3.1350076290891; Fri, 12 Oct 2012 14:11:30 -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 uj11sm2454777igb.15.2012.10.12.14.11.29 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Oct 2012 14:11:30 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Fri, 12 Oct 2012 16:10:49 -0500 Message-Id: <1350076268-18461-8-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350076268-18461-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1350076268-18461-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.223.173 Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, blauwirbel@gmail.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH v4 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);