From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShKg1-0005GD-K3 for qemu-devel@nongnu.org; Wed, 20 Jun 2012 09:10:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShKfp-0006Vy-0f for qemu-devel@nongnu.org; Wed, 20 Jun 2012 09:10:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47333 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShKfo-0006TK-MS for qemu-devel@nongnu.org; Wed, 20 Jun 2012 09:10:16 -0400 Message-ID: <4FE1CBAE.5010503@suse.de> Date: Wed, 20 Jun 2012 15:10:06 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <287bf70a546a1ce51a6f3405ba620daaf284bdfe.1340022196.git.mc@linux.vnet.ibm.com> In-Reply-To: <287bf70a546a1ce51a6f3405ba620daaf284bdfe.1340022196.git.mc@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] scsi bus: introduce hotplug() and hot_unplug() interfaces for SCSI bus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cong Meng , Paolo Bonzini , Anthony Liguori Cc: stefanha@linux.vnet.ibm.com, qemu-devel@nongnu.org, zwanp@cn.ibm.com, Rusty Russell , linuxram@us.ibm.com, senwang@linux.vnet.ibm.com, "Nicholas A. Bellinger" , virtualization@lists.linux-foundation.org Am 20.06.2012 08:47, schrieb Cong Meng: > Add two interfaces hotplug() and hot_unplug() to scsi bus info. > The embody scsi bus can implement these two interfaces to signal the HB= A driver > of guest kernel to add/remove the scsi device in question. >=20 > Signed-off-by: Cong Meng > Signed-off-by: Sen Wang > --- > hw/scsi-bus.c | 16 +++++++++++++++- > hw/scsi.h | 2 ++ > 2 files changed, 17 insertions(+), 1 deletions(-) >=20 > diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c > index dbdb99c..cc3ec75 100644 > --- a/hw/scsi-bus.c > +++ b/hw/scsi-bus.c > @@ -177,6 +177,10 @@ static int scsi_qdev_init(DeviceState *qdev) > dev); > } > =20 > + if (bus->info->hotplug) { > + bus->info->hotplug(bus, dev); Tab. > + } > + > err: > return rc; > } > @@ -1539,6 +1543,16 @@ static int get_scsi_requests(QEMUFile *f, void *= pv, size_t size) > return 0; > } > =20 > +static int scsi_qdev_unplug(DeviceState *qdev) > +{ > + SCSIDevice *dev =3D SCSI_DEVICE(qdev); > + SCSIBus *bus =3D DO_UPCAST(SCSIBus, qbus, dev->qdev.parent_bus); Since the tabs need to be fixed anyway, I would suggest to avoid using DO_UPCAST() with QOM types: SCSIBus *bus =3D SCSI_BUS(qdev->parent_bus); Also I'd like to raise the question towards Paolo and Anthony whether we might want to start naming new functions like this one scsi_device_unplug() to avoid the "qdev"? In this case sticking to "qdev" provides symmetry so there's good reasons for both approaches. > + > + if (bus->info->hot_unplug) > + bus->info->hot_unplug(bus, dev); Tab. It seems your editor converts all 8-space indents, please check the second patch. Otherwise looks okay from my side. Andreas > + return qdev_simple_unplug_cb(qdev); > +} > + > const VMStateInfo vmstate_info_scsi_requests =3D { > .name =3D "scsi-requests", > .get =3D get_scsi_requests, > @@ -1575,7 +1589,7 @@ static void scsi_device_class_init(ObjectClass *k= lass, void *data) > DeviceClass *k =3D DEVICE_CLASS(klass); > k->bus_info =3D &scsi_bus_info; > k->init =3D scsi_qdev_init; > - k->unplug =3D qdev_simple_unplug_cb; > + k->unplug =3D scsi_qdev_unplug; > k->exit =3D scsi_qdev_exit; > } > =20 > diff --git a/hw/scsi.h b/hw/scsi.h > index 2eb66f7..5768071 100644 > --- a/hw/scsi.h > +++ b/hw/scsi.h > @@ -130,6 +130,8 @@ struct SCSIBusInfo { > void (*transfer_data)(SCSIRequest *req, uint32_t arg); > void (*complete)(SCSIRequest *req, uint32_t arg, size_t resid); > void (*cancel)(SCSIRequest *req); > + void (*hotplug)(SCSIBus *bus, SCSIDevice *dev); > + void (*hot_unplug)(SCSIBus *bus, SCSIDevice *dev); > QEMUSGList *(*get_sg_list)(SCSIRequest *req); > =20 > void (*save_request)(QEMUFile *f, SCSIRequest *req); --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg