From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnQJ9-0000rI-T8 for qemu-devel@nongnu.org; Thu, 22 May 2014 06:33:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnQJ3-0005lR-1s for qemu-devel@nongnu.org; Thu, 22 May 2014 06:33:07 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48044 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnQJ2-0005lI-RG for qemu-devel@nongnu.org; Thu, 22 May 2014 06:33:00 -0400 Message-ID: <537DD25A.9080506@suse.de> Date: Thu, 22 May 2014 12:32:58 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1400703772-3324-1-git-send-email-stefanha@redhat.com> <1400703772-3324-5-git-send-email-stefanha@redhat.com> <537D22EC.1090409@redhat.com> <537DCEE2.1020402@suse.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicate qdev properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Paolo Bonzini , Peter Crosthwaite , qemu-devel , Stefan Hajnoczi , Frederic Konrad Am 22.05.2014 12:24, schrieb Stefan Hajnoczi: > On Thu, May 22, 2014 at 12:18 PM, Andreas F=C3=A4rber wrote: >> Am 22.05.2014 00:04, schrieb Paolo Bonzini: >>> Il 21/05/2014 22:22, Stefan Hajnoczi ha scritto: >>>> virtio-blk-pci, virtio-blk-s390, and virtio-blk-ccw all duplicate th= e >>>> qdev properties of their VirtIOBlock child. This approach does not = work >>>> well with string or pointer properties since we must be careful abou= t >>>> leaking or double-freeing them. >>>> >>>> Use the QOM alias property to forward property accesses to the >>>> VirtIOBlock child. This way no duplication is necessary. >>>> >>>> Remember to stop calling virtio_blk_set_conf() so that we don't clob= ber >>>> the values already set on the VirtIOBlock instance. >>> >>> Which properties are _not_ being added? This is probably needed for = all >>> other virtio devices so a generic solution would be nice. >> >> "type", "realized" and the child<> property for VirtIODevice come to >> mind, possibly one or two more. >> >> If we follow a generic scheme, we could add an .instance_post_init hoo= k >> for VirtIOPCIProxy iterating over all properties and blacklisting some= . >=20 > I think the trick is to alias all the qdev properties, not the QOM > ones. That way we get all the explicitly declared properties and none > of the implicit ones. I wouldn't oppose that, but you then need to iterate over parent classes until you hit VirtioDeviceClass (or DeviceClass?), to avoid properties falling through the cracks. I just figured it easier and in line with your QMP patch to avoid distinguishing them in new code. But a quick solution is more important than futureproofness here, so I'll take or ack whatever works here. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg