From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Slbz8-0003DL-52 for qemu-devel@nongnu.org; Mon, 02 Jul 2012 04:27:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Slbz5-0002O4-Hy for qemu-devel@nongnu.org; Mon, 02 Jul 2012 04:27:53 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:65085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Slbz5-0002NM-9D for qemu-devel@nongnu.org; Mon, 02 Jul 2012 04:27:51 -0400 Received: by wgbfm10 with SMTP id fm10so4505734wgb.10 for ; Mon, 02 Jul 2012 01:27:49 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4FF15B80.9090200@redhat.com> Date: Mon, 02 Jul 2012 10:27:44 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2 v2] 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 Cc: stefanha@linux.vnet.ibm.com, zwanp@cn.ibm.com, Rusty Russell , linuxram@us.ibm.com, senwang@linux.vnet.ibm.com, "Nicholas A. Bellinger" , qemu-devel@nongnu.org, Anthony Liguori , virtualization@lists.linux-foundation.org, =?ISO-8859-15?Q?Andreas_F=E4rber?= Il 21/06/2012 09:54, Cong Meng ha scritto: > Add two interfaces hotplug() and hot_unplug() to scsi bus info. > The embody scsi bus can implement these two interfaces to signal the HBA driver > of guest kernel to add/remove the scsi device in question. > > 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(-) > > diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c > index dbdb99c..f08900e 100644 > --- a/hw/scsi-bus.c > +++ b/hw/scsi-bus.c > @@ -177,6 +177,10 @@ static int scsi_qdev_init(DeviceState *qdev) > dev); > } > > + if (bus->info->hotplug) { > + bus->info->hotplug(bus, dev); > + } > + > err: > return rc; > } > @@ -1539,6 +1543,16 @@ static int get_scsi_requests(QEMUFile *f, void *pv, size_t size) > return 0; > } > > +static int scsi_qdev_unplug(DeviceState *qdev) > +{ > + SCSIDevice *dev = SCSI_DEVICE(qdev); > + SCSIBus *bus = scsi_bus_from_device(dev); > + > + if (bus->info->hot_unplug) > + bus->info->hot_unplug(bus, dev); Tab indentation and braces missing. I fixed this up and applied it to the scsi-next branch. Paolo > + return qdev_simple_unplug_cb(qdev); > +} > + > const VMStateInfo vmstate_info_scsi_requests = { > .name = "scsi-requests", > .get = get_scsi_requests, > @@ -1575,7 +1589,7 @@ static void scsi_device_class_init(ObjectClass *klass, void *data) > DeviceClass *k = DEVICE_CLASS(klass); > k->bus_info = &scsi_bus_info; > k->init = scsi_qdev_init; > - k->unplug = qdev_simple_unplug_cb; > + k->unplug = scsi_qdev_unplug; > k->exit = scsi_qdev_exit; > } > > 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); > > void (*save_request)(QEMUFile *f, SCSIRequest *req); >