Received: from eggs.gnu.org ([2001:4830:134:3::10]:56278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQxjn-0004Rp-Je for qemu-devel@nongnu.org; Mon, 08 Sep 2014 08:08:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQxjf-0000Ep-Ph for qemu-devel@nongnu.org; Mon, 08 Sep 2014 08:08:03 -0400 Received: from blu004-omc1s9.hotmail.com ([65.55.116.20]:59825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQxjf-0000El-LF for qemu-devel@nongnu.org; Mon, 08 Sep 2014 08:07:55 -0400 Message-ID: From: Gonglei References: <1409906256-11368-1-git-send-email-arei.gonglei@huawei.com> <1409906256-11368-25-git-send-email-arei.gonglei@huawei.com> <20140905183934.GM32084@thinpad.lan.raisama.net> In-Reply-To: <20140905183934.GM32084@thinpad.lan.raisama.net> Date: Mon, 8 Sep 2014 20:07:10 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Subject: Re: [Qemu-devel] [PATCH v7 24/28] ide: add bootindex to qom property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Eduardo Habkost' , arei.gonglei@huawei.com Cc: kwolf@redhat.com, chenliang88@huawei.com, peter.crosthwaite@xilinx.com, weidong.huang@huawei.com, stefanha@redhat.com, mst@redhat.com, aik@ozlabs.ru, hutao@cn.fujitsu.com, luonengjun@huawei.com, qemu-devel@nongnu.org, armbru@redhat.com, agraf@suse.de, hani@linux.com, kraxel@redhat.com, aliguori@amazon.com, imammedo@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, peter.huangpeng@huawei.com, akong@redhat.com, afaerber@suse.de > Subject: Re: [Qemu-devel] [PATCH v7 24/28] ide: add bootindex to qom = property >=20 > On Fri, Sep 05, 2014 at 04:37:32PM +0800, arei.gonglei@huawei.com = wrote: > > From: Gonglei > > > > Add a qom property with the same name 'bootindex', > > when we remove it form qdev property, things will > > continue to work just fine, and we can use qom features > > which are not supported by qdev property. > > > > Signed-off-by: Gonglei > > --- > > hw/ide/qdev.c | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c > > index efab95b..9e2ed40 100644 > > --- a/hw/ide/qdev.c > > +++ b/hw/ide/qdev.c > > @@ -191,6 +191,17 @@ static int ide_dev_initfn(IDEDevice *dev, > IDEDriveKind kind) > > return 0; > > } > > > > +static void ide_dev_instance_init(Object *obj) > > +{ > > + DeviceState *dev =3D DEVICE(obj); > > + IDEDevice *d =3D DO_UPCAST(IDEDevice, qdev, dev); > > + > > + device_add_bootindex_property(obj, &d->conf.bootindex, > > + "bootindex", > > + d->unit ? "/disk@1" : "/disk@0", > > + &d->qdev, NULL); > > +} > > + > > static int ide_hd_initfn(IDEDevice *dev) > > { > > return ide_dev_initfn(dev, IDE_HD); > > @@ -238,6 +249,7 @@ static const TypeInfo ide_hd_info =3D { > > .parent =3D TYPE_IDE_DEVICE, > > .instance_size =3D sizeof(IDEDrive), > > .class_init =3D ide_hd_class_init, > > + .instance_init =3D ide_dev_instance_init, > > }; > > > > static Property ide_cd_properties[] =3D { > > @@ -260,6 +272,7 @@ static const TypeInfo ide_cd_info =3D { > > .parent =3D TYPE_IDE_DEVICE, > > .instance_size =3D sizeof(IDEDrive), > > .class_init =3D ide_cd_class_init, > > + .instance_init =3D ide_dev_instance_init, > > }; > > > > static Property ide_drive_properties[] =3D { > > @@ -282,6 +295,7 @@ static const TypeInfo ide_drive_info =3D { > > .parent =3D TYPE_IDE_DEVICE, > > .instance_size =3D sizeof(IDEDrive), > > .class_init =3D ide_drive_class_init, > > + .instance_init =3D ide_dev_instance_init, > > }; >=20 > If all TYPE_IDE_DEVICE subclasses have the same instance_init, why not > just set ide_device_type_info.instance_init =3D ide_dev_instance_init? >=20 OK. TBH I have not noticed this way, sorry.=20 Great thanks for your help and reviewing, Eduardo. :) Best regards, -Gonglei