Received: by 10.25.0.198 with SMTP id 189csp208735lfa; Wed, 3 May 2017 10:38:54 -0700 (PDT) X-Received: by 10.200.42.171 with SMTP id b40mr3909174qta.92.1493833134473; Wed, 03 May 2017 10:38:54 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 204si2305664qkm.158.2017.05.03.10.38.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 03 May 2017 10:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:37987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5yEn-0003Co-VK for alex.bennee@linaro.org; Wed, 03 May 2017 13:38:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5yEk-0003Ci-A6 for qemu-arm@nongnu.org; Wed, 03 May 2017 13:38:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5yEh-0002MW-80 for qemu-arm@nongnu.org; Wed, 03 May 2017 13:38:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43216) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d5yEh-0002ML-1A; Wed, 03 May 2017 13:38:47 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D2854E05F; Wed, 3 May 2017 17:38:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9D2854E05F Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ehabkost@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9D2854E05F Received: from localhost (ovpn-116-40.gru2.redhat.com [10.97.116.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB640189CB; Wed, 3 May 2017 17:38:42 +0000 (UTC) Date: Wed, 3 May 2017 14:38:41 -0300 From: Eduardo Habkost To: Eric Blake Message-ID: <20170503173841.GT3482@thinpad.lan.raisama.net> References: <1493816238-33120-1-git-send-email-imammedo@redhat.com> <1493816238-33120-24-git-send-email-imammedo@redhat.com> <20170503163543.GR3482@thinpad.lan.raisama.net> <5f71cfda-2a73-77e3-0bf7-85e2aed53811@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f71cfda-2a73-77e3-0bf7-85e2aed53811@redhat.com> X-Fnord: you can see the fnord User-Agent: Mutt/1.8.0 (2017-02-23) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 03 May 2017 17:38:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-arm] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Shannon Zhao , qemu-devel@nongnu.org, Michael Roth , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Paolo Bonzini , Igor Mammedov , David Gibson Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: g5tgr7PMuZvB On Wed, May 03, 2017 at 11:39:10AM -0500, Eric Blake wrote: > On 05/03/2017 11:35 AM, Eduardo Habkost wrote: > > >> + > >> + memset(&cpu, 0, sizeof(cpu)); > >> + cpu.has_node_id = object->u.cpu.has_node_id; > >> + cpu.node_id = object->u.cpu.node_id; > >> + cpu.has_socket_id = object->u.cpu.has_socket_id; > >> + cpu.socket_id = object->u.cpu.socket_id; > >> + cpu.has_core_id = object->u.cpu.has_core_id; > >> + cpu.core_id = object->u.cpu.core_id; > >> + cpu.has_thread_id = object->u.cpu.has_thread_id; > >> + cpu.thread_id = object->u.cpu.thread_id; > > > > We don't have a way to avoid copying each field individually? > > Some visitor trick, maybe? > > > > Eric, Markus, Michael, do you have any suggestions? > > Markus just added QAPI_CLONE_MEMBERS(), which sounds like what you want: > > https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg04867.html Not sure if it would work in this case. Note that cpu and object->u.cpu have different types. 'cpu' is CpuInstanceProps, but object->u.cpu is NodeCpuOptions. NodeCpuOptions has { 'base': 'CpuInstanceProps' }, and CpuInstanceProps field declarations are duplicated in struct NodeCpuOptions. Do you know why struct inheritance is implemented by duplicating the fields of the base struct instead of embedding the base struct? -- Eduardo